Public Member Functions | Public Attributes | Protected Attributes

Cloth Class Reference

class which creates a cloth. It contains all themethods to work with masses and springs, which combined together in a mass-spring system represent a cloth More...

#include <Cloth.h>

List of all members.

Public Member Functions

 Cloth (float clothSize, int _massesNum, float _damping, float _springDamping, float _timeStep, float _gravity, float _stiffeness, float _criticalDistance, float _friction, float _bumpiness, ngl::TransformStack *_transform)
 the constractor of the cloth class. set-up the default parameters to the cloth [in] clothSize the size of the cloth [in] _massesNum amount of masses to be used to generate the cloth [in] _damping the damping of the cloth, this parameter effects masses of the cloth [in] _springDamping damping of the cloth, this parameter effects springs of the cloth [in] _timeStep time step for integration [in] _gravity gravity force acting on each mass of the cloth [in] _stiffeness stiffness of the cloth [in] _criticalDistance the distance which should be maintained between the cloth and other objects of the scene [in] _friction fricition of the cloth [in] _bumpiness bumpiness of the cloth [in] _transform transformation stack
void createCloth (std::vector< ngl::Vector > vertexList, std::vector< ngl::Face > facesList, std::vector< ngl::Vector > normalsList)
 creates a cloth base on list of vertices, list of faces and list of normals
void DrawLine (ngl::Vector *points)
 draws a line based on set of input points
void setClothSize (float _clothSize)
 set the size of the cloth
void updateSprings ()
 update springs of the cloth
void setActiveMass (bool _isActive, int constraintNumber)
 sets the mass, which user interacts with at the moment
void moveActiveMass (ngl::Vector _displaysment)
 changes the position of the active mass in response to the user action
void setConstraintPoint1 (int massNum, bool _activated)
 set the position of the constraint point1 on cloth
void setConstraintPoint2 (int massNum, bool _activated)
 set the position of the constraint point1 on cloth
void setConstraintPoint3 (int massNum, bool _activated)
 set the position of the constraint point1 on cloth
void setConstraintPoint4 (int massNum, bool _activated)
 set the position of the constraint point1 on cloth
float getClothSize ()
 get the size of the cloth
void setMassesNum (int _massesNum)
 set the number of masses in a line of the cloth
float getMassesNum ()
 get the number of masses in a line of the cloth
std::string getIntegrationMethod ()
 get the string variant of integration na,e
void calculateClothNormals ()
 method to calculate cloth normals
void setDumping (float _dumping)
 set the DAMPING [in] _dumping the value to set
void setTimeStep (float _timeStep)
 set the TIME_STEPSIZE [in] _timeStep the value to set
void setSpringDumping (float _dumping)
 set the spring DAMPING [in] _d
void setGravity (float _gravity)
 set the GRAVITY [in] _gravity the value to set
void setCriticalDistance (float _criticalDistance)
 set the CRITICAL_DISTANCE [in] _criticalDistance the value to set
void setFricition (float _friction)
 set the FRICITION [in] _friction the value to set
void setBumpiness (float _bumpiness)
 set the BUMPINESS [in] _bumpiness the value to set
void setStiffness (float _stifness)
 set the STIFFENESS [in] _stifness the value to set
float getSpringDamping ()
 get the springDAMPING
float getDamping ()
 get the DAMPING
float getStiffeness ()
 get the STIFFENESS
float getTimeStep ()
 get the TIME_STEPSIZE
float getGravity ()
 get the GRAVITY
float getCriticalDistance ()
 get the CRITICAL_DISTANCE
float getFriction ()
 get the FRICITION
float getBumpiness ()
 get the BUMPINESS
void setIntegrationMethod (bool isEuler)
 sets Integration method. If isEuler is truth - Euler method, otherwise - Verlet method
MassgetMass (int massNumber)
 returns the mass by its number in a vertex list [in] massNumber the vertex number of the mass, the reference to which should be returned
void makeSpring (Mass *_mass1, Mass *_mass2, ngl::TransformStack *_transform)
 the method creates a spring between two masses [in] _mass1 one of the masses the spring contains [in] _mass2 one of the masses the spring contains [in] _transform transformation stack
void update ()
 the method to update the current state of the cloth
void draw ()
 the method to draw the cloth
void addForce (const ngl::Vector direction)
 the method to add external force acting on the cloth [in] direction the vector of force to be added to the cloth

Public Attributes

ConstraintPointactiveConstraint
 reference to one of the 4 constraints,
std::vector< ngl::Vector > m_vertexList
 list of verteces of the cloth mesh
std::vector< ngl::Face > m_facesList
 list of faces of cloth mesh
std::vector< ngl::Vector > m_normalsList
 list of normals of the cloth mesh
ConstraintPointconstraintPoint1
 the position of constraint point1
ConstraintPointconstraintPoint2
 the position of constraint point2
ConstraintPointconstraintPoint3
 the position of constraint point3
ConstraintPointconstraintPoint4
 the position of constraint point4
bool isWind
 existance of wind
IntegrationMethod m_integrationMethod
 edefines the integration method for a cloth
std::vector< Mass * > masses
 masses list of masses which create cloth
std::vector< Facefaces
 faces list of faces which create cloth
int m_activeConstraintNumber

Protected Attributes

ngl::TransformStack * m_transform
 a pointer to the global transform stack

Detailed Description

class which creates a cloth. It contains all themethods to work with masses and springs, which combined together in a mass-spring system represent a cloth


Member Function Documentation

void Cloth::createCloth ( std::vector< ngl::Vector >  vertexList,
std::vector< ngl::Face >  facesList,
std::vector< ngl::Vector >  normalsList 
)

creates a cloth base on list of vertices, list of faces and list of normals

Parameters:
[in] vertexList list of verteces
[in] facesList list of faces
[in] normalsList list of normals
void Cloth::DrawLine ( ngl::Vector *  points  ) 

draws a line based on set of input points

Parameters:
[in] points used to draw a line through them
void Cloth::moveActiveMass ( ngl::Vector  _displaysment  ) 

changes the position of the active mass in response to the user action

Parameters:
[in] _displaysment defines to which distance the mass should be moved from its current position
void Cloth::setActiveMass ( bool  _isActive,
int  constraintNumber 
)

sets the mass, which user interacts with at the moment

Parameters:
[in] _isActive defines if the mass is active at the moment
[in] constraintNumber contains the number of the constraint point, which will be set to active
void Cloth::setClothSize ( float  _clothSize  )  [inline]

set the size of the cloth

Parameters:
[in] _clothSize size of the cloth
void Cloth::setConstraintPoint1 ( int  massNum,
bool  _activated 
)

set the position of the constraint point1 on cloth

Parameters:
[in] massNum the number of mass in a mesh, which will become a constraint
[in] _activated defines if the mass is active
void Cloth::setConstraintPoint2 ( int  massNum,
bool  _activated 
)

set the position of the constraint point1 on cloth

Parameters:
[in] massNum the number of mass in a mesh, which will become a constraint
[in] _activated defines if the mass is active
void Cloth::setConstraintPoint3 ( int  massNum,
bool  _activated 
)

set the position of the constraint point1 on cloth

Parameters:
[in] massNum the number of mass in a mesh, which will become a constraint
[in] _activated defines if the mass is active
void Cloth::setConstraintPoint4 ( int  massNum,
bool  _activated 
)

set the position of the constraint point1 on cloth

Parameters:
[in] massNum the number of mass in a mesh, which will become a constraint
[in] _activated defines if the mass is active
void Cloth::setMassesNum ( int  _massesNum  )  [inline]

set the number of masses in a line of the cloth

Parameters:
[in] _massesNum number of masses in a line of the cloth

Member Data Documentation

reference to one of the 4 constraints,

with which the user is working at the moment


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables