decConvexVolumeList Class Reference

Convex Volume List. More...

#include <decConvexVolumeList.h>

List of all members.

Public Member Functions

Constructors and Destructors
 decConvexVolumeList ()
 Creates an empty convex volume list.
virtual ~decConvexVolumeList ()
 Cleans up the convex volume list.
Volume Management
int GetVolumeCount () const
 Retrieves the number of volumes.
decConvexVolumeGetVolumeAt (int index) const
 Retrieves the volume at the given index.
bool HasVolume (decConvexVolume *volume) const
 Determines if the given volume exists.
int IndexOfVolume (decConvexVolume *volume) const
 Retrieves the index of the given volume or -1 if not found.
void AddVolume (decConvexVolume *volume)
 Adds a convex volume.
void RemoveVolume (decConvexVolume *volume)
 Removes the given volume.
void RemoveVolumeAt (int index)
 Removes the volume at the given index.
void ExtractVolume (decConvexVolume *volume)
 Extracts the given volume by removing it without deleting it.
void ExtractVolumeAt (int index)
 Extracts the volume at the given index by removing it without deleting it.
void RemoveAllVolumes ()
 Removes all volumes.
Operations
void SetToCube (const decVector &halfSize)
 Removes all volumes and adds a new one set to a cube with the given dimensions.
void Move (const decVector &direction)
 Moves all volumes in the given direction.
void SplitByPlane (const decVector &splitNormal, const decVector &splitPosition, bool deleteBackVolume, decConvexVolumeFace *cutFaceInit)
 Splits the convex volumes using the given split plane.
void SplitByFace (const decConvexVolume &volume, int face)
 Splits the convex volumes using the given convex face.
void SplitByVolume (const decConvexVolume &volume)
 Splits the convex volumes using the given convex volume.
Subclassing
virtual decConvexVolumeCreateVolume (decConvexVolume *volume, bool front)
 Creates a new convex volume.
virtual decConvexVolumeFaceCreateVolumeFace (decConvexVolumeFace *face)
 Creates a new convex volume face that originates from the given face.

Detailed Description

Convex Volume List.

Sometimes it is useful to have a list of convex volumes that describe some object or multiple objects. The Convex Volume List takes on this task storing a list of convex volumes. The Convex Volume List is also able to send split operations down to the stored convex volumes. The newly generated convex volumes are appended to the list. This way a single Convex Volume List can be used to cut an original convex volume into smaller pieces tied together in one handy place.

The Convex Volume List does only provide storing convex volumes and does not use any kind of spatial optimiziation like octrees for example. If you need spatial optimization or if you are using a large number of convex volumes writing your own class is better than using this one which is designed for handling convex volumes in an easy way but not necessary a fast way.

You can use though this class as a temporary storage to split your convex volumes and moving the result afterwards into a better place. The extraction functions allow you to remove convex volumes without deleting them.

Author:
Plüss Roland
Version:
1.0
Date:
2008

Constructor & Destructor Documentation

decConvexVolumeList::decConvexVolumeList (  )

Creates an empty convex volume list.

virtual decConvexVolumeList::~decConvexVolumeList (  ) [virtual]

Cleans up the convex volume list.


Member Function Documentation

void decConvexVolumeList::AddVolume ( decConvexVolume volume )

Adds a convex volume.

virtual decConvexVolume* decConvexVolumeList::CreateVolume ( decConvexVolume volume,
bool  front 
) [virtual]

Creates a new convex volume.

Overwrite this function to create convex volumes of specialized subclasses. If the volume is not NULL it indicates the volume this new volume is based upon. The front flag indicates of the volume to create is in front or back of a clip plane and is only used if a volume has been specified. The default implementation creates a convex volume of type decConvexVolume.

virtual decConvexVolumeFace* decConvexVolumeList::CreateVolumeFace ( decConvexVolumeFace face ) [virtual]

Creates a new convex volume face that originates from the given face.

It is possible that the face is NULL in which case a default face has to be created. NULL faces typically occure if a split is done using a split plane instead of a split volume. Overwrite this function to create convex volume face of specialized subclasses. The default implementation creates a convex volume face of type decConvexVolumeFace.

void decConvexVolumeList::ExtractVolume ( decConvexVolume volume )

Extracts the given volume by removing it without deleting it.

void decConvexVolumeList::ExtractVolumeAt ( int  index )

Extracts the volume at the given index by removing it without deleting it.

decConvexVolume* decConvexVolumeList::GetVolumeAt ( int  index ) const

Retrieves the volume at the given index.

int decConvexVolumeList::GetVolumeCount (  ) const [inline]

Retrieves the number of volumes.

bool decConvexVolumeList::HasVolume ( decConvexVolume volume ) const

Determines if the given volume exists.

int decConvexVolumeList::IndexOfVolume ( decConvexVolume volume ) const

Retrieves the index of the given volume or -1 if not found.

void decConvexVolumeList::Move ( const decVector direction )

Moves all volumes in the given direction.

void decConvexVolumeList::RemoveAllVolumes (  )

Removes all volumes.

void decConvexVolumeList::RemoveVolume ( decConvexVolume volume )

Removes the given volume.

void decConvexVolumeList::RemoveVolumeAt ( int  index )

Removes the volume at the given index.

void decConvexVolumeList::SetToCube ( const decVector halfSize )

Removes all volumes and adds a new one set to a cube with the given dimensions.

void decConvexVolumeList::SplitByFace ( const decConvexVolume volume,
int  face 
)

Splits the convex volumes using the given convex face.

All newly created volumes are added to the list. The face has not to be part of the convex volume list.

void decConvexVolumeList::SplitByPlane ( const decVector splitNormal,
const decVector splitPosition,
bool  deleteBackVolume,
decConvexVolumeFace cutFaceInit 
)

Splits the convex volumes using the given split plane.

All newly created volumes are added to the list. The cutFaceInfo is an optional face used only to init the new cut faces and does not have to be part of any volume.

void decConvexVolumeList::SplitByVolume ( const decConvexVolume volume )

Splits the convex volumes using the given convex volume.

All newly created volumes are added to the list. The volume has not to be part of the convex volume list.


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