|
|
|
|
Documentation |
|
Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages Search
NLPACS::CGlobalRetriever Class ReferenceA class that allows to retrieve surface in a large amount of zones (referred as instances.).
More...
#include <global_retriever.h>
Inheritance diagram for NLPACS::CGlobalRetriever:
List of all members.
Collisions part. |
enum | TCollisionType { Circle,
BBox
} |
void | findCollisionChains (CCollisionSurfaceTemp &cst, const NLMISC::CAABBox &bboxMove, const NLMISC::CVector &origin) const |
| reset and fill cst.CollisionChains with possible collisions in bboxMove+origin. More...
|
void | testCollisionWithCollisionChains (CCollisionSurfaceTemp &cst, const CVector2f &startCol, const CVector2f &deltaCol, CSurfaceIdent startSurface, float radius, const CVector2f bbox[4], TCollisionType colType) const |
| reset and fill cst.CollisionDescs with effective collisions against current cst.CollisionChains. More...
|
CSurfaceIdent | testMovementWithCollisionChains (CCollisionSurfaceTemp &cst, const CVector2f &startCol, const CVector2f &deltaCol, CSurfaceIdent startSurface) const |
| reset and fill cst.MoveDescs with effective collisions of a point movement against current cst.CollisionChains. More...
|
void | testRotCollisionWithCollisionChains (CCollisionSurfaceTemp &cst, const CVector2f &startCol, CSurfaceIdent startSurface, const CVector2f bbox[4]) const |
| reset and fill cst.CollisionDescs with effective collisions against current cst.CollisionChains. More...
|
bool | verticalChain (const CCollisionChain &colChain) const |
| test if a collisionChain separate 2 walls. More...
|
Public Types |
typedef std::vector< CLocalPath > | CGlobalPath |
Public Methods |
|
| CGlobalRetriever (const CRetrieverBank *bank=NULL) |
| Constructor. More...
|
virtual | ~CGlobalRetriever () |
void | init () |
| Setup an empty global retriever. More...
|
void | initQuadGrid () |
| Fill the quadgrid with the instances. More...
|
void | initRetrieveTable () |
| Init the retrieve table. More...
|
|
const NLMISC::CAABBox & | getBBox () const |
| Gets the BBox of the global retriever. More...
|
const std::vector< CRetrieverInstance > & | getInstances () const |
| Gets the vector of retriever instances that compose the global retriever. More...
|
const CRetrieverInstance & | getInstance (uint id) const |
| Gets the retriever instance referred by its id. More...
|
void | selectInstances (const NLMISC::CAABBox &bbox, CCollisionSurfaceTemp &cst) const |
| Select the instances that are in contact with the given bbox. More...
|
const CRetrieverBank * | getRetrieverBank () const |
| Get the retriever bank associated to this global retriever. More...
|
const CLocalRetriever & | getRetriever (uint32 id) const |
| Get the local retriever. More...
|
uint32 | getMaterial (const UGlobalPosition &pos) const |
| Get the material at this position. More...
|
bool | isInterior (const UGlobalPosition &pos) const |
| Test if the position is an interior. More...
|
bool | isWaterPosition (const UGlobalPosition &pos, float &waterHeight) const |
| Test if the position is in water. More...
|
|
UGlobalPosition | retrievePosition (const NLMISC::CVector &estimated) const |
| Retrieves the position of an estimated point in the global retriever. More...
|
UGlobalPosition | retrievePosition (const NLMISC::CVectorD &estimated) const |
| Retrieves the position of an estimated point in the global retriever (double instead.). More...
|
UGlobalPosition | retrievePosition (const NLMISC::CVector &estimated, float threshold) const |
| Retrieves the position of an estimated point in the global retriever. More...
|
UGlobalPosition | retrievePosition (const NLMISC::CVectorD &estimated, double threshold) const |
| Retrieves the position of an estimated point in the global retriever (double instead.). More...
|
sint32 | getIdentifier (const std::string &id) const |
| Return the retriever id from the string id. More...
|
const std::string & | getIdentifier (const UGlobalPosition &position) const |
| Get the identifier of the global position. More...
|
bool | buildInstance (const std::string &id, const NLMISC::CVectorD &position, sint32 &instanceId) |
| Builds a instance of retriever, and link it on the ground (or wherever). More...
|
void | removeInstance (sint32 instanceId) |
| Removes an instance of retriever (perform all unlinks necessary). More...
|
NLMISC::CVector | getGlobalPosition (const UGlobalPosition &global) const |
| Converts a global position object into a 'human-readable' CVector. More...
|
NLMISC::CVectorD | getDoubleGlobalPosition (const UGlobalPosition &global) const |
| Converts a global position object into a 'human-readable' CVector (double instead.). More...
|
bool | testRaytrace (const NLMISC::CVectorD &v0, const NLMISC::CVectorD &v1) |
| Make a raytrace test. For the time, always return false. More...
|
|
const CRetrieverInstance & | makeInstance (uint32 retriever, uint8 orientation, const NLMISC::CVector &origin) |
| Creates an instance of local retriever at the origine position with the given orientation. More...
|
CRetrieverInstance & | getInstanceFullAccess (uint id) |
| Gets the instance by its id, with full read/write access. More...
|
void | setRetrieverBank (const CRetrieverBank *bank) |
| Sets the retriever bank. More...
|
void | resetAllLinks () |
| Resets all links within the global retriever. More...
|
void | initAll () |
| Inits all the instances inside the global retriever. More...
|
void | makeLinks (uint n) |
| Links the instance referred by its id to its neighbors. More...
|
void | makeAllLinks () |
| Links all the instances inside the global retriever. More...
|
void | check () const |
| Checks the retriever for errors. More...
|
float | distanceToBorder (const UGlobalPosition &pos) const |
void | getBorders (const UGlobalPosition &pos, std::vector< NLMISC::CLine > &edges) |
void | serial (NLMISC::IStream &f) |
| Serialises the global retriever. More...
|
|
const TCollisionSurfaceDescVector * | testCylinderMove (const UGlobalPosition &start, const NLMISC::CVector &delta, float radius, CCollisionSurfaceTemp &cst) const |
| Test a movement of a cylinder against surface world. More...
|
const TCollisionSurfaceDescVector * | testBBoxMove (const UGlobalPosition &start, const NLMISC::CVector &delta, const NLMISC::CVector &locI, const NLMISC::CVector &locJ, CCollisionSurfaceTemp &cst) const |
| Test a movement of a bbox against surface world. More...
|
UGlobalPosition | doMove (const UGlobalPosition &start, const NLMISC::CVector &delta, float t, CCollisionSurfaceTemp &cst, bool rebuildChains=false) const |
| apply a movement of a point against surface world. More...
|
const CRetrievableSurface * | getSurfaceById (const CSurfaceIdent &surfId) const |
| retrieve a surface by its Id. More...
|
const TCollisionSurfaceDescVector & | testBBoxRot (const CGlobalPosition &start, const NLMISC::CVector &locI, const NLMISC::CVector &locJ, CCollisionSurfaceTemp &cst) const |
| Test a rotation of a BBox against the surfaces. More...
|
float | getMeanHeight (const UGlobalPosition &pos) const |
| return the mean height of the surface under pos.. More...
|
void | updateHeight (UGlobalPosition &pos) const |
| Upadates the height of the given global position. More...
|
|
void | findAStarPath (const UGlobalPosition &begin, const UGlobalPosition &end, std::vector< CRetrieverInstance::CAStarNodeAccess > &path, uint32 forbidFlags) const |
| Finds an A* path from a given global position to another. More...
|
void | findPath (const UGlobalPosition &begin, const UGlobalPosition &end, CGlobalPath &path, uint32 forbidFlags=0) const |
| Finds a path from a given global position to another. More...
|
Protected Methods |
CCollisionSurfaceTemp & | getInternalCST () const |
Protected Attributes |
const CRetrieverBank * | _RetrieverBank |
| The CRetrieverBank where the commmon retrievers are stored. More...
|
std::vector< CRetrieverInstance > | _Instances |
| The instances of the global retriever. More...
|
CQuadGrid< uint32 > | _InstanceGrid |
| The grid of instances. More...
|
NLMISC::CAABBox | _BBox |
| The axis aligned bounding box of the global retriever. More...
|
Private Types |
Private Methods |
|
CRetrieverInstance::CAStarNodeInfo & | getNode (CRetrieverInstance::CAStarNodeAccess &access) const |
| Gets the CAStarNodeInfo referred by its access. More...
|
Private Attributes |
CCollisionSurfaceTemp | _InternalCST |
std::vector< uint8 > | _RetrieveTable |
| Used to retrieve the surface. Internal use only, to avoid large amount of new/delete. More...
|
Friends |
class | CRetrieverInstance |
Detailed Description
A class that allows to retrieve surface in a large amount of zones (referred as instances.).
-
Author:
-
Benjamin Legros , Nevrax France
-
Date:
-
2001
Definition at line 61 of file global_retriever.h.
Member Typedef Documentation
typedef std::vector<CLocalPath> NLPACS::CGlobalRetriever::CGlobalPath
|
|
Member Enumeration Documentation
enum NLPACS::CGlobalRetriever::TCollisionType [private]
|
|
Constructor & Destructor Documentation
NLPACS::CGlobalRetriever::CGlobalRetriever |
( |
const CRetrieverBank * |
bank = NULL |
) |
[inline] |
|
virtual NLPACS::CGlobalRetriever::~CGlobalRetriever |
( |
|
) |
[inline, virtual] |
|
Member Function Documentation
bool NLPACS::CGlobalRetriever::buildInstance |
( |
const std::string & |
id, |
|
|
const NLMISC::CVectorD & |
position, |
|
|
sint32 & |
instanceId |
|
) |
[virtual] |
|
|
Builds a instance of retriever, and link it on the ground (or wherever).
-
Parameters:
-
id |
a valid retriever id to be instanciated |
a |
valid position where the retriever should be instanciated |
-
Returns:
-
false if failed
Implements NLPACS::UGlobalRetriever. |
void NLPACS::CGlobalRetriever::check |
( |
|
) |
const |
|
float NLPACS::CGlobalRetriever::distanceToBorder |
( |
const UGlobalPosition & |
pos |
) |
const [virtual] |
|
|
apply a movement of a point against surface world.
This should be called after test???Move(). NB: It's up to you to give good t, relative to result of test???Move(). Else, undefined results... NB: if you don't give same start/delta as in preceding call to testMove(), and rebuildChains==false, start is returned (nlstop in debug). -
Parameters:
-
start |
is the start position of the movement. (must be same as passed in test???Move()). |
delta |
is the requested movement (must be same as passed in test???Move()). |
t |
must be in [0,1]. t*delta is the actual requested movement. |
cst |
is the CCollisionSurfaceTemp object used as temp computing (one per thread). (must be same as passed in test???Move()). |
rebuildChains |
true if doMove() is not called just after the testMove(). Then CGlobalRetriever must recompute some part of the data needed to performing his task. |
-
Returns:
-
new position of the entity.
Definition at line 1712 of file global_retriever.cpp.
References NLMISC::clamp, NLPACS::CCollisionSurfaceTemp::CollisionDescs, findCollisionChains, getInstance, NLPACS::UGlobalPosition::InstanceId, NLPACS::UGlobalPosition::LocalPosition, nlassert, nlstop, NLPACS::CCollisionSurfaceTemp::PrecDeltaPos, NLPACS::CCollisionSurfaceTemp::PrecStartPos, NLPACS::CCollisionSurfaceTemp::PrecStartSurface, NLPACS::CCollisionSurfaceTemp::PrecValid, res, NLPACS::SnapPrecision, t, testMovementWithCollisionChains, NLPACS::Vector2sAccuracy, x, and y. |
|
Finds an A* path from a given global position to another.
-
Todo:
-
secure search to avoid crashes...
Referenced by findPath. |
|
reset and fill cst.CollisionChains with possible collisions in bboxMove+origin.
result: collisionChains, computed localy to origin.
Definition at line 1008 of file global_retriever.cpp.
References _Instances, _RetrieverBank, CRetrieverInstance, getInstance, getRetriever, nlassert, selectInstances, and NLMISC::CAABBox::setCenter.
Referenced by doMove, testBBoxMove, testBBoxRot, and testCylinderMove. |
|
Finds a path from a given global position to another.
-
Todo:
-
include path width
Definition at line 896 of file global_retriever.cpp.
References _Instances, _InternalCST, _RetrieverBank, AStarTicks, CGlobalPath, ChainTicks, findAStarPath, NLPACS::UGlobalPosition::LocalPosition, PathTicks, SurfTicks, ThisAStarTicks, ThisChainTicks, ThisPathTicks, ThisSurfTicks, and NLMISC::TTicks. |
const NLMISC::CAABBox& NLPACS::CGlobalRetriever::getBBox |
( |
|
) |
const [inline, virtual] |
|
CVectorD NLPACS::CGlobalRetriever::getDoubleGlobalPosition |
( |
const UGlobalPosition & |
global |
) |
const [virtual] |
|
CVector NLPACS::CGlobalRetriever::getGlobalPosition |
( |
const UGlobalPosition & |
global |
) |
const [virtual] |
|
const string & NLPACS::CGlobalRetriever::getIdentifier |
( |
const UGlobalPosition & |
position |
) |
const [virtual] |
|
sint32 NLPACS::CGlobalRetriever::getIdentifier |
( |
const std::string & |
id |
) |
const [virtual] |
|
|
Gets the retriever instance referred by its id.
Definition at line 160 of file global_retriever.h.
References _Instances, CRetrieverInstance, and id.
Referenced by doMove, findCollisionChains, getMeanHeight, getSurfaceById, testBBoxMove, testBBoxRot, testCollisionWithCollisionChains, testCylinderMove, and testMovementWithCollisionChains. |
const std::vector<CRetrieverInstance>& NLPACS::CGlobalRetriever::getInstances |
( |
|
) |
const [inline] |
|
float NLPACS::CGlobalRetriever::getMeanHeight |
( |
const UGlobalPosition & |
pos |
) |
const [virtual] |
|
|
Get the local retriever.
Definition at line 172 of file global_retriever.h.
References _RetrieverBank, and id.
Referenced by check, distanceToBorder, findCollisionChains, getBorders, getIdentifier, getMaterial, NLPACS::CRetrieverInstance::initEdgeQuad, initRetrieveTable, isWaterPosition, NLPACS::CRetrieverInstance::linkEdgeQuad, makeInstance, and makeLinks. |
const CRetrieverBank* NLPACS::CGlobalRetriever::getRetrieverBank |
( |
|
) |
const [inline] |
|
void NLPACS::CGlobalRetriever::init |
( |
|
) |
|
|
void NLPACS::CGlobalRetriever::initAll |
( |
|
) |
|
|
void NLPACS::CGlobalRetriever::initQuadGrid |
( |
|
) |
|
|
void NLPACS::CGlobalRetriever::initRetrieveTable |
( |
|
) |
|
|
bool NLPACS::CGlobalRetriever::isInterior |
( |
const UGlobalPosition & |
pos |
) |
const [inline, virtual] |
|
bool NLPACS::CGlobalRetriever::isWaterPosition |
( |
const UGlobalPosition & |
pos, |
|
|
float & |
waterHeight |
|
) |
const [inline, virtual] |
|
void NLPACS::CGlobalRetriever::makeAllLinks |
( |
|
) |
|
|
void NLPACS::CGlobalRetriever::makeLinks |
( |
uint |
n |
) |
|
|
void NLPACS::CGlobalRetriever::removeInstance |
( |
sint32 |
instanceId |
) |
[virtual] |
|
void NLPACS::CGlobalRetriever::resetAllLinks |
( |
|
) |
|
|
void NLPACS::CGlobalRetriever::setRetrieverBank |
( |
const CRetrieverBank * |
bank |
) |
[inline] |
|
|
Test a rotation of a BBox against the surfaces.
NB: this function is not perfect because a ContactSurface may appears 2+ times in the returned array. -
Parameters:
-
start |
is the center of the bbox. |
locI |
is the new oriented I vector of the BBox. I.norm()== Width/2. |
locJ |
is the new oriented J vector of the BBox. J.norm()== Height/2. NB : must have locI^locJ== aK (a>0) |
cst |
is the CCollisionSurfaceTemp object used as temp copmputing (one per thread). |
-
Returns:
-
list of collision against surface (ContactTime and ContactNormal has no means). this is a synonym for cst.CollisionDescs. NB: this array may be modified by CGlobalRetriever on any collision call.
Definition at line 1905 of file global_retriever.cpp.
References findCollisionChains, getInstance, testRotCollisionWithCollisionChains, x, NLMISC::CVector::x, y, and NLMISC::CVector::y. |
void NLPACS::CGlobalRetriever::testCollisionWithCollisionChains |
( |
CCollisionSurfaceTemp & |
cst, |
|
|
const CVector2f & |
startCol, |
|
|
const CVector2f & |
deltaCol, |
|
|
CSurfaceIdent |
startSurface, |
|
|
float |
radius, |
|
|
const CVector2f |
bbox[4], |
|
|
TCollisionType |
colType |
|
) |
const [private] |
|
|
reset and fill cst.MoveDescs with effective collisions of a point movement against current cst.CollisionChains.
result: the surfaceIdent where we stop. -1 if we traverse a Wall, which should not happen because of collision test. NB: for precision pb, startCol and deltaCol should be snapped on a grid of 1/1024 meters, using snapVector(). NB: for precision pb (stop on edge etc....), return a "Precision problem ident", ie (-2,-2).
Definition at line 1411 of file global_retriever.cpp.
References _RetrieverBank, getInstance, nlinfo, and t.
Referenced by doMove. |
void NLPACS::CGlobalRetriever::testRotCollisionWithCollisionChains |
( |
CCollisionSurfaceTemp & |
cst, |
|
|
const CVector2f & |
startCol, |
|
|
CSurfaceIdent |
startSurface, |
|
|
const CVector2f |
bbox[4] |
|
) |
const [private] |
|
|
reset and fill cst.CollisionDescs with effective collisions against current cst.CollisionChains.
result: new collisionDescs in cst.
Definition at line 1972 of file global_retriever.cpp.
Referenced by testBBoxRot. |
void NLPACS::CGlobalRetriever::updateHeight |
( |
UGlobalPosition & |
pos |
) |
const [inline] |
|
bool NLPACS::CGlobalRetriever::verticalChain |
( |
const CCollisionChain & |
colChain |
) |
const [private] |
|
Friends And Related Function Documentation
friend class CRetrieverInstance [friend]
|
|
|
Definition at line 420 of file global_retriever.h.
Referenced by check, findCollisionChains, getBorders, getInstance, getInstanceFullAccess, getMaterial, getMeanHeight, isWaterPosition, makeInstance, makeLinks, removeInstance, and retrievePosition. |
Member Data Documentation
|
The instances of the global retriever.
Definition at line 114 of file global_retriever.h.
Referenced by check, distanceToBorder, findCollisionChains, findPath, getBorders, getDoubleGlobalPosition, getGlobalPosition, getIdentifier, getInstance, getInstanceFullAccess, getInstances, getMaterial, getNode, initAll, initQuadGrid, initRetrieveTable, isInterior, isWaterPosition, makeAllLinks, makeInstance, makeLinks, removeInstance, resetAllLinks, retrievePosition, selectInstances, serial, and testCollisionWithCollisionChains. |
const CRetrieverBank* NLPACS::CGlobalRetriever::_RetrieverBank [protected]
|
|
|
The CRetrieverBank where the commmon retrievers are stored.
Definition at line 111 of file global_retriever.h.
Referenced by CGlobalRetriever, check, findCollisionChains, findPath, getMeanHeight, getRetriever, getRetrieverBank, getSurfaceById, initAll, makeLinks, retrievePosition, setRetrieverBank, testCollisionWithCollisionChains, and testMovementWithCollisionChains. |
std::vector<uint8> NLPACS::CGlobalRetriever::_RetrieveTable [private]
|
|
The documentation for this class was generated from the following files:
|
|