Voxelyze
|
Defines a specific instance of a voxel and holds its current state. More...
#include <VX_Voxel.h>
Public Types | |
enum | linkDirection { X_POS = 0, X_NEG = 1, Y_POS = 2, Y_NEG = 3, Z_POS = 4, Z_NEG = 5 } |
Defines the direction of a link relative to a given voxel. More... | |
enum | voxelCorner { NNN = 0, NNP = 1, NPN = 2, NPP = 3, PNN = 4, PNP = 5, PPN = 6, PPP = 7 } |
Defines each of 8 corners of a voxel. | |
Public Member Functions | |
CVX_Voxel (CVX_MaterialVoxel *material, short indexX, short indexY, short indexZ) | |
Default constuctor. | |
~CVX_Voxel () | |
Destructor. | |
void | reset () |
Resets this voxels to its original position, orientation, temperature, etc. and zeros its momentum. Does not affect any externals. | |
CVX_Link * | link (linkDirection direction) const |
Returns a pointer to the link object in the specified direction if it exists. Returns null if a link does not exist in this direction. | |
int | linkCount () const |
Returns the number of links present for this voxel out of a total 6 possible. | |
CVX_Voxel * | adjacentVoxel (linkDirection direction) const |
Returns a pointer to the voxel in the specified direction if one exists, or NULL otherwise. | |
short | indexX () |
Returns the global X index of this voxel. | |
short | indexY () |
Returns the global Y index of this voxel. | |
short | indexZ () |
Returns the global Z index of this voxel. | |
CVX_MaterialVoxel * | material () |
Returns the linked material object containing the physical properties of this voxel. | |
bool | externalExists () |
Returns true if this voxel has had its CVX_External object created. This does not mecessarily imply that this external object actually contains any fixes or forces. | |
CVX_External * | external () |
Returns a pointer to this voxel's unique external object that contains fixes, forces, and/or displacements. Allocates a new empty one if it doesn't already exist. Use externalExists() to determine if external() has been previously called at any time. | |
void | timeStep (float dt) |
Advances this voxel's state according to all forces and moments acting on it. Large timesteps will cause instability. Use CVoxelyze::recommendedTimeStep() to get the recommended largest stable timestep. | |
Vec3D< double > | position () const |
Returns the center position of this voxel in meters (GCS). This is the origin of the local coordinate system (LCS). | |
Vec3D< double > | originalPosition () const |
Returns the initial (nominal) position of this voxel. | |
Vec3D< double > | displacement () const |
Returns the 3D displacement of this voxel from its original location in meters (GCS)/. | |
Vec3D< float > | size () const |
Returns the current deformed size of this voxel in the local voxel coordinates system (LCS). If asymmetric forces are acting on this voxel, the voxel may not be centered on position(). Use cornerNegative() and cornerPositive() to determine this information. | |
Vec3D< float > | cornerPosition (voxelCorner corner) const |
Returns the deformed location of the voxel corner in the specified corner in the global coordinate system (GCS). Essentially cornerOffset() with the voxel's current global position/rotation applied. | |
Vec3D< float > | cornerOffset (voxelCorner corner) const |
Returns the deformed location of the voxel corner in the specified corner in the local voxel coordinate system (LCS). Used to draw the deformed voxel in the correct position relative to the position(). | |
bool | isInterior () const |
Returns true if the voxel is surrounded by other voxels on its 6 coordinate faces. Returns false if 1 or more faces are exposed. | |
bool | isSurface () const |
Convenience function to enhance code readibility. The inverse of isInterior(). Returns true 1 or more faces are exposed. Returns false if the voxel is surrounded by other voxels on its 6 coordinate faces. | |
Vec3D< double > | baseSize () const |
Returns the nominal size of this voxel (LCS) accounting for any specified temperature and external actuation. Specifically, returns the zero-stress size of the voxel if all forces/moments were removed. | |
double | baseSize (CVX_Link::linkAxis axis) const |
Returns the nominal size of this voxel in the specified axis accounting for any specified temperature and external actuation. Specifically, returns the zero-stress dimension of the voxel if all forces/moments were removed. | |
double | baseSizeAverage () const |
Returns the average nominal size of the voxel in a zero-stress (no force) state. (X+Y+Z/3) | |
Quat3D< double > | orientation () const |
Returns the orientation of this voxel in quaternion form (GCS). This orientation defines the relative orientation of the local coordinate system (LCS). The unit quaternion represents the original orientation of this voxel. | |
float | orientationAngle () const |
Use with orientationAxis() to get the orientation of this voxel in angle/axis form. Returns the angle in radians. | |
Vec3D< double > | orientationAxis () const |
Use with orientationAngle() to get the orientation of this voxel in angle/axis form. Returns a unit vector in the global coordinate system (GCS). | |
float | displacementMagnitude () const |
Returns the distance (magnitude of displacement) this voxel has moved from its initial nominal position. (GCS) | |
float | angularDisplacementMagnitude () const |
Returns the angle (magnitude of angular displacement) this voxel has rotated from its initial nominal orientation. (GCS) | |
Vec3D< double > | velocity () const |
Returns the 3D velocity of this voxel in m/s (GCS) | |
float | velocityMagnitude () const |
Returns the velocity of this voxel in m/s. | |
Vec3D< double > | angularVelocity () const |
Returns the 3D angular velocity of this voxel in rad/s (GCS) | |
float | angularVelocityMagnitude () const |
Returns the angular velocity of this voxel in rad/s. | |
float | kineticEnergy () const |
Returms the kinetic energy of this voxel in Joules. | |
float | volumetricStrain () const |
Returns the volumetric strain of the voxel according to the definition at http://www.colorado.edu/engineering/CAS/courses.d/Structures.d/IAST.Lect05.d/IAST.Lect05.pdf. | |
float | pressure () const |
Returns the engineering internal "pressure" in Pa according to the definition at http://www.colorado.edu/engineering/CAS/courses.d/Structures.d/IAST.Lect05.d/IAST.Lect05.pdf. | |
bool | isYielded () const |
Returns true if the stress in this voxel has ever exceeded the yield stress. Technically, this returns true if any of the connected links have yielded since the stress state of the voxel is never expressly calculated. | |
bool | isFailed () const |
Returns true if the stress in this voxel has ever exceeded the failure stress. Technically, this returns true if any of the connected links have failed since the stress state of the voxel is never expressly calculated. | |
float | temperature () |
Returns the current temperature of this voxel in degrees Celsius. | |
void | setTemperature (float temperature) |
Specifies the temperature for this voxel. This adds (or subtracts) the correct amount of thermal energy to leave the voxel at ths specified temperature, but this temperature will not be maintaned without subsequent determines the amount of scaling from the temperature. | |
Vec3D< float > | externalForce () |
Returns the current external force applied to this voxel in newtons. If the voxel is not fixed this will return any applied external forces. If fixed it will return the current reaction force necessary to enforce the zero-motion constraint. | |
Vec3D< float > | externalMoment () |
Returns the current external moment applied to this voxel in N-m. If the voxel is not fixed this will return any applied external moments. If fixed it will return the current reaction moment necessary to enforce the zero-motion constraint. | |
void | haltMotion () |
Halts all momentum of this block. Unless fixed the voxel will continue to move in subsequent timesteps. | |
void | enableFloor (bool enabled) |
Enables this voxel interacting with the floor at Z=0. | |
bool | isFloorEnabled () const |
Returns true of this voxel will interact with the floor at Z=0. | |
bool | isFloorStaticFriction () const |
Returns true if this voxel is in contact with the floor and stationary in the horizontal directions. This corresponds to that voxel being in the mode of static friction (as opposed to kinetic) with the floor. | |
float | floorPenetration () const |
Returns the interference (in meters) between the collision envelope of this voxel and the floor at Z=0. Positive numbers correspond to interference. If the voxel is not touching the floor 0 is returned. | |
Vec3D< double > | force () |
Calculates and returns the sum of the current forces on this voxel. This would normally only be called internally, but can be used to query the state of a voxel for visualization or debugging. | |
Vec3D< double > | moment () |
Calculates and returns the sum of the current moments on this voxel. This would normally only be called internally, but can be used to query the state of a voxel for visualization or debugging. | |
float | transverseArea (CVX_Link::linkAxis axis) |
Returns the transverse area of this voxel with respect to the specified axis. This would normally be called only internally, but can be used to calculate the correct relationship between force and stress for this voxel if Poisson's ratio is non-zero. | |
float | transverseStrainSum (CVX_Link::linkAxis axis) |
Returns the sum of the current strain of this voxel in the two mutually perpindicular axes to the specified axis. This would normally be called only internally, but can be used to correctly calculate stress for this voxel if Poisson's ratio is non-zero. | |
float | dampingMultiplier () |
Returns the damping multiplier for this voxel. This would normally be called only internally for the internal damping calculations. | |
Static Public Member Functions | |
static CVX_Link::linkAxis | toAxis (linkDirection direction) |
Returns the link axis of the specified link direction. | |
static linkDirection | toDirection (CVX_Link::linkAxis axis, bool positiveDirection) |
Returns the link direction of the specified link axis and sign. | |
static bool | isNegative (linkDirection direction) |
Returns true if the specified link direction is negative. | |
static bool | isPositive (linkDirection direction) |
Returns true if the specified link direction is positive. | |
static linkDirection | toOpposite (linkDirection direction) |
Returns the opposite (negated) link direction of the specified direction. | |
Friends | |
class | CVoxelyze |
class | CVXS_SimGLView |
class | CVX_LinearSolver |
Defines a specific instance of a voxel and holds its current state.
The voxel class contains all information about a voxel's physical characteristics, state, and CVX_Link's to other adjacent voxels.
A voxel needs a CVX_MaterialVoxel to be created and define its physical properties. Later, these can be accessed by material().
A voxel can have external forced or prescribed displacements applied by accessing its CVX_External object using the external() function. To save memory allocation the CVX_External object is not created until the first time external() is called. Use externalExists() to determine if this voxel has any externals applied.
The state of the voxel includes it position(), size(), orientation(), velocity(), etc.
A voxel has a local coordinate system (LCS) that always stays centered on the center of the voxel and oriented with the axes of the cube. The global coordinate system (GCS) is just that - the global coordinate system.
CVX_Voxel::CVX_Voxel | ( | CVX_MaterialVoxel * | material, |
short | indexX, | ||
short | indexY, | ||
short | indexZ | ||
) |
Default constuctor.
[in] | material | Links this CVX_Material to define the physical properties for this voxel. |
[in] | indexX | The global X index of this voxel. |
[in] | indexY | The global Y index of this voxel. |
[in] | indexZ | The global Z index of this voxel. |
CVX_Voxel * CVX_Voxel::adjacentVoxel | ( | linkDirection | direction | ) | const |
Returns a pointer to the voxel in the specified direction if one exists, or NULL otherwise.
[in] | direction | Positive or negative X, Y, or Z direction according to the linkDirection enum. |
void CVX_Voxel::enableFloor | ( | bool | enabled | ) | [inline] |
Enables this voxel interacting with the floor at Z=0.
[in] | enabled | Enable interaction |
void CVX_Voxel::timeStep | ( | float | dt | ) |
Advances this voxel's state according to all forces and moments acting on it. Large timesteps will cause instability. Use CVoxelyze::recommendedTimeStep() to get the recommended largest stable timestep.
[in] | dt | Timestep (in second) to advance. |