Public Member Functions | Friends

SSParticle Class Reference

Search for all occurrences

Detailed Description

See also:
Class SpringSys, Class SSSpring, Class SSConstraintPoint

Description:
This class is available in release 4.0 and later only.

This class represents the spring system particle.

Data Members:
private:

float mass;

The spring particle mass.

float drag;

The spring particle drag.

Point3 pos, vel, force;

The spring particle position, velocity, and force.

Tab<SSSpring> springs;

The table of spring system springs.

#include <springsys.h>

Inheritance diagram for SSParticle:
Inheritance graph
[legend]

List of all members.

Public Member Functions

  SSParticle ()
  ~SSParticle ()
SSParticle operator= (const SSParticle &from)
SSParticle  Copy (const SSParticle from)
float  GetMass ()
void  SetMass (float m)
float  GetDrag ()
void  SetDrag (float d)
Point3  GetPos ()
void  SetPos (Point3 p)
Point3  GetVel ()
void  SetVel (Point3 v)
Point3  GetForce ()
void  SetForce (Point3 f)
Tab< SSSpring > *  GetSprings ()
SSSpring GetSpring (int i)
void  SetSpring (int i, SSSpring spring)
void  SetSprings (Tab< SSSpring > sTab)
SpringSysExport BOOL  AddSpring (SSConstraintPoint *bone, Point3 length, float tension=2.0f, float dampening=1.0f)
void  DeleteSpring (int index)

Friends

class  SpringSys

Constructor & Destructor Documentation

SSParticle ( ) [inline]
Remarks:
Constructor.
Default Implementation:
{

mass = 300.0f;

drag = 1.0f;

pos = vel = force = Point3(0.0f,0.0f,0.0f);

springs.ZeroCount();

}
        {
            mass = 300.0f; 
            drag = 1.0f; 
            pos = vel = force = Point3(0.0f,0.0f,0.0f); 
            springs.ZeroCount();
        }
~SSParticle ( ) [inline]
Remarks:
Destructor.
Default Implementation:
{ }
{}

Member Function Documentation

SSParticle& operator= ( const SSParticle from ) [inline]
Remarks:
Assignment operator.
        {
            mass = from.mass;
            drag = from.drag;
            pos = from.pos;
            vel = from.vel;
            force = from.force;
            springs.ZeroCount();
            springs.Shrink();
            for (int i=0;i<from.springs.Count();i++)
            {
                SSSpring spring = from.springs[i];
                springs.Append(1, &spring);
            }
            return *this;
        }
SSParticle Copy ( const SSParticle  from ) [inline]
Remarks:
This method allows you to copy the data from the specified SSParticle.
Parameters:
const SSParticle from

The spring system particle to copy from.
        {
            SSSpring spring;
            mass = from.mass;
            drag = from.drag;
            pos = from.pos;
            vel = from.vel;
            force = from.force;
            springs.ZeroCount();
            for (int i=0;i<from.springs.Count();i++)
            {
                spring.Copy(from.springs[i]);
                springs.Append(1, &spring);
            }
            return *this;
        }
float GetMass ( ) [inline]
Remarks:
This method returns the spring particle mass.
{return mass;}
void SetMass ( float  m ) [inline]
Remarks:
This method allows you to set the spring particle mass.
Parameters:
float m

The mass to set.
{mass = m;}
float GetDrag ( ) [inline]
Remarks:
This method returns the spring particle drag.
{return drag;}
void SetDrag ( float  d ) [inline]
Remarks:
This method allows you to set the spring particle drag.
Parameters:
float d

The drag value to set.
{drag = d;}
Point3 GetPos ( ) [inline]
Remarks:
This method returns the spring particle position.
{return pos;}
void SetPos ( Point3  p ) [inline]
Remarks:
This method allows you to set the spring particle position.
Parameters:
Point3 p

The position to set.
{pos = p;}
Point3 GetVel ( ) [inline]
Remarks:
This method returns the spring particle velocity.
{return vel;}
void SetVel ( Point3  v ) [inline]
Remarks:
This method allows you to set the spring particle velocity.
Parameters:
Point3 v

The velocity to set.
{vel = v;}
Point3 GetForce ( ) [inline]
Remarks:
This method returns the spring particle force.
{return force;}
void SetForce ( Point3  f ) [inline]
Remarks:
This method allows you to set the spring particle force.
Parameters:
Point3 f

The force to set.
{force = f;}
Tab<SSSpring>* GetSprings ( ) [inline]
Remarks:
This method returns a pointer to the table of springs.
{ return &springs;}
SSSpring* GetSpring ( int  i ) [inline]
Remarks:
This method returns a pointer to the I-th spring in the table.
Parameters:
int i

The index of the spring to return.
                                   {if (i>=0 && i<springs.Count()) return &(springs[i]);
                                    else return NULL; }
void SetSpring ( int  i,
SSSpring  spring 
) [inline]
Remarks:
This method allows you to set the specified spring at the specified I-th index in the table.
Parameters:
int i

The index of the spring to set.

SSSpring spring

The spring to set.
                                               {if (i>=0 && i<springs.Count()) 
                                                    springs[i] = spring; }
void SetSprings ( Tab< SSSpring sTab ) [inline]
Remarks:
This method allows you to set the entire spring table.
Parameters:
Tab<SSSpring> sTab

The table of springs to set.
        { 
            //springs = NULL;
            springs.ZeroCount(); 
            for (int i = 0;i<sTab.Count();i++)
            {
                springs.Append(1, &(sTab[i]));
            } 
        }
SpringSysExport BOOL AddSpring ( SSConstraintPoint bone,
Point3  length,
float  tension = 2.0f,
float  dampening = 1.0f 
)
Remarks:
This method allows you to add a spring to the table. Note that if the spring already exists it will be made stronger.
Parameters:
SSConstraintPoint *bone

A pointer to the spring system constraint point to set.

Point3 length

The length of the spring.

tension=2.0f

The tension of the spring.

float dampening = 1.0f

The dampening value of the spring.
Returns:
TRUE if the spring was added, FALSE if the spring was made stronger.
void DeleteSpring ( int  index ) [inline]
Remarks:
This method allows you to delete a spring.
Parameters:
int index

The index in the table of the spring to delete.
        {       
            if ( index == 0 ) return;
            for (int i=0;i<springs.Count();i++)
            {
                if ( (springs[i].GetPointConstraint()->GetIndex()) == index)
                    springs.Delete(i--, 1);
                else if (springs[i].GetPointConstraint()->GetIndex() > index)
                    springs[i].GetPointConstraint()->SetIndex(springs[i].GetPointConstraint()->GetIndex()-1);
            }
        }

Friends And Related Function Documentation

friend class SpringSys [friend]

SSParticle SSParticle SSParticle SSParticle SSParticle SSParticle SSParticle SSParticle SSParticle SSParticle
SSParticle SSParticle SSParticle SSParticle SSParticle SSParticle SSParticle SSParticle SSParticle SSParticle