Vortex Studio SDK Classes Documentation
Vx::VxHeightField Class Reference

Geometry representing a height field given by a regular grid of heights along the local Z axis. More...

#include <Vx/VxHeightField.h>

Inheritance diagram for Vx::VxHeightField:

## Public Member Functions

VxHeightField ()
Default constructor. More...

VxHeightField (int cellCountX, int cellCountY, double cellSizeX, double cellSizeY, double inHeight)
Constructor to build a uniform height field at inHeight.

VxHeightField (int cellCountX, int cellCountY, double cellSizeX, double cellSizeY, double originX, double originY, const VxArray< double > &inHeightArray)
Constructor to build a height field as an array of heights. More...

VxHeightField (const char *bmpFileName, double xOrigin, double yOrigin, double xHeightFieldSize, double yHeightFieldSize, double rMult, double gMult, double bMult, double zOffset)
Constructor to build a height field from a .bmp file. More...

virtual ~VxHeightField ()
Destructor.

void addDeformation (double depth, double frequency)
Adds deformation to the height field. More...

bool build (int cellCountX, int cellCountY, double cellSizeX, double cellSizeY, double inHeight=0.0)
Constructs a uniform height field at inHeight. More...

bool build (int cellCountX, int cellCountY, double cellSizeX, double cellSizeY, double zVal, double angHz)
Constructs a wavy height field using the following formula to compute the height at vertex (x,y): h(x,y) = zVal * sin(angHz * y) * cos(angHz *x) More...

void build (int cellCountX, int cellCountY, double cellSizeX, double cellSizeY, double originX, double originY, const VxArray< double > &inHeightArray)
Creates a height field as an array of heights. More...

virtual bool build () override
Overloaded build() method from base class. More...

virtual VxHeightFieldclone () const
Clones the geometry. More...

void computeCellCoord (int inIndex, int *outX, int *outY) const
Computes cell coordinates (outX, outY) for cell with index inIndex. More...

int computeCellIndex (int x, int y) const
Computes the cell index for the specified cell coordinates (see computeCellCoord()).

void computeTriangleIndices (int inCellIndex, int *outTriIndex1, int *outTriIndex2) const
Computes the indices of the two triangles in the cell with index matching the inCellIndex value. More...

void computeVertexCoord (int inIndex, int *outX, int *outY) const
Computes vertex coordinates (outX, outY) for a vertex with index matching inIndex. More...

int computeVertexIndex (int x, int y) const
Computes the vertex index for the specified vertex coordinates (see computeVertexCoord()).

void computeVerticesNormal ()
Computes the normals at the height field vertices. More...

double getBoundingBoxExtension () const
Returns bounding box extension.

double getBoundingBoxExtensionDepth () const
Gets extension in -z direction of the height field's bounding box. More...

void getCellCount (int *cx, int *cy) const
Returns the grid count as specified in VxHeightField::build .

bool getCellDisabled (int x, int y) const
Returns true if a cell with the coordinates (x,y) is enabled. More...

void getCellSize (double *sx, double *sy) const
Returns the grid size as specified in VxHeightField::build .

virtual const char * getClassName () const
Returns the class name.

bool getDeformable () const
Returns true if the height field is deformable; false otherwise.

double getElevation (VxReal3 pos, VxReal3 outNormal, double maxHeight=VX_INFINITY) const
Returns the height field elevation at position pos. More...

double getElevation (double inX, double inY, VxReal3 outNormal, double maxHeight=VX_INFINITY) const
Returns the height field elevation at position inX and inY. More...

bool getFlattenHeightFieldLimits () const
Returns true if triangles on the height field limit assume a neighbor triangle with the same normal.

double & getHeightAt (int x, int y)
Gives read/write access to the height value at position (x,y) of the grid. More...

double getHeightAt (int x, int y) const
Gives read/write access to the height value at position (x,y) of the grid. More...

bool getHeightAtPosition (const double &x, const double &y, double &h)
Gives read/write access to the height value h at local position (x,y). More...

const VxArray< double > & getHeights () const
Returns the height array which can then be used to modify the values in the height field. More...

VxArray< double > & getHeights ()
Returns the height array which can then be used to modify the values in the height field. More...

bool getIndicesOfInterest (const VxReal3 bbmin, const VxReal3 bbmax, int *xmin, int *xmax, int *ymin, int *ymax) const
Computes the indices of interest for the input bounding box. More...

bool getInterpolatedHeightAtPosition (const double &x, const double &y, double &h) const
Computes the height at local position (x,y) on the height field using bi-linear interpolation. More...

void getMinMaxElevation (double *minHeight, double *maxHeight) const
Returns the height field minimum and maximum height.

bool getMinMaxElevation (const VxReal3 bbmin, const VxReal3 bbmax, double *outMinHeight, double *outMaxHeight) const
Computes the minimum and maximum heights in the xy-projection of the local axis-aligned bounding box specified by bbmin and bbmax. More...

void getOrigin (double *outXOrigin, double *outYOrigin) const
Returns the origin position for the height field.

bool getSurfaceNormal (int triIndex, const VxReal3 &p, VxReal3 &n) const
Computes and returns in ioNormal the interpolated normal of triangle with index matching triIndex at position iPoint. More...

double getSurfaceThickness () const
Returns the thickness of the height field surface.

Returns true if the adjacent triangle information is maintained.

bool getUseExtendedBoundingBox () const
Returns whether the height field's bounding box is extended. More...

VxMath::Vector3 getVertexPosition (int i, int j) const
Returns the vertex position at indices i and j.

void getVertexPosition (int i, int j, VxReal3 p) const
Returns the vertex position at indices i and j.

void getVerticesCount (int *cx, int *cy) const
Returns the number of vertices in each direction.

bool getVerticesNormal (int triIndex, VxReal3 n0, VxReal3 n1, VxReal3 n2) const
Returns the normals of the vertices on the triangle with index matching triIndex.

void getVerticesPosition (int triIndex, VxReal3 p0, VxReal3 p1, VxReal3 p2) const
Returns the vertex positions for the triangle with index matching triIndex.

void setAllCellsDisabled (bool disabled)
Enables/disables all cells. More...

void setBoundingBoxExtension (double boundingBoxExtension)
Specifies bounding box extension on the top side of the height field.

void setBoundingBoxExtensionDepth (double depth)
Sets extension in -z direction of the height field's bounding box. More...

void setCellDisabled (int x, int y, bool disabled)
Enables/disables a cell with coordinates (x,y). More...

void setDeformable (bool inDeformable)
Sets whether or not the height field is deformable.

void setFlattenHeightFieldLimits (bool b)
If true, the triangles on the height field limit assume a neighbor triangle with identical normal. More...

void setHeights (const VxArray< double > &newHeights)
Overrides the current heights array with the new one (both arrays must be same size). More...

void setOrigin (double inXOrigin, double inYOrigin)
Sets the minimum X and Y values for the height field. More...

void setSurfaceThickness (double inSurfaceThickness)
Specifies the thickness of the height field surface. More...

Determines whether to update adjacent triangles. More...

void setUseExtendedBoundingBox (bool b)
If set to true, the height field's bounding box is extended in -z direction to increase the chance of catching objects falling through it. More...

void setVerticesNormal (VxReal3 *normals, bool copy)
Sets the normals of the height field vertices, independently per triangle. More...

void update ()
When changing the height field, call this method before the next simulation step so that any changes made can take effect. More...

Public Member Functions inherited from Vx::VxGeometry
VXCORE_SYMBOL VxGeometry ()
Default constructor.

virtual VXCORE_SYMBOL ~VxGeometry ()
Destructor.

Adds the collision geometry as owner .

virtual VXCORE_SYMBOL void computeSmallestEnclosing (const VxArray< VxVector3 > &points, VxTransform *inOutTM, VxGeometry::eSmallestEnclosingLockedAxes lockedAxes=VxGeometry::kNoAxis, bool isPositionLocked=false)
Resizes the geometry and computes the new global position and orientation (inOutTm), such that the given set of points is covered while minimizing the volume. More...

virtual VXCORE_SYMBOL void computeSmallestEnclosing (const VxVector3 *inPoints, size_t numPoints, VxTransform *inOutTM, VxGeometry::eSmallestEnclosingLockedAxes lockedAxes=VxGeometry::kNoAxis, bool isPositionLocked=false)
Resizes the geometry and computes the new global position and orientation (inOutTm), such that the given set of points is covered while minimizing the volume. More...

VXCORE_SYMBOL const
MaterialPointerArray
createMaterialMap (int size, VxMaterial *iDefaultMaterial)
Creates a new material map of the specified size and with the specified default material. More...

VXCORE_SYMBOL void getBoundingBox (const VxReal44 tm, VxReal3 minCorner, VxReal3 maxCorner) const
Gets the axis aligned bounding box for the geometry in a specified coordinate system. More...

VXCORE_SYMBOL void getBoundingSphere (VxReal3 center, double *radius) const
Gets the bounding sphere of the geometry in local space. More...

Returns the bounding sphere radius in local coordinates.

VXCORE_SYMBOL const VxVector3getCOM ()
Gets the center of mass from this geometry's mass properties . More...

VXCORE_SYMBOL void getExtremePoint (const VxReal44 tm, const VxReal3 inDir, VxReal3 outPoint) const
Returns the extreme point in the specified direction on the geometry. More...

const MaterialPointerArraygetMaterialMap () const
Returns the material map Only use getMaterialMap() to inspect the materials used in the VxGeometry. More...

VXCORE_SYMBOL const VxArray
< VxCollisionGeometry * > &
getOwners () const
Returns a list of the VxCollisionGeometry objects that own this geometry. More...

VincGeometry * getVincGeometry () const

VXCORE_SYMBOL double getVolume ()
Gets the volume from this geometry's mass properties . More...

VXCORE_SYMBOL bool hasOwner (Vx::VxCollisionGeometry *owner) const
Returns true if the specified collision geometry owns this geometry.

virtual VXCORE_SYMBOL bool isBuilt () const
Returns true if geometry was successfully built.

VXCORE_SYMBOL bool isHole () const
Returns true if the geometry type is one of the following: More...

VXCORE_SYMBOL void removeOwner (Vx::VxCollisionGeometry *owner)
Removes the collision geometry as owner .

virtual VXCORE_SYMBOL void setDimensions (const Vx::VxVector3 &)
Sets the size dimensions for the geometry. More...

VXCORE_SYMBOL bool setMaterial (int index, VxMaterial *material)
Assigns a material to the geometry feature with the given index. More...

VXCORE_SYMBOL void updateOwners ()

Public Member Functions inherited from Vx::VxBaseUserData
VXCORE_SYMBOL VxBaseUserData ()
Default constructor.

virtual VXCORE_SYMBOL ~VxBaseUserData ()
Destructor.

void * getUserDataPtr () const
Get pointer to generic user data.

void setUserDataPtr (void *dataPtr)
Set pointer to generic user data. More...

VXCORE_SYMBOL const
VxUserDataContainer
userData () const
Accessor for user data (const version)

VXCORE_SYMBOL VxUserDataContaineruserData ()
Accessor for user data.

Public Member Functions inherited from Vx::VxBase
void addSubscriber (Event event, Subscriber *subscriber)

unsigned int getCreationIndex () const
Access the creation index of the instance.

const char * getName () const
Retrieves the name. More...

bool hasName () const

bool isSubscribed (Event event, Subscriber *subscriber) const

bool isSubscribed (Subscriber *subscriber) const

void removeSubscriber (Event event, Subscriber *subscriber)

void removeSubscriber (Subscriber *subscriber)

void setCombinedName (const char *base, const char *name, size_t i=0)
Utility to set the name to a concatenate string = base_name_i.

virtual void setName (const char *name)
Sets the name.

Public Member Functions inherited from Vx::VxRefCount
VxRefCount (const VxRefCount &other)

VxRefCountoperator= (const VxRefCount &rhs)=delete
Assignment operator must not be used.

VxRefCountoperator= (VxRefCount &&)=delete

void ref () const
Increment the reference count by one, indicating that this object has another pointer which is referencing it.

int referenceCount () const
Return the number pointers currently referencing this object.

void unref () const
Decrement the reference count by one, indicating that a pointer to this object is no longer referencing it. More...

void unref_nodelete () const
Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...

## Static Public Member Functions

static void setDefaultPrimitiveBufferSize (int size)
Increases the default buffer size used for detecting collision between primitives (box, sphere, cylinder and capsule) and height field. More...

Static Public Member Functions inherited from Vx::VxGeometry
static VXCORE_SYMBOL int getDefaultRequestID (const VxGeometry *g)
Returns the default request id for the given geometry. More...

## Protected Member Functions

void _createCellsDisabledArray ()

void _createHeightFieldQueryInterface ()

CxRGHeightField_ * _heightPatchQueryFn (const VxMath::Vector3 &bbmin, const VxMath::Vector3 &bbmax)

void _updateBoundingBox ()

Protected Member Functions inherited from Vx::VxGeometry
void _computeMassProperties ()

void _dirtyMassProperties ()

void _registerAllMaterials (VxUniverse *universe)

void _unregisterAllMaterials (VxUniverse *universe)

virtual VXCORE_SYMBOL void printContent (std::ostream &os) const

## Protected Attributes

int mCellCountX

int mCellCountY

bool * mCellsDisabledArray

double mCellSizeX

double mCellSizeY

bool mDeformable

VxArray< double > mHeights

CxRGHeightField_ * mInternalHeightField

int mNumVertices

VincHeightFieldQueryInterface * mQueryInterface

int mVertexCountX

int mVertexCountY

VxReal3mVerticesNormal

double mXOrigin

double mYOrigin

Protected Attributes inherited from Vx::VxGeometry
VxVector3 mCOM

bool mMassPropertiesComputed

MaterialPointerArray mMaterialMap

VxArray< VxCollisionGeometry * > mOwners

VincGeometry * mVincGeometryID

double mVolume

Public Types inherited from Vx::VxGeometry
enum  eSmallestEnclosingLockedAxes {
kNoAxis = -1, kXAxis, kYAxis, kZAxis,
kAllAxes
}
Enum for specifying locked axes. More...

Static Protected Member Functions inherited from Vx::VxBase
static void resetVxBaseCounter ()

## Detailed Description

Geometry representing a height field given by a regular grid of heights along the local Z axis.

The height field is centered in the xy plane.

## Constructor & Destructor Documentation

 Vx::VxHeightField::VxHeightField ( )

Default constructor.

This height field is not built, so calling getHeights() returns an invalid pointer. See VxHeightField::build

 Vx::VxHeightField::VxHeightField ( int cellCountX, int cellCountY, double cellSizeX, double cellSizeY, double originX, double originY, const VxArray< double > & inHeightArray )

Constructor to build a height field as an array of heights.

The array must have (cellCountX+1)*(cellCountY+1) elements.

 Vx::VxHeightField::VxHeightField ( const char * bmpFileName, double xOrigin, double yOrigin, double xHeightFieldSize, double yHeightFieldSize, double rMult, double gMult, double bMult, double zOffset )

Constructor to build a height field from a .bmp file.

Parameters
 [in] bmpFileName Location of file to use. [in] xOrigin The x coordinate of the left bottom corner of the height field. [in] yOrigin The y coordinate of the left bottom corner of the height field. [in] xHeightFieldSize Size of the height field in X. [in] yHeightFieldSize Size of the height field in Y. [in] rMult Multiplier of the red component of the image, being between 0 and 1. [in] gMult Multiplier of the green component of the image, being between 0 and 1. [in] bMult Multiplier of the blue component of the image, being between 0 and 1. [in] zOffset Offset height added to each height. Memory for the height matrix is allocated in this function.

See Vx::CreateHeightMatrixFromBmp for more details.

## Member Function Documentation

 void Vx::VxHeightField::addDeformation ( double depth, double frequency )

Adds deformation to the height field.

For a square height field, the number of cycles over the field are given by N = angHz * size / VX_PI, where size is xGrid*MaxX. This doesn't affect the normals previously set with setVerticesNormal().

Parameters
 [in] depth The amplitude [in] frequency The frequency.
 bool Vx::VxHeightField::build ( int cellCountX, int cellCountY, double cellSizeX, double cellSizeY, double inHeight = 0.0 )

Constructs a uniform height field at inHeight.

From now on, a call to getHeights() returns valid data.

Note
This sets the origin to the center of the grid.
Parameters
 [in] cellCountX The number of cells along x [in] cellCountY The number of cells along y [in] cellSizeX The cell size along x [in] cellSizeY The cell size along y [in] inHeight The height of the height field (defaults to 0).
 bool Vx::VxHeightField::build ( int cellCountX, int cellCountY, double cellSizeX, double cellSizeY, double zVal, double angHz )

Constructs a wavy height field using the following formula to compute the height at vertex (x,y): h(x,y) = zVal * sin(angHz * y) * cos(angHz *x)

Parameters
 [in] cellCountX The number of cells along x [in] cellCountY The number of cells along y [in] cellSizeX The cell size along x [in] cellSizeY The cell size along y [in] zVal The maximum wave height [in] angHz Specifies the wave length according to the above formula
 void Vx::VxHeightField::build ( int cellCountX, int cellCountY, double cellSizeX, double cellSizeY, double originX, double originY, const VxArray< double > & inHeightArray )

Creates a height field as an array of heights.

The height array must have (cellCountX+1)*(cellCountY+1) elements.

Parameters
 [in] cellCountX The number of cells along x [in] cellCountY The number of cells along y [in] cellSizeX The cell size along x [in] cellSizeY The cell size along y [in] originX The x coordinate of the left bottom corner of the height field. [in] originY The y coordinate of the left bottom corner of the height field. [in] inHeightArray The array of height values. The i'th element corresponds to the height of vertex with index i .
 virtual bool Vx::VxHeightField::build ( )
inlineoverridevirtual

Overloaded build() method from base class.

Do not use.

Reimplemented from Vx::VxGeometry.

 virtual VxHeightField* Vx::VxHeightField::clone ( ) const
virtual

Clones the geometry.

Reimplemented in each sub-class.

Implements Vx::VxGeometry.

 void Vx::VxHeightField::computeCellCoord ( int inIndex, int * outX, int * outY ) const
inline

Computes cell coordinates (outX, outY) for cell with index inIndex.

Note
The cell is formed by the vertices (outX, outY), (outX+1, outY), (outX+1, outY+1) and (outX, outY+1).
VxHeightField::computeCellIndex
 void Vx::VxHeightField::computeTriangleIndices ( int inCellIndex, int * outTriIndex1, int * outTriIndex2 ) const
inline

Computes the indices of the two triangles in the cell with index matching the inCellIndex value.

Note
If the specified cell has coordinates (x,y) and so is formed by the vertices (x,y), (x+1,y), (x+1,y+1) and (x,y+1), the triangle with index matching outTriIndex1 is formed by the vertices (x,y), (x+1,y), (x,y+1) in that order. Likewise, the triangle with index outTriIndex2 is formed by the vertices (x+1,y), (x+1,y+1), (x,y+1) in that order.
Furthermore, we have outTriIndex2 = outTriIndex1 + 1.
The triangle indices can be used in the material map of this geometry to assign materials to individual triangles (see VxGeometry::setMaterial ).
VxHeightField::computeCellIndex
VxHeightField::computeCellCoord
 void Vx::VxHeightField::computeVertexCoord ( int inIndex, int * outX, int * outY ) const
inline

Computes vertex coordinates (outX, outY) for a vertex with index matching inIndex.

VxHeightField::computeVertexIndex
 void Vx::VxHeightField::computeVerticesNormal ( )

Computes the normals at the height field vertices.

This is an alternative to setVerticesNormal. The method needs to be called again if the heights are modified.

 double Vx::VxHeightField::getBoundingBoxExtensionDepth ( ) const

Gets extension in -z direction of the height field's bounding box.

setBoundingBoxExtensionDEpth
setUseExtendedBoundingBox
 bool Vx::VxHeightField::getCellDisabled ( int x, int y ) const
inline

Returns true if a cell with the coordinates (x,y) is enabled.

Note
All cells are enabled by default.
VxHeightField::setCellDisabled
 double Vx::VxHeightField::getElevation ( VxReal3 pos, VxReal3 outNormal, double maxHeight = VX_INFINITY ) const

Returns the height field elevation at position pos.

If maxHeight is below the terrain there is no hit and infinity is returned.

 double Vx::VxHeightField::getElevation ( double inX, double inY, VxReal3 outNormal, double maxHeight = VX_INFINITY ) const

Returns the height field elevation at position inX and inY.

If maxHeight is below terrain there is no hit and infinity is returned.

 double& Vx::VxHeightField::getHeightAt ( int x, int y )
inline

Gives read/write access to the height value at position (x,y) of the grid.

Parameters
 [in] x Must be in the range [0,gridCountX] [in] y Must be in the range [0,gridCountY].
update()
 double Vx::VxHeightField::getHeightAt ( int x, int y ) const
inline

Gives read/write access to the height value at position (x,y) of the grid.

Parameters
 [in] x Must be in the range [0,gridCountX] [in] y Must be in the range [0,gridCountY].
 bool Vx::VxHeightField::getHeightAtPosition ( const double & x, const double & y, double & h )
inline

Gives read/write access to the height value h at local position (x,y).

Returns
true if and only if the position (x,y) is in the bounds of the height field.
Note
If the function returns false, the method gives access to the first element of the height field (at origin position (0,0) in grid coordinates).
 const VxArray& Vx::VxHeightField::getHeights ( ) const
inline

Returns the height array which can then be used to modify the values in the height field.

The height at coordinate x,y is getHeights()[x+gridCountX*y].

update()
 VxArray& Vx::VxHeightField::getHeights ( )
inline

Returns the height array which can then be used to modify the values in the height field.

The height at coordinate x,y is getHeights()[x+gridCountX*y].

update()
 bool Vx::VxHeightField::getIndicesOfInterest ( const VxReal3 bbmin, const VxReal3 bbmax, int * xmin, int * xmax, int * ymin, int * ymax ) const

Computes the indices of interest for the input bounding box.

Returns
false if the bounding box is off-terrain
 bool Vx::VxHeightField::getInterpolatedHeightAtPosition ( const double & x, const double & y, double & h ) const

Computes the height at local position (x,y) on the height field using bi-linear interpolation.

Returns
true if and only if the position (x,y) is in the bounds of the height field.
 bool Vx::VxHeightField::getMinMaxElevation ( const VxReal3 bbmin, const VxReal3 bbmax, double * outMinHeight, double * outMaxHeight ) const

Computes the minimum and maximum heights in the xy-projection of the local axis-aligned bounding box specified by bbmin and bbmax.

Parameters
 [in] bbmin bounding box corner with minimum coordinates [in] bbmax bounding box corner with maximum coordinates [out] outMinHeight Computed minimum height in the specified bounds [out] outMaxHeight Computed maximum height in the specified bounds
Returns
true if xy-projection of given bounding box overlaps with the heightfield's xy-projection.
 bool Vx::VxHeightField::getSurfaceNormal ( int triIndex, const VxReal3 & p, VxReal3 & n ) const

Computes and returns in ioNormal the interpolated normal of triangle with index matching triIndex at position iPoint.

iPoint and ioNormal are in the local reference frame of this geometry. Point iPoint must be located on the triangle or on its edges. There is no check for that.

This function requires the vertex normals to be computed (see setVerticesNormal()).

Returns
false if vertex normals were not computed or if the specified triangle is degenerated.
true otherwise.
 bool Vx::VxHeightField::getUseExtendedBoundingBox ( ) const

Returns whether the height field's bounding box is extended.

setUseExtendedBoundingBox
 void Vx::VxHeightField::setAllCellsDisabled ( bool disabled )
inline

Enables/disables all cells.

If a cell is disabled no collisions will occur with it.

Note
All cells are enabled by default.
 void Vx::VxHeightField::setBoundingBoxExtensionDepth ( double depth )

Sets extension in -z direction of the height field's bounding box.

Takes effect only if extended bounding box is used.

Default is maximum of height field half lengths in x and y.

 void Vx::VxHeightField::setCellDisabled ( int x, int y, bool disabled )
inline

Enables/disables a cell with coordinates (x,y).

If a cell is disabled no collisions will occur with it.

Note
All cells are enabled by default. Cells with coordinates (i,j) are formed by vertices with coordinates (i,j), (i+1,j), (i,j+1) and (i+1,j+1).
 static void Vx::VxHeightField::setDefaultPrimitiveBufferSize ( int size )
static

Increases the default buffer size used for detecting collision between primitives (box, sphere, cylinder and capsule) and height field.

Note
If the buffer becomes too large, it is better to increase the height field cell size rather than increasing the buffer size.
 void Vx::VxHeightField::setFlattenHeightFieldLimits ( bool b )

If true, the triangles on the height field limit assume a neighbor triangle with identical normal.

This will avoid creation of edge contacts with the triangle edges on the boundary of the height field.

Use this option for tiling height fields side by side.

 void Vx::VxHeightField::setHeights ( const VxArray< double > & newHeights )

Overrides the current heights array with the new one (both arrays must be same size).

Note
Call update() after calling this method to update related internal data.
 void Vx::VxHeightField::setOrigin ( double inXOrigin, double inYOrigin )

Sets the minimum X and Y values for the height field.

Note
You don't need to call update().
 void Vx::VxHeightField::setSurfaceThickness ( double inSurfaceThickness )

Specifies the thickness of the height field surface.

If set to a value >=0 this feature is enabled and setUseExtendedBoundingBox() is set to false automatically, thereby causing collision for objects only if they overlap the height field surface.

If set to a value <0 this feature is disabled and setUseExtendedBoundingBox() is set to true automatically, thereby causing collision for objects underneath the height field.

 void Vx::VxHeightField::setUpdateAdjacentTriangles ( bool b )

Determines whether to update adjacent triangles.

This is useful for height fields that are not smooth, as it can improve collision response accuracy.

Note
Default is disabled.
 void Vx::VxHeightField::setUseExtendedBoundingBox ( bool b )

If set to true, the height field's bounding box is extended in -z direction to increase the chance of catching objects falling through it.

Set this to false if objects are allowed to travel underneath the geometry. Default is true.

setBoundingBoxExtensionDepth
setSurfaceThickness
 void Vx::VxHeightField::setVerticesNormal ( VxReal3 * normals, bool copy )

Sets the normals of the height field vertices, independently per triangle.

The array normals must contain three times "number of triangles" elements and must specify the vertex normals in the following form: triangle0_vertex0_normal, triangle0_vertex1_normal, triangle0_vertex2_normal, triangle1_vertex0_normal, ...

Note
Each heightfield cell contains two triangles. Therefore the number of triangles is cellCountX*cellCountY*2, and consequently the number of normals in the specified normals array must be 3*(cellCountX*cellCountY*2).

If copy is true, the height field will not take ownership of the array and instead make its own copy. Otherwise, it will take ownership of the normals array.