# Visualization
TKV3d
Voxel

# Voxel_CollisionDetection Class Reference

Detects collisions between shapes.
.

`#include <Voxel_CollisionDetection.hxx>`

## Public Member Functions

void * | operator new (size_t, void *anAddress)
void * | operator new (size_t size)
void | operator delete (void *anAddress)
Standard_EXPORT | Voxel_CollisionDetection ()
| An empty constructor. .
Standard_EXPORT | Voxel_CollisionDetection (const Standard_Real deflection, const Standard_Integer nbx, const Standard_Integer nby, const Standard_Integer nbz)
| A constructor. It defines deflection of triangulation for the shapes. As lower the deflection is, as proper the triangulation is generated. Also, it defines number of splits along X, Y and Z axes for generation of voxels. As greater the numbers are, as greater number of voxels is used for detection of collision. .
Standard_EXPORT Standard_Integer | AddShape (const TopoDS_Shape &shape)
| Adds a shape. Returns an index of the shape. .
Standard_EXPORT Standard_Boolean | ReplaceShape (const Standard_Integer ishape, const TopoDS_Shape &shape)
| Replaces a shape by another one. <ishape> is an index of the shape. This method is useful for moving shape, for example. .
Standard_EXPORT void | SetDeflection (const Standard_Real deflection)
| Defines the deflection of triangulation of shapes. .
Standard_EXPORT void | SetNbVoxels (const Standard_Integer nbx, const Standard_Integer nby, const Standard_Integer nbz)
| Defines the number of voxels along X, Y and Z axes. .
Standard_EXPORT void | SetBoundaryBox (const Bnd_Box &box)
| Defines a user-defined boundary box for generation of voxels. If this method is not called, the algorithm calculates the boundary box itself. .
Standard_EXPORT void | SetUsageOfVolume (const Standard_Boolean usage)
| Defines usage of volume of shapes in collision detection algorithm. Beware, usage of volume a little bit decreases the speed of algorithm. .
Standard_EXPORT void | KeepCollisions (const Standard_Boolean keep)
| Doesn't clean the collision points on new call to the method Compute(). It allows to see the collisions for a moving shape. .
Standard_EXPORT Standard_Boolean | Voxelize (const Standard_Integer ishape=-1)
| Prepares data for computation of collisions. It checks the inner parameters (number of voxels along X, Y and Z axes) and voxelizes the shapes. If the shape is not changed since the last call to this method, this method may be not called for this shape. <ishape> - is the index of the shape for processing by this method. If it is equal to -1, all shapes will be processed. .
Standard_EXPORT Standard_Boolean | Compute ()
| Computes the collisions. This method may be called many times if, for example, the shapes are being moved. .
Standard_EXPORT Standard_Boolean | HasCollisions () const
| Returns true if a collision is detected. .
Standard_EXPORT const Voxel_BoolDS & | GetCollisions () const
| Returns the collided voxels. .
Standard_EXPORT void | Destroy ()
| A destructor. .
| ~Voxel_CollisionDetection ()

## Private Member Functions

Standard_EXPORT void | Clear ()
| An internal method for cleaning the intermediate data. .
Standard_EXPORT Standard_Boolean | CheckVoxels (const Voxel_BoolDS &voxels) const
| An internal method, which checks correspondance of voxels to the parameters defined by user. .

## Private Attributes

TopTools_ListOfShape | myShapes
Standard_Real | myDeflection
Standard_Integer | myNbX
Standard_Integer | myNbY
Standard_Integer | myNbZ
Standard_Boolean | myUsageOfVolume
Standard_Boolean | myKeepCollisions
Standard_Real | myX
Standard_Real | myY
Standard_Real | myZ
Standard_Real | myXLen
Standard_Real | myYLen
Standard_Real | myZLen
Standard_Address | myVoxels
Voxel_BoolDS | myCollisions
Standard_Boolean | myHasCollisions

## Constructor & Destructor Documentation

Standard_EXPORT Voxel_CollisionDetection::Voxel_CollisionDetection | ( |  | ) |

Standard_EXPORT Voxel_CollisionDetection::Voxel_CollisionDetection | ( | const Standard_Real | deflection,
|  | const Standard_Integer | nbx,
|  | const Standard_Integer | nby,
|  | const Standard_Integer | nbz
| ) |

Voxel_CollisionDetection::~Voxel_CollisionDetection | ( |  | ) | `[inline]`

## Member Function Documentation

Standard_EXPORT Standard_Integer Voxel_CollisionDetection::AddShape | ( | const TopoDS_Shape & | shape | ) |

Standard_EXPORT Standard_Boolean Voxel_CollisionDetection::CheckVoxels | ( | const Voxel_BoolDS & | voxels | ) | const`[private]`

Standard_EXPORT void Voxel_CollisionDetection::Clear | ( |  | ) | `[private]`

Standard_EXPORT Standard_Boolean Voxel_CollisionDetection::Compute | ( |  | ) |

Standard_EXPORT void Voxel_CollisionDetection::Destroy | ( |  | ) |

Standard_EXPORT const Voxel_BoolDS& Voxel_CollisionDetection::GetCollisions | ( |  | ) | const

Standard_EXPORT Standard_Boolean Voxel_CollisionDetection::HasCollisions | ( |  | ) | const

Standard_EXPORT void Voxel_CollisionDetection::KeepCollisions | ( | const Standard_Boolean | keep | ) |

void Voxel_CollisionDetection::operator delete | ( | void * | anAddress | ) | `[inline]`

void* Voxel_CollisionDetection::operator new | ( | size_t | size | ) | `[inline]`

void* Voxel_CollisionDetection::operator new | ( | size_t | ,
|  | void * | anAddress
| ) | `[inline]`

Standard_EXPORT Standard_Boolean Voxel_CollisionDetection::ReplaceShape | ( | const Standard_Integer | ishape,
|  | const TopoDS_Shape & | shape
| ) |

Standard_EXPORT void Voxel_CollisionDetection::SetBoundaryBox | ( | const Bnd_Box & | box | ) |

Standard_EXPORT void Voxel_CollisionDetection::SetDeflection | ( | const Standard_Real | deflection | ) |

Standard_EXPORT void Voxel_CollisionDetection::SetNbVoxels | ( | const Standard_Integer | nbx,
|  | const Standard_Integer | nby,
|  | const Standard_Integer | nbz
| ) |

Standard_EXPORT void Voxel_CollisionDetection::SetUsageOfVolume | ( | const Standard_Boolean | usage | ) |

Standard_EXPORT Standard_Boolean Voxel_CollisionDetection::Voxelize | ( | const Standard_Integer | ishape = `-1` | ) |

## Field Documentation

Voxel_BoolDS Voxel_CollisionDetection::myCollisions `[private]`

Standard_Real Voxel_CollisionDetection::myDeflection `[private]`

Standard_Boolean Voxel_CollisionDetection::myHasCollisions `[private]`

Standard_Boolean Voxel_CollisionDetection::myKeepCollisions `[private]`

Standard_Integer Voxel_CollisionDetection::myNbX `[private]`

Standard_Integer Voxel_CollisionDetection::myNbY `[private]`

Standard_Integer Voxel_CollisionDetection::myNbZ `[private]`

TopTools_ListOfShape Voxel_CollisionDetection::myShapes `[private]`

Standard_Boolean Voxel_CollisionDetection::myUsageOfVolume `[private]`

Standard_Address Voxel_CollisionDetection::myVoxels `[private]`

Standard_Real Voxel_CollisionDetection::myX `[private]`

Standard_Real Voxel_CollisionDetection::myXLen `[private]`

Standard_Real Voxel_CollisionDetection::myY `[private]`

Standard_Real Voxel_CollisionDetection::myYLen `[private]`

Standard_Real Voxel_CollisionDetection::myZ `[private]`

Standard_Real Voxel_CollisionDetection::myZLen `[private]`

The documentation for this class was generated from the following file:

- Voxel_CollisionDetection.hxx