# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NLPACS::UMoveContainer Class Reference

A container for movable objects Some constraints: * The move bounding box must be lower than the cell size. More...

#include <u_move_container.h>

Inheritance diagram for NLPACS::UMoveContainer:

NLPACS::CMoveContainer List of all members.

Public Methods

virtual UMovePrimitiveaddCollisionablePrimitive (uint8 firstWorldImage, uint8 numWorldImage, const UMovePrimitive *copyFrom=NULL)=0
 Add a collisionable primitive in the container. More...

virtual UMovePrimitiveaddNonCollisionablePrimitive (const UMovePrimitive *copyFrom=NULL)=0
 Add a noncollisionable primitive in the container. More...

virtual bool loadCollisionablePrimitiveBlock (const char *filename, uint8 firstWorldImage, uint8 numWorldImage, std::vector< UMovePrimitive * > *primitives, float orientation, const NLMISC::CVector &position, bool dontSnapToGround=false)=0
 Load a PACS primitive block. More...

virtual void addCollisionnablePrimitiveBlock (UPrimitiveBlock *pb, uint8 firstWorldImage, uint8 numWorldImage, std::vector< UMovePrimitive * > *primitives, float orientation, const NLMISC::CVector &position, bool dontSnapToGround=false)=0
 The same as loadCollisionablePrimitiveBlock, but the primitive block is provided by the caller. More...

virtual void removePrimitive (UMovePrimitive *primitive)=0
 Remove a primitive from the container. More...

virtual void getPrimitives (std::vector< const UMovePrimitive * > &dest) const=0
 Get all the primitives in the container. More...

virtual void evalCollision (double deltaTime, uint8 worldImage)=0
 Evaluation of a worldImage of the collision system. More...

virtual bool evalNCPrimitiveCollision (double deltaTime, UMovePrimitive *primitive, uint8 worldImage)=0
 Evaluation of a single non collisionable primitive. More...

virtual bool testMove (UMovePrimitive *primitive, const NLMISC::CVectorD &speed, double deltaTime, uint8 worldImage, NLMISC::CVectorD *contactNormal)=0
 Test the move of a primitive in a specific world image. More...

virtual void setAsStatic (uint8 worldImage)=0
 Set world image as static world image. More...

virtual void duplicateWorldImage (uint8 source, uint8 dest)=0
 Duplicate a world image in another. More...

virtual uint getNumTriggerInfo () const=0
 Get number of trigger informations. More...

virtual const UTriggerInfogetTriggerInfo (uint id) const=0
 Get the n-th trigger informations. More...


Static Public Methods

UMoveContainer * createMoveContainer (double xmin, double ymin, double xmax, double ymax, uint widthCellCount, uint heightCellCount, double primitiveMaxSize, uint8 numWorldImage=NELPACS_DEFAULT_NUM_WORLD_IMAGE, uint maxIteration=NELPACS_DEFAULT_MAX_TEST_ITERATION, uint otSize=NELPACS_DEFAULT_OT_SIZE)
UMoveContainer * createMoveContainer (UGlobalRetriever *retriever, uint widthCellCount, uint heightCellCount, double primitiveMaxSize, uint8 numWorldImage=NELPACS_DEFAULT_NUM_WORLD_IMAGE, uint maxIteration=NELPACS_DEFAULT_MAX_TEST_ITERATION, uint otSize=NELPACS_DEFAULT_OT_SIZE)
void deleteMoveContainer (UMoveContainer *container)
void getPACSCoordsFromMatrix (NLMISC::CVector &pos, float &angle, const NLMISC::CMatrix &mat)
 Get a pacs position and an orientation from a matrix. More...


Detailed Description

A container for movable objects Some constraints: * The move bounding box must be lower than the cell size.

Author:
Cyril 'Hulud' Corvazier , Nevrax France
Date:
2001

Definition at line 60 of file u_move_container.h.


Member Function Documentation

virtual UMovePrimitive* NLPACS::UMoveContainer::addCollisionablePrimitive uint8    firstWorldImage,
uint8    numWorldImage,
const UMovePrimitive   copyFrom = NULL
[pure virtual]
 

Add a collisionable primitive in the container.

Return the pointer on the primitive. This primitive will generate collisions when the system evaluate other primitives against.

You must specify the ids of each world image where the primitive can be inserted. Thoses ids are consecutives. If you choose 5 as first id and 3 as id count, this primitive could be inserted in the world image #5, #6 and #7.

This primtive should be inserted in a world image before use. See UMovePrimitive::insertInWorldImage.

Parameters:
firstWorldImage  is the first world image where the primitive can be inserted.
numWorldImage  is the count of world image where the primitive can be inserted.
Returns:
a pointer on the new primitive.

Implemented in NLPACS::CMoveContainer.

virtual void NLPACS::UMoveContainer::addCollisionnablePrimitiveBlock UPrimitiveBlock   pb,
uint8    firstWorldImage,
uint8    numWorldImage,
std::vector< UMovePrimitive * > *    primitives,
float    orientation,
const NLMISC::CVector   position,
bool    dontSnapToGround = false
[pure virtual]
 

The same as loadCollisionablePrimitiveBlock, but the primitive block is provided by the caller.

Implemented in NLPACS::CMoveContainer.

virtual UMovePrimitive* NLPACS::UMoveContainer::addNonCollisionablePrimitive const UMovePrimitive   copyFrom = NULL [pure virtual]
 

Add a noncollisionable primitive in the container.

Return the pointer on the primitive. This primitive won't generate collisions when the system evaluate other primitives against.

This primitive can't be inserted in a world image.

Parameters:
copyFrom  is an optional primitive to copy attributes from (so the primitive is initialised with same values)
Returns:
a pointer on the new primitive.

Implemented in NLPACS::CMoveContainer.

UMoveContainer * NLPACS::UMoveContainer::createMoveContainer UGlobalRetriever   retriever,
uint    widthCellCount,
uint    heightCellCount,
double    primitiveMaxSize,
uint8    numWorldImage = NELPACS_DEFAULT_NUM_WORLD_IMAGE,
uint    maxIteration = NELPACS_DEFAULT_MAX_TEST_ITERATION,
uint    otSize = NELPACS_DEFAULT_OT_SIZE
[static]
 

Definition at line 1642 of file move_container.cpp.

References nlassert, and r.

UMoveContainer * NLPACS::UMoveContainer::createMoveContainer double    xmin,
double    ymin,
double    xmax,
double    ymax,
uint    widthCellCount,
uint    heightCellCount,
double    primitiveMaxSize,
uint8    numWorldImage = NELPACS_DEFAULT_NUM_WORLD_IMAGE,
uint    maxIteration = NELPACS_DEFAULT_MAX_TEST_ITERATION,
uint    otSize = NELPACS_DEFAULT_OT_SIZE
[static]
 

Definition at line 1630 of file move_container.cpp.

void NLPACS::UMoveContainer::deleteMoveContainer UMoveContainer *    container [static]
 

Definition at line 1267 of file move_container.cpp.

virtual void NLPACS::UMoveContainer::duplicateWorldImage uint8    source,
uint8    dest
[pure virtual]
 

Duplicate a world image in another.

All primitive will be removed from the destination world image. Then, the source world image will be copied in the destination world image.

Warning, only primitives from the source that have been decalared as using the destintation world image will be copied.

The source world image remain the same.

Parameters:
source  is the id of the source world image for the copy.
dest  is the id of the destination world image for the copy.

Implemented in NLPACS::CMoveContainer.

virtual void NLPACS::UMoveContainer::evalCollision double    deltaTime,
uint8    worldImage
[pure virtual]
 

Evaluation of a worldImage of the collision system.

This method will evaluate the move of each modified collisionable primitives inserted in the world image. The method test first collisions against the terrai, then test collisions against primitives inserted in the world images declared as static, then test the collision against the primitives inserted in the world image to evaluate.

Parameters:
deltaTime  is the delta time of the system evaluation.
worldImage  is the world image to eval.

Implemented in NLPACS::CMoveContainer.

virtual bool NLPACS::UMoveContainer::evalNCPrimitiveCollision double    deltaTime,
UMovePrimitive   primitive,
uint8    worldImage
[pure virtual]
 

Evaluation of a single non collisionable primitive.

The method test first collisions against the terrai, then test collisions against primitives inserted in the world images declared as static, then test the collision against the primitives inserted in the world image to evaluate.

Parameters:
deltaTime  is the delta time of the system evaluation.
primitive  is the prmitive pointer
worldImage  is the world image to eval.
Returns:
false if the primitive is a collisionable primitive.

Implemented in NLPACS::CMoveContainer.

virtual uint NLPACS::UMoveContainer::getNumTriggerInfo   const [pure virtual]
 

Get number of trigger informations.

Implemented in NLPACS::CMoveContainer.

void NLPACS::UMoveContainer::getPACSCoordsFromMatrix NLMISC::CVector   pos,
float &    angle,
const NLMISC::CMatrix   mat
[static]
 

Get a pacs position and an orientation from a matrix.

Definition at line 1814 of file move_container.cpp.

References NLMISC::CMatrix::getPos, NLMISC::CVector::I, and NLMISC::CMatrix::mulVector.

virtual void NLPACS::UMoveContainer::getPrimitives std::vector< const UMovePrimitive * > &    dest const [pure virtual]
 

Get all the primitives in the container.

Implemented in NLPACS::CMoveContainer.

virtual const UTriggerInfo& NLPACS::UMoveContainer::getTriggerInfo uint    id const [pure virtual]
 

Get the n-th trigger informations.

Implemented in NLPACS::CMoveContainer.

virtual bool NLPACS::UMoveContainer::loadCollisionablePrimitiveBlock const char *    filename,
uint8    firstWorldImage,
uint8    numWorldImage,
std::vector< UMovePrimitive * > *    primitives,
float    orientation,
const NLMISC::CVector   position,
bool    dontSnapToGround = false
[pure virtual]
 

Load a PACS primitive block.

(*.pacs_prim)

Add a set of collisionable primitive in the container. If sucess, fill an array with primitives's pointers. The primitive are inserted in the requested world image of the container. Then a setGlobalPosition is done to place the primitives in the world image. The world images are not evaluated.

You must specify the ids of each world image where the primitives can be inserted. Thoses ids are consecutives. If you choose 5 as first id and 3 as id count, those primitives could be inserted in the world image #5, #6 and #7.

Those primtives should be inserted in a world image before use. See UMovePrimitive::insertInWorldImage.

Return false if the world image numbers are not present in the move container.

Can raise unhandled NLMISC::Exception if trouble during serialisation.

Parameters:
filename  is the file to load.
firstWorldImage  is the first world image where the primitive can be inserted.
numWorldImage  is the count of world image where the primitive can be inserted.
primitives  is a pointer on an array of primitive pointer to fill if success. If NULL, Do return nothing.
orientation  is the orientation to give to the primitives.
position  is the position to give to the primitives.
primitives  is a pointer on an array of primitive pointer to fill if success. If NULL, Do return nothing.
dontSnapToGround  force the inserted primitive to be flagged as 'DontSnapToGround'
See also:
addCollisionablePrimitive , getPACSCoordsFromMatrix
Returns:
true if the file is successfully loaded, else return false.

Implemented in NLPACS::CMoveContainer.

virtual void NLPACS::UMoveContainer::removePrimitive UMovePrimitive   primitive [pure virtual]
 

Remove a primitive from the container.

Parameters:
primitive  is the pointer on the primitive to remove.

Implemented in NLPACS::CMoveContainer.

virtual void NLPACS::UMoveContainer::setAsStatic uint8    worldImage [pure virtual]
 

Set world image as static world image.

This method set this world image as static. It means that primitives inserted there don't move. Each primitive evaluation methods will first test all the primitives in the world images declared as static. Then, the evalutation test the primtive in the asked worldImage.

Parameters:
worldImage  is the id of the world image to set as static.

Implemented in NLPACS::CMoveContainer.

virtual bool NLPACS::UMoveContainer::testMove UMovePrimitive   primitive,
const NLMISC::CVectorD   speed,
double    deltaTime,
uint8    worldImage,
NLMISC::CVectorD   contactNormal
[pure virtual]
 

Test the move of a primitive in a specific world image.

This method will test the move of each modified primitives inserted in the world image. The method will test first collisions against primitives inserted in the world images declared as static, then test the collision against the primitives inserted in the world image choosed to test the move of the primitive.

Parameters:
primitive  is a pointer on the primitive
speed  is the wanted speed of the primitive
deltaTime  is the deltaTime of the move of the primitive.
worldImage  is the world image where you want to test the move of the primitive.
contactNormal  is a pointer to CVectorD to store contactNormal with terrain, if not NULL
Returns:
true if the move is successful, false else.

Implemented in NLPACS::CMoveContainer.


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