# ParticleCloudPrimitive Class Reference

Related Scripting Object: ParticleCloudPrimitive

This class provides access to the collection of particles that make up a ParticleCloud. More...

`#include <xsi_particlecloudprimitive.h>`

Inheritance diagram for ParticleCloudPrimitive:

List of all members.

## Public Member Functions
| ParticleCloudPrimitive ()
| ~ParticleCloudPrimitive ()
| ParticleCloudPrimitive (const CRef &in_ref)
| ParticleCloudPrimitive (const ParticleCloudPrimitive &in_obj)
bool | IsA (siClassID in_ClassID) const
siClassID | GetClassID () const
ParticleCloudPrimitive & | operator= (const ParticleCloudPrimitive &in_obj)
ParticleCloudPrimitive & | operator= (const CRef &in_ref)
CStatus | AddParticles (LONG in_NbParticles, const CRef &in_ParType)
CStatus | RemoveParticles (const CLongArray &in_IndexArray)
CStatus | RemoveParticlesWithIDs (const CLongArray &in_IDArray)
LONG | GetCount () const
Particle | GetParticle (LONG in_index) const
CRefArray | GetParticleTypes () const
Particle | FindParticle (LONG in_ID) const
CStatus | PutPositionArray (const CDoubleArray &in_values)
CStatus | GetPositionArray (CDoubleArray &out_values)
CStatus | PutVelocityArray (const CDoubleArray &in_values)
CStatus | GetVelocityArray (CDoubleArray &out_values)
CStatus | PutRotationArray (const CDoubleArray &in_values)
CStatus | GetRotationArray (CDoubleArray &out_values)
CStatus | PutAngularVelocityArray (const CDoubleArray &in_values)
CStatus | GetAngularVelocityArray (CDoubleArray &out_values)
CStatus | PutUVWArray (const CDoubleArray &in_values)
CStatus | GetUVWArray (CDoubleArray &out_values)
CStatus | PutColorArray (const CDoubleArray &in_values)
CStatus | GetColorArray (CDoubleArray &out_values)
CStatus | PutSizeArray (const CDoubleArray &in_values)
CStatus | GetSizeArray (CDoubleArray &out_values)
CStatus | PutSpriteAngleArray (const CDoubleArray &in_values)
CStatus | GetSpriteAngleArray (CDoubleArray &out_values)
CStatus | PutMassArray (const CDoubleArray &in_values)
CStatus | GetMassArray (CDoubleArray &out_values)
CStatus | GetDensityArray (CDoubleArray &out_values)
CStatus | GetPressureArray (CDoubleArray &out_values)
CStatus | GetPathLengthArray (CDoubleArray &out_values)
CStatus | PutAgeArray (const CLongArray &in_values)
CStatus | GetAgeArray (CLongArray &out_values)
CStatus | PutSeedArray (const CLongArray &in_values)
CStatus | GetSeedArray (CLongArray &out_values)
CStatus | PutAgeLimitArray (const CLongArray &in_values)
CStatus | GetAgeLimitArray (CLongArray &out_values)
CStatus | PutSpriteIndexArray (const CLongArray &in_values)
CStatus | GetSpriteIndexArray (CLongArray &out_values)
CStatus | PutTypeIDArray (const CLongArray &in_values)
CStatus | GetTypeIDArray (CLongArray &out_values)
CStatus | GetIDArray (CLongArray &in_values)

## Detailed Description

This class provides access to the collection of particles that make up a ParticleCloud.

See also:
  Particle, ParticleCloudPrimitive

Example:

              using namespace XSI;
              Application app ;

              CValueArray args(2) ;
              CValue outArg;

              args[0] = (LONG) siSphereType ;
              app.ExecuteCommand( L"CreateParticleType", args, outArg ) ;

              Property myParType = args[1] ;
              myParType.PutName( CString(L"CustomParType") ) ;

              CRefArray particleTypeArray ;
              particleTypeArray.Add( myParType ) ;

              // Create a particle cloud.  This has no emittor, and no particle operator
              // so the simulation is completely the responsibility of the plug-in
              ParticleCloud myParticleCloud ;
              app.GetActiveSceneRoot().AddParticleCloud(
                                          particleTypeArray,
                                          L"CustomSimulation",
                                          myParticleCloud ) ;

              // Particles are accessed via the Primitive
              ParticleCloudPrimitive myParticlePrim = myParticleCloud.GetActivePrimitive() ;

              myParticlePrim.AddParticles( 31, myParType ) ;

              // Position the particles based on the quadradic formula f(x)=.5x^2 - 6
              for ( LONG i = 0 ; i < myParticlePrim.GetCount() ; i++ )
              {
                  Particle particle = myParticlePrim.GetParticle(i) ;

                  double xval = (i/3.0)-5 ;
                  particle.PutPosition( MATH::CVector3( xval, (0.5 * xval * xval)-6, 0 ) ) ;
              }

## Constructor & Destructor Documentation

ParticleCloudPrimitive | ( |  | ) |

Default constructor.

~ParticleCloudPrimitive | ( |  | ) |

Default destructor.

ParticleCloudPrimitive | ( | const CRef & | in_ref | ) |

Constructor.

Parameters:

  | in_ref | constant reference object.

ParticleCloudPrimitive | ( | const ParticleCloudPrimitive & | in_obj | ) |

Copy constructor.

Parameters:

  | in_obj | constant class object.

## Member Function Documentation

bool IsA | ( | siClassID | in_ClassID | ) | const`[virtual]`

Returns true if a given class type is compatible with this API class.

Parameters:

  | in_ClassID | class type.

Returns:
  true if the class is compatible, false otherwise.

Reimplemented from Primitive.

siClassID GetClassID | ( |  | ) | const`[virtual]`

Returns the type of the API class.

Returns:
  The class type.

Reimplemented from Primitive.

ParticleCloudPrimitive& operator= | ( | const ParticleCloudPrimitive & | in_obj | ) |

Creates an object from another object. The newly created object is set to empty if the input object is not compatible.

Parameters:

  | in_obj | constant class object.

Returns:
  The new ParticleCloudPrimitive object.

ParticleCloudPrimitive& operator= | ( | const CRef & | in_ref | ) |

Creates an object from a reference object. The newly created object is set to empty if the input reference object is not compatible.

Parameters:

  | in_ref | constant class object.

Returns:
  The new ParticleCloudPrimitive object.

Reimplemented from Primitive.

CStatus AddParticles | ( | LONG | in_NbParticles,
|  | const CRef & | in_ParType |
| ) |  |  |

Adds particles to a cloud. This function can only be called from custom operators or on clouds with no Operator. For example, this function will fail on a cloud created with the CreateParticleCloud command unless the cloud is frozen.

Parameters:

  | in_NbParticles | Number of new particles to add.
  | in_ParType | Reference to an existing particle type object.

Note:
  The particle type should be one of the particle types initially specified in the call to X3DObject::CreateParticleCloud. If no particle type is specified then the first particle type associated with the cloud is used.

Since:
  4.0

CStatus RemoveParticles | ( | const CLongArray & | in_IndexArray | ) |

Removes particles by index. This function can only be called from custom operators or on clouds with no Operator.

Parameters:

  | in_IndexArray | Array with the indices of the particles to remove.

CStatus RemoveParticlesWithIDs | ( | const CLongArray & | in_IDArray | ) |

Removes particles by their IDs. This function can only be called from custom operators or on clouds with no Operator.

Parameters:

  | in_IDArray | Array with the particle IDs of the particles to remove.

See also:
  Particle::GetID

LONG GetCount | ( |  | ) | const

Returns the number of particles in the cloud.

Particle GetParticle | ( | LONG | in_index | ) | const

Returns the Particle object at the specified index.

Parameters:

  | in_index | Index of the particle. Particles always have an index between 0 and Particle::GetCount - 1.

CRefArray GetParticleTypes | ( |  | ) | const

Returns an array of the particle types associated with the particle cloud. A particle cloud might have particles with different types on the same cloud. An associated particle type is created automatically when the CreateParticleCloud command is called. A particle type can also be created by calling the CreateParticleType command and associated with a cloud when X3DObject::AddParticleCloud is called.

See also:
  ParticleType

Particle FindParticle | ( | LONG | in_ID | ) | const

Searches for a particle by its ID. Because the index of a particle may change during a simulation but its ID will not, it is sometimes convenient to lookup a particle by its ID. However finding particles by this mechanism is moderately less efficient than using Particle::GetParticle.

Parameters:

  | in_ID | The particle ID

Returns:
  The particle object.

  Invalid object if the requested ID was not found.

See also:
  Particle::GetID, Particle::GetIndex

CStatus PutPositionArray | ( | const CDoubleArray & | in_values | ) |

Sets the positions for all the particles in the cloud with a single API call. This approach is more efficient than calling Particle::PutPosition on every single particle.

Parameters:

  | in_values | Array with new X,Y,Z values for each particle, ordered as
       X(0), Y(0), Z(0)... X(n-1), Y(n-1), Z(n-1)

See also:
  Particle::PutPosition

CStatus GetPositionArray | ( | CDoubleArray & | out_values | ) |

Returns the positions for all the particles in the cloud with a single API call. This approach is more efficient than calling Particle::GetPosition on every single particle.

Return values:

  | out_values | Returned array contains the X,Y,Z values for each particle, ordered as
       X(0), Y(0), Z(0)... X(n-1), Y(n-1), Z(n-1)

See also:
  Particle::GetPosition

CStatus PutVelocityArray | ( | const CDoubleArray & | in_values | ) |

Sets the velocities for all the particles in the cloud with a single API call. This approach is more efficient than calling Particle::PutVelocity on every single particle.

Parameters:

  | in_values | Array with X,Y,Z values for each particle, ordered as
       X(0), Y(0), Z(0)... X(n-1), Y(n-1), Z(n-1)

See also:
  Particle::PutVelocity

CStatus GetVelocityArray | ( | CDoubleArray & | out_values | ) |

Returns the velocities for all the particles in the cloud with a single API call. This approach is more efficient than calling Particle::GetVelocity on every single particle.

Return values:

  | out_values | Returned array will contain the X,Y,Z values for each particle, ordered as
       X(0), Y(0), Z(0)... X(n-1), Y(n-1), Z(n-1)

See also:
  Particle::GetVelocity

CStatus PutRotationArray | ( | const CDoubleArray & | in_values | ) |

Sets the rotation for all the particles in the cloud with a single API call. This approach is more efficient than calling Particle::PutRotation on every single particle.

Parameters:

  | in_values | Array with new X,Y,Z values (in radians) for each particle, ordered as
       X(0), Y(0), Z(0)... X(n-1), Y(n-1), Z(n-1)

See also:
  Particle::PutRotation

CStatus GetRotationArray | ( | CDoubleArray & | out_values | ) |

Returns the rotation vectors for all the particles in the cloud with a single API call. This approach is more efficient than calling Particle::GetRotation on every single particle.

Return values:

  | out_values | Returned array will contain the X,Y,Z values (in radians) for each particle, ordered as
       X(0), Y(0), Z(0)... X(n-1), Y(n-1), Z(n-1)

See also:
  Particle::GetRotation

CStatus PutAngularVelocityArray | ( | const CDoubleArray & | in_values | ) |

Sets the angular velocities for all the particles in the cloud with a single API call.This approach is more efficient than calling Particle::PutAngularVelocity on every single particle.

Parameters:

  | in_values | Array with new X,Y,Z Euler angle values (in radians) for each particle, ordered as
       X(0), Y(0), Z(0)... X(n-1), Y(n-1), Z(n-1)

See also:
  Particle::PutAngularVelocity

CStatus GetAngularVelocityArray | ( | CDoubleArray & | out_values | ) |

Returns the angular velocities for all the particles in the cloud with a single API call. This approach is more efficient than calling Particle::GetAngularVelocity on every single particle.

Return values:

  | out_values | Returned array will contain the X,Y,Z Euler angles (in radians) for each particle, ordered as
       X(0), Y(0), Z(0)... X(n-1), Y(n-1), Z(n-1)

See also:
  Particle::GetAngularVelocity

CStatus PutUVWArray | ( | const CDoubleArray & | in_values | ) |

Sets the emission position in UVW coordinates for all the particles in the cloud with a single API call. This approach is more efficient than calling Particle::PutUVW on every single particle.

Parameters:

  | in_values | Array with new U,V,W position values for each particle, ordered as
       U(0), V(0), W(0)... U(n-1), V(n-1), W(n-1)

See also:
  Particle::PutUVW

CStatus GetUVWArray | ( | CDoubleArray & | out_values | ) |

Returns the emission position in UVW coordinates for all the particles in the cloud with a single API call. This approach is more efficient than calling Particle::GetUVW on every single particle.

Return values:

  | out_values | Returned array will contain the U,V,W values for each particle, ordered as
       U(0), V(0), W(0)... U(n-1), V(n-1), W(n-1)

See also:
  Particle::GetUVW

CStatus PutColorArray | ( | const CDoubleArray & | in_values | ) |

Sets the color of all particles in the cloud with a single API call. This approach is more efficient than calling Particle::PutColor on every single particle.

Parameters:

  | in_values | Array with R,G,B,A color values for each particle, ordered as
       R(0), G(0), B(0), A(0)... R(n-1), G(n-1), B(n-1), A(n-1)

See also:
  Particle::PutColor

CStatus GetColorArray | ( | CDoubleArray & | out_values | ) |

Returns the colors of all the particles in the cloud with a single API call. This approach is more efficient than calling Particle::GetColor on every single particle.

Return values:

  | out_values | Returned array will contain the R,G,B,A values for each particle, ordered as
       R(0), G(0), B(0), A(0)... R(n-1), G(n-1), B(n-1), A(n-1)

See also:
  Particle::GetColor

CStatus PutSizeArray | ( | const CDoubleArray & | in_values | ) |

Sets the size of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::PutSize on every single particle.

Parameters:

  | in_values | Array with new size values for each particle.

See also:
  Particle::PutSize

CStatus GetSizeArray | ( | CDoubleArray & | out_values | ) |

Returns the size of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::GetSize on every single particle.

Return values:

  | out_values | Returned array will contain the size of each particle

See also:
  Particle::GetSize

CStatus PutSpriteAngleArray | ( | const CDoubleArray & | in_values | ) |

Sets the sprite angle of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::PutSpriteAngle on every single particle.

Parameters:

  | in_values | Array with new sprite angle values for each particle.

See also:
  Particle::PutSpriteAngle

CStatus GetSpriteAngleArray | ( | CDoubleArray & | out_values | ) |

Returns the sprite angle for all the particles in the cloud with a single API call. This approach is more efficient than calling Particle::GetSpriteAngle on every single particle.

Return values:

  | out_values | Returned array will contain the sprite angle of each particle

See also:
  Particle::GetSpriteAngle

CStatus PutMassArray | ( | const CDoubleArray & | in_values | ) |

Sets the mass of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::PutMass on every single particle.

Parameters:

  | in_values | Array with new mass values for each particle.

See also:
  Particle::PutMass

CStatus GetMassArray | ( | CDoubleArray & | out_values | ) |

Returns the mass of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::GetMass on every single particle.

Return values:

  | out_values | Returned array will contain the mass of each particle

See also:
  Particle::GetMass

CStatus GetDensityArray | ( | CDoubleArray & | out_values | ) |

Returns the density of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::GetDensity on every single particle.

Return values:

  | out_values | Returned array will contain the density of each particle

See also:
  Particle::GetDensity

CStatus GetPressureArray | ( | CDoubleArray & | out_values | ) |

Returns the pressure on each particle in the cloud with a single API call. This approach is more efficient than calling Particle::GetPressure on every single particle.

Return values:

  | out_values | Returned array will contain the pressure of each particle

See also:
  Particle::GetPressure

CStatus GetPathLengthArray | ( | CDoubleArray & | out_values | ) |

Returns the length of the path travelled by each particles in the cloud with a single API call. This approach is more efficient than calling Particle::GetPathLength on every single particle.

Return values:

  | out_values | Returned array will contain the path length of each particle

See also:
  Particle::GetPathLength

CStatus PutAgeArray | ( | const CLongArray & | in_values | ) |

Sets the age of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::PutAge on every single particle.

Parameters:

  | in_values | Array with new age values for each particle.

See also:
  Particle::PutAge

CStatus GetAgeArray | ( | CLongArray & | out_values | ) |

Returns the age of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::GetAge on every single particle.

Return values:

  | out_values | Returned array will contain the age of each particle

See also:
  Particle::GetAge

CStatus PutSeedArray | ( | const CLongArray & | in_values | ) |

Sets the random number generation seed of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::PutSeed on every single particle.

Parameters:

  | in_values | Array with new seed values for each particle.

See also:
  Particle::PutSeed

CStatus GetSeedArray | ( | CLongArray & | out_values | ) |

Returns the random number generation seed of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::GetSeed on every single particle.

Return values:

  | out_values | Returned array will contain the seed of each particle

See also:
  Particle::GetSeed

CStatus PutAgeLimitArray | ( | const CLongArray & | in_values | ) |

Sets the life span of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::PutAgeLimit on every single particle.

Parameters:

  | in_values | Array with new age limit values for each particle.

See also:
  Particle::PutAgeLimit

CStatus GetAgeLimitArray | ( | CLongArray & | out_values | ) |

Returns the life span of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::GetAgeLimit on every single particle.

Return values:

  | out_values | Returned array will contain the age limit of each particle

See also:
  Particle::GetAgeLimit

CStatus PutSpriteIndexArray | ( | const CLongArray & | in_values | ) |

Sets the sprite index of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::PutSpriteIndex on every single particle.

Parameters:

  | in_values | Array with new sprite index values for each particle.

See also:
  Particle::PutSpriteIndex

CStatus GetSpriteIndexArray | ( | CLongArray & | out_values | ) |

Returns the sprite index of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::GetSpriteIndex on every single particle.

Return values:

  | out_values | Returned array will contain the sprite index of each particle

See also:
  Particle::GetSpriteIndex

CStatus PutTypeIDArray | ( | const CLongArray & | in_values | ) |

Sets the particle type ID of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::PutTypeID on every single particle.

Parameters:

  | in_values | Array with new particle type IDs for each particle.

See also:
  Particle::PutTypeID

CStatus GetTypeIDArray | ( | CLongArray & | out_values | ) |

Returns the particle type ID of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::GetTypeID on every single particle.

Return values:

  | out_values | Returned array will contain the type ID of each particle

See also:
  Particle::GetTypeID

CStatus GetIDArray | ( | CLongArray & | in_values | ) |

Returns the ID of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::GetID on every single particle.

Parameters:

  | in_values | Returned array will contain the ID of each particle

See also:
  Particle::GetID

The documentation for this class was generated from the following file:

- xsi_particlecloudprimitive.h