Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Opcode::RayCollider Class Reference

#include <Opcode.h>

Inheritance diagram for Opcode::RayCollider:
Inheritance graph
[legend]

Public Member Functions

bool Collide (const Ray &world_ray, const Model &model, const Matrix4x4 *world=null, udword *cache=null)
 
bool Collide (const Ray &world_ray, const AABBTree *tree, Container &box_indices)
 
inline_ udword GetNbIntersections () const
 
inline_ udword GetNbRayBVTests () const
 
inline_ udword GetNbRayPrimTests () const
 
 override (Collider) const char *ValidateSettings()
 
 RayCollider ()
 
inline_ void SetCulling (bool flag)
 
inline_ void SetHitCallback (HitCallback cb)
 
inline_ void SetMaxDist (float max_dist=MAX_FLOAT)
 
inline_ void SetUserData (void *user_data)
 
virtual ~RayCollider ()
 
- Public Member Functions inherited from Opcode::Collider
 Collider ()
 
inline_ BOOL ContactFound () const
 
inline_ BOOL FirstContactEnabled () const
 
inline_ BOOL GetContactStatus () const
 
inline_ void SetFirstContact (bool flag)
 
inline_ void SetPrimitiveTests (bool flag)
 
inline_ void SetTemporalCoherence (bool flag)
 
inline_ BOOL SkipPrimitiveTests () const
 
inline_ BOOL TemporalCoherenceEnabled () const
 
inline_ BOOL TemporalHit () const
 
virtual const char * ValidateSettings ()=0
 
virtual ~Collider ()
 

Protected Member Functions

void _RayStab (const AABBCollisionNode *node)
 
void _RayStab (const AABBNoLeafNode *node)
 
void _RayStab (const AABBQuantizedNode *node)
 
void _RayStab (const AABBQuantizedNoLeafNode *node)
 
void _RayStab (const AABBTreeNode *node, Container &box_indices)
 
void _SegmentStab (const AABBCollisionNode *node)
 
void _SegmentStab (const AABBNoLeafNode *node)
 
void _SegmentStab (const AABBQuantizedNode *node)
 
void _SegmentStab (const AABBQuantizedNoLeafNode *node)
 
void _SegmentStab (const AABBTreeNode *node, Container &box_indices)
 
BOOL InitQuery (const Ray &world_ray, const Matrix4x4 *world=null, udword *face_id=null)
 
inline_ BOOL RayAABBOverlap (const Point &center, const Point &extents)
 
inline_ BOOL RayTriOverlap (const Point &vert0, const Point &vert1, const Point &vert2)
 
inline_ BOOL SegmentAABBOverlap (const Point &center, const Point &extents)
 
- Protected Member Functions inherited from Opcode::Collider
virtual inline_ void InitQuery ()
 
inline_ BOOL Setup (const BaseModel *model)
 

Protected Attributes

Point mCenterCoeff
 
bool mCulling
 Stab culled faces or not. More...
 
Point mData
 
Point mData2
 
Point mDir
 Ray direction (normalized) More...
 
Point mExtentsCoeff
 
Point mFDir
 fabsf(mDir) More...
 
HitCallback mHitCallback
 Callback used to record a hit. More...
 
float mMaxDist
 Valid segment on the ray. More...
 
udword mNbIntersections
 Number of valid intersections. More...
 
udword mNbRayBVTests
 Number of Ray-BV tests. More...
 
udword mNbRayPrimTests
 Number of Ray-Primitive tests. More...
 
Point mOrigin
 Ray origin. More...
 
CollisionFace mStabbedFace
 Current stabbed face. More...
 
voidmUserData
 User-defined data. More...
 
- Protected Attributes inherited from Opcode::Collider
const BaseModelmCurrentModel
 Current model for collision query (owner of touched faces) More...
 
udword mFlags
 Bit flags. More...
 
const MeshInterfacemIMesh
 User-defined mesh interface. More...
 

Detailed Description

Definition at line 64 of file Opcode.h.

Constructor & Destructor Documentation

RayCollider::RayCollider ( )

Constructor.

Definition at line 205 of file OPC_RayCollider.cpp.

RayCollider::~RayCollider ( )
virtual

Destructor.

Definition at line 228 of file OPC_RayCollider.cpp.

Member Function Documentation

void RayCollider::_RayStab ( const AABBCollisionNode node)
protected

Recursive stabbing query for normal AABB trees.

Parameters
node[in] current collision node

Definition at line 633 of file OPC_RayCollider.cpp.

void RayCollider::_RayStab ( const AABBNoLeafNode node)
protected

Recursive stabbing query for no-leaf AABB trees.

Parameters
node[in] current collision node

Definition at line 688 of file OPC_RayCollider.cpp.

void RayCollider::_RayStab ( const AABBQuantizedNode node)
protected

Recursive stabbing query for quantized AABB trees.

Parameters
node[in] current collision node

Definition at line 658 of file OPC_RayCollider.cpp.

void RayCollider::_RayStab ( const AABBQuantizedNoLeafNode node)
protected

Recursive stabbing query for quantized no-leaf AABB trees.

Parameters
node[in] current collision node

Definition at line 714 of file OPC_RayCollider.cpp.

void RayCollider::_RayStab ( const AABBTreeNode node,
Container box_indices 
)
protected

Recursive stabbing query for vanilla AABB trees.

Parameters
node[in] current collision node
box_indices[out] indices of stabbed boxes

Definition at line 746 of file OPC_RayCollider.cpp.

void RayCollider::_SegmentStab ( const AABBCollisionNode node)
protected

Recursive stabbing query for normal AABB trees.

Parameters
node[in] current collision node

Definition at line 495 of file OPC_RayCollider.cpp.

void RayCollider::_SegmentStab ( const AABBNoLeafNode node)
protected

Recursive stabbing query for no-leaf AABB trees.

Parameters
node[in] current collision node

Definition at line 550 of file OPC_RayCollider.cpp.

void RayCollider::_SegmentStab ( const AABBQuantizedNode node)
protected

Recursive stabbing query for quantized AABB trees.

Parameters
node[in] current collision node

Definition at line 520 of file OPC_RayCollider.cpp.

void RayCollider::_SegmentStab ( const AABBQuantizedNoLeafNode node)
protected

Recursive stabbing query for quantized no-leaf AABB trees.

Parameters
node[in] current collision node

Definition at line 576 of file OPC_RayCollider.cpp.

void RayCollider::_SegmentStab ( const AABBTreeNode node,
Container box_indices 
)
protected

Recursive stabbing query for vanilla AABB trees.

Parameters
node[in] current collision node
box_indices[out] indices of stabbed boxes

Definition at line 608 of file OPC_RayCollider.cpp.

bool RayCollider::Collide ( const Ray world_ray,
const Model model,
const Matrix4x4 world = null,
udword cache = null 
)

Generic stabbing query for generic OPCODE models. After the call, access the results:

Parameters
world_ray[in] stabbing ray in world space
model[in] Opcode model to collide with
world[in] model's world matrix, or null
cache[in] a possibly cached face index, or null
Returns
true if success
Warning
SCALE NOT SUPPORTED. The matrices must contain rotation & translation parts only.

Definition at line 264 of file OPC_RayCollider.cpp.

bool RayCollider::Collide ( const Ray world_ray,
const AABBTree tree,
Container box_indices 
)

Stabbing query for vanilla AABB trees.

Parameters
world_ray[in] stabbing ray in world space
tree[in] AABB tree
box_indices[out] indices of stabbed boxes
Returns
true if success

Definition at line 465 of file OPC_RayCollider.cpp.

inline_ udword Opcode::RayCollider::GetNbIntersections ( ) const
inline

Stats: gets the number of intersection found after a collision query. Can be used for in/out tests.

See also
GetNbRayBVTests()
GetNbRayPrimTests()
Returns
the number of valid intersections during last query

Definition at line 169 of file Opcode.h.

inline_ udword Opcode::RayCollider::GetNbRayBVTests ( ) const
inline

Stats: gets the number of Ray-BV overlap tests after a collision query.

See also
GetNbRayPrimTests()
GetNbIntersections()
Returns
the number of Ray-BV tests performed during last query

Definition at line 148 of file Opcode.h.

inline_ udword Opcode::RayCollider::GetNbRayPrimTests ( ) const
inline

Stats: gets the number of Ray-Triangle overlap tests after a collision query.

See also
GetNbRayBVTests()
GetNbIntersections()
Returns
the number of Ray-Triangle tests performed during last query

Definition at line 158 of file Opcode.h.

BOOL RayCollider::InitQuery ( const Ray world_ray,
const Matrix4x4 world = null,
udword face_id = null 
)
protected

Initializes a stabbing query :

  • reset stats & contact status
  • compute ray in local space
  • check temporal coherence
Parameters
world_ray[in] stabbing ray in world space
world[in] object's world matrix, or null
face_id[in] index of previously stabbed triangle
Returns
TRUE if we can return immediately
Warning
SCALE NOT SUPPORTED. The matrix must contain rotation & translation parts only.

Definition at line 339 of file OPC_RayCollider.cpp.

Opcode::RayCollider::override ( Collider  ) const

Validates current settings. You should call this method after all the settings and callbacks have been defined for a collider.

Returns
null if everything is ok, else a string describing the problem
inline_ BOOL Opcode::RayCollider::RayAABBOverlap ( const Point center,
const Point extents 
)
protected
inline_ BOOL Opcode::RayCollider::RayTriOverlap ( const Point vert0,
const Point vert1,
const Point vert2 
)
protected
inline_ BOOL Opcode::RayCollider::SegmentAABBOverlap ( const Point center,
const Point extents 
)
protected
inline_ void Opcode::RayCollider::SetCulling ( bool  flag)
inline

Settings: enable or disable backface culling.

Parameters
flag[in] true to enable backface culling
See also
SetClosestHit(bool flag)
SetMaxDist(float max_dist)
SetDestination(StabbedFaces* sf)

Definition at line 111 of file Opcode.h.

inline_ void Opcode::RayCollider::SetHitCallback ( HitCallback  cb)
inline

Definition at line 125 of file Opcode.h.

inline_ void Opcode::RayCollider::SetMaxDist ( float  max_dist = MAX_FLOAT)
inline

Settings: sets the higher distance bound.

Parameters
max_dist[in] higher distance bound. Default = maximal value, for ray queries (else segment)
See also
SetClosestHit(bool flag)
SetCulling(bool flag)
SetDestination(StabbedFaces* sf)

Definition at line 122 of file Opcode.h.

inline_ void Opcode::RayCollider::SetUserData ( void user_data)
inline

Definition at line 126 of file Opcode.h.

Member Data Documentation

Point Opcode::RayCollider::mCenterCoeff
protected

Definition at line 199 of file Opcode.h.

bool Opcode::RayCollider::mCulling
protected

Stab culled faces or not.

Definition at line 206 of file Opcode.h.

Point Opcode::RayCollider::mData
protected

Definition at line 184 of file Opcode.h.

Point Opcode::RayCollider::mData2
protected

Definition at line 184 of file Opcode.h.

Point Opcode::RayCollider::mDir
protected

Ray direction (normalized)

Definition at line 182 of file Opcode.h.

Point Opcode::RayCollider::mExtentsCoeff
protected

Definition at line 200 of file Opcode.h.

Point Opcode::RayCollider::mFDir
protected

fabsf(mDir)

Definition at line 183 of file Opcode.h.

HitCallback Opcode::RayCollider::mHitCallback
protected

Callback used to record a hit.

Definition at line 188 of file Opcode.h.

float Opcode::RayCollider::mMaxDist
protected

Valid segment on the ray.

Definition at line 202 of file Opcode.h.

udword Opcode::RayCollider::mNbIntersections
protected

Number of valid intersections.

Definition at line 197 of file Opcode.h.

udword Opcode::RayCollider::mNbRayBVTests
protected

Number of Ray-BV tests.

Definition at line 194 of file Opcode.h.

udword Opcode::RayCollider::mNbRayPrimTests
protected

Number of Ray-Primitive tests.

Definition at line 195 of file Opcode.h.

Point Opcode::RayCollider::mOrigin
protected

Ray origin.

Definition at line 181 of file Opcode.h.

CollisionFace Opcode::RayCollider::mStabbedFace
protected

Current stabbed face.

Definition at line 186 of file Opcode.h.

void* Opcode::RayCollider::mUserData
protected

User-defined data.

Definition at line 189 of file Opcode.h.


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


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat May 8 2021 02:42:45