Voxelyze
Public Member Functions | Protected Member Functions | Protected Attributes | Friends
CVX_MaterialVoxel Class Reference

Defines a voxel type of a specific material. More...

#include <VX_MaterialVoxel.h>

Inheritance diagram for CVX_MaterialVoxel:
CVX_Material CVX_MaterialLink

List of all members.

Public Member Functions

 CVX_MaterialVoxel (float youngsModulus=1e6f, float density=1e3f, double nominalSize=0.001)
 Default Constructor.
 CVX_MaterialVoxel (rapidjson::Value &mat, double nominalSize=0.001)
 Constructs this CVX_Material object from a rapidjson parser node that contains valid "materials" sub-nodes.
 CVX_MaterialVoxel (const CVX_Material &mat, double nominalSize=0.001)
 Constructs from an existing material.
 CVX_MaterialVoxel (const CVX_MaterialVoxel &vIn)
 Copy constructor.
virtual CVX_MaterialVoxeloperator= (const CVX_MaterialVoxel &vIn)
 Equals operator.
bool setNominalSize (double size)
 Sets the nominal cubic voxel size in order to calculate mass, moments of inertia, etc of this material. In ordinary circumstances this should be controlled by the overall simulation and never called directly. Use setExternalScaleFactor() if you wish to change the size of voxels of this material.
double nominalSize ()
 Returns the nominal cubic voxel size in meters.
Vec3D< double > size ()
 Returns the current nominal size (in meters) of any voxels of this material-including external scaling factors. The size is calculated according to baseSize()*externalScaleFactor(). This represents the nominal size for voxels of this material, and every instantiated voxel may have a different actual size based on the forces acting upon it in context. This value does not include thermal expansions and contractions which may also change the nominal size of a given voxel depending on its CTE and current temperature.
float mass ()
 Returns the mass of a voxel of this material in Kg. Mass cannot be specified directly. Mass is indirectly calculated according to setDensity() and setBaseSize().
float momentInertia ()
 Returns the first moment of inertia of a voxel of this material in kg*m^2. This quantity is indirectly calculated according to setDensity() and setBaseSize().
float internalDampingTranslateC () const
 Returns the internal material damping coefficient (translation).
float internalDampingRotateC () const
 Returns the internal material damping coefficient (rotation).
float globalDampingTranslateC () const
 Returns the global material damping coefficient (translation)
float globalDampingRotateC () const
 Returns the global material damping coefficient (rotation)
float collisionDampingTranslateC () const
 Returns the global material damping coefficient (translation)
float collisionDampingRotateC () const
 Returns the global material damping coefficient (rotation)
float penetrationStiffness () const
 returns the stiffness with which this voxel will resist penetration. This is calculated according to E*A/L with L = voxelSize/2.

Protected Member Functions

void initialize (double nominalSize)
 Initializes this voxel material with the specified voxel size.
void setGravityMultiplier (float gravityMultiplier)
 Sets the multiple of gravity for this material. In normal circumstances this should only be called by the parent voxelyze object.
float gravityMuliplier ()
 Returns the current gravity multiplier.
float gravityForce ()
 Returns the current gravitational force on this voxel according to F=ma.
virtual bool updateAll ()
 Updates and recalculates eveything possible (used by inherited classed when material properties have changed)
virtual bool updateDerived ()
 Updates all the derived quantities cached as member variables for this and derived classes. (Especially if density, size or elastic modulus changes.)

Protected Attributes

double nomSize
 Nominal size (i.e. lattice dimension) (m)
float gravMult
 Multiplier for how strongly gravity should affect this block in g (1.0 = -9.81m/s^2)
float _mass
 Cached mass of this voxel (kg)
float _massInverse
 Cached 1/Mass (1/kg)
float _sqrtMass
 Cached sqrt(mass). (sqrt(Kg))
float _firstMoment
 Cached 1st moment "inertia" (needed for certain calculations) (kg*m)
float _momentInertia
 Cached mass moment of inertia (i.e. rotational "mass") (kg*m^2)
float _momentInertiaInverse
 Cached 1/Inertia (1/(kg*m^2))
float _2xSqMxExS
 Cached value needed for quick damping calculations (Kg*m/s)
float _2xSqIxExSxSxS
 Cached value needed for quick rotational damping calculations (Kg*m^2/s)

Friends

class CVoxelyze
class CVX_Voxel
class CVX_MaterialLink

Detailed Description

Defines a voxel type of a specific material.

The only fundamental addition to CVX_Material is the physical size of the voxel, but this allows precomputing of mass, moments of inertia, and therefore all the dynamic properties of these voxels.


Constructor & Destructor Documentation

CVX_MaterialVoxel::CVX_MaterialVoxel ( float  youngsModulus = 1e6f,
float  density = 1e3f,
double  nominalSize = 0.001 
)

Default Constructor.

Parameters:
[in]youngsModulusThe Young's Modulus (stiffness) of this material in Pascals.
[in]densityThe density of this material in Kg/m^3.
[in]nominalSizeThe nominal voxel size in meters.
CVX_MaterialVoxel::CVX_MaterialVoxel ( rapidjson::Value &  mat,
double  nominalSize = 0.001 
)

Constructs this CVX_Material object from a rapidjson parser node that contains valid "materials" sub-nodes.

Parameters:
[in]matpointer to a rapidjson Value that contains material information. See rapidjson documentation and the *.vxl.json format info in the voxelyze user guide.
[in]nominalSizeThe nominal voxel size in meters.
CVX_MaterialVoxel::CVX_MaterialVoxel ( const CVX_Material mat,
double  nominalSize = 0.001 
)

Constructs from an existing material.

Parameters:
[in]matMaterial to construct from.
[in]nominalSizeThe nominal voxel size in meters

Member Function Documentation

void CVX_MaterialVoxel::initialize ( double  nominalSize) [protected]

Initializes this voxel material with the specified voxel size.

Parameters:
[in]nominalSizeThe nominal voxel size in meters.
void CVX_MaterialVoxel::setGravityMultiplier ( float  gravityMultiplier) [inline, protected]

Sets the multiple of gravity for this material. In normal circumstances this should only be called by the parent voxelyze object.

Parameters:
[in]gravityMultiplierGravity multiplier (1 = 1G gravity).
bool CVX_MaterialVoxel::setNominalSize ( double  size)

Sets the nominal cubic voxel size in order to calculate mass, moments of inertia, etc of this material. In ordinary circumstances this should be controlled by the overall simulation and never called directly. Use setExternalScaleFactor() if you wish to change the size of voxels of this material.

Parameters:
[in]sizeThe size of a voxel as measured by its linear outer dimension. (units: meters)

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