hrplib
hrpCollision
Opcode
OPC_SphereCollider.h
Go to the documentation of this file.
1
/*
3
* OPCODE - Optimized Collision Detection
4
* Copyright (C) 2001 Pierre Terdiman
5
* Homepage: http://www.codercorner.com/Opcode.htm
6
*/
8
10
16
19
// Include Guard
20
#ifndef __OPC_SPHERECOLLIDER_H__
21
#define __OPC_SPHERECOLLIDER_H__
22
23
struct
OPCODE_API
SphereCache
:
VolumeCache
24
{
25
SphereCache
() : Center(0.0
f
,0.0
f
,0.0
f
), FatRadius2(0.0
f
), FatCoeff(1.1
f
) {}
26
~SphereCache
() {}
27
28
// Cached faces signature
29
Point
Center
;
30
float
FatRadius2
;
31
// User settings
32
float
FatCoeff
;
33
};
34
35
class
OPCODE_API
SphereCollider
:
public
VolumeCollider
36
{
37
public
:
38
// Constructor / Destructor
39
SphereCollider
();
40
virtual
~
SphereCollider
();
41
43
57
bool
Collide(
SphereCache
& cache,
const
Sphere
& sphere,
const
Model
& model,
const
Matrix4x4
* worlds=
null
,
const
Matrix4x4
* worldm=
null
);
59
60
//
61
bool
Collide(
SphereCache
& cache,
const
Sphere
& sphere,
const
AABBTree
* tree);
62
protected
:
63
// Sphere in model space
64
Point
mCenter
;
65
float
mRadius2
;
66
// Internal methods
67
void
_Collide(
const
AABBCollisionNode
* node);
68
void
_Collide(
const
AABBNoLeafNode
* node);
69
void
_Collide(
const
AABBQuantizedNode
* node);
70
void
_Collide(
const
AABBQuantizedNoLeafNode
* node);
71
void
_Collide(
const
AABBTreeNode
* node);
72
void
_CollideNoPrimitiveTest(
const
AABBCollisionNode
* node);
73
void
_CollideNoPrimitiveTest(
const
AABBNoLeafNode
* node);
74
void
_CollideNoPrimitiveTest(
const
AABBQuantizedNode
* node);
75
void
_CollideNoPrimitiveTest(
const
AABBQuantizedNoLeafNode
* node);
76
// Overlap tests
77
inline_
BOOL
SphereContainsBox(
const
Point
& bc,
const
Point
& be);
78
inline_
BOOL
SphereAABBOverlap(
const
Point
& center,
const
Point
& extents);
79
BOOL
SphereTriOverlap(
const
Point
& vert0,
const
Point
& vert1,
const
Point
& vert2);
80
// Init methods
81
BOOL
InitQuery
(
SphereCache
& cache,
const
Sphere
& sphere,
const
Matrix4x4
* worlds=
null
,
const
Matrix4x4
* worldm=
null
);
82
};
83
84
class
OPCODE_API
HybridSphereCollider
:
public
SphereCollider
85
{
86
public
:
87
// Constructor / Destructor
88
HybridSphereCollider
();
89
virtual
~
HybridSphereCollider
();
90
91
bool
Collide
(
SphereCache
& cache,
const
Sphere
& sphere,
const
HybridModel
& model,
const
Matrix4x4
* worlds=
null
,
const
Matrix4x4
* worldm=
null
);
92
protected
:
93
Container
mTouchedBoxes
;
94
};
95
96
#endif // __OPC_SPHERECOLLIDER_H__
Container
Definition:
IceContainer.h:25
null
#define null
our own NULL pointer
Definition:
IceTypes.h:57
SphereCache::FatRadius2
float FatRadius2
Sphere used when performing the query resulting in cached faces.
Definition:
OPC_SphereCollider.h:30
Matrix4x4
Definition:
IceMatrix4x4.h:21
inline_
#define inline_
Definition:
IcePreprocessor.h:103
SphereCache::SphereCache
SphereCache()
Definition:
OPC_SphereCollider.h:25
Point
Definition:
IcePoint.h:25
SphereCache::Center
Point Center
Sphere used when performing the query resulting in cached faces.
Definition:
OPC_SphereCollider.h:29
Collider::InitQuery
virtual inline_ void InitQuery()
Definition:
OPC_Collider.h:173
OPCODE_API
#define OPCODE_API
Definition:
Opcode.h:68
AABBQuantizedNoLeafNode
Definition:
OPC_OptimizedTree.h:121
BOOL
int BOOL
Another boolean type.
Definition:
IceTypes.h:102
HybridSphereCollider
Definition:
OPC_SphereCollider.h:84
SphereCache::~SphereCache
~SphereCache()
Definition:
OPC_SphereCollider.h:26
AABBTreeNode
Definition:
OPC_AABBTree.h:83
HybridSphereCollider::mTouchedBoxes
Container mTouchedBoxes
Definition:
OPC_SphereCollider.h:93
SphereCollider::mRadius2
float mRadius2
Sphere radius squared.
Definition:
OPC_SphereCollider.h:65
AABBCollisionNode
Definition:
OPC_OptimizedTree.h:76
HybridModel
Definition:
OPC_HybridModel.h:46
SphereCache
Definition:
OPC_SphereCollider.h:23
Model
Definition:
OPC_Model.h:23
VolumeCollider
Definition:
OPC_VolumeCollider.h:32
SphereCache::FatCoeff
float FatCoeff
mRadius2 multiplier used to create a fat sphere
Definition:
OPC_SphereCollider.h:32
Sphere
Definition:
IceBoundingSphere.h:24
SphereCollider::Collide
bool Collide(SphereCache &cache, const Sphere &sphere, const Model &model, const Matrix4x4 *worlds=null, const Matrix4x4 *worldm=null)
swingTest.f
f
Definition:
swingTest.py:6
SphereCollider
Definition:
OPC_SphereCollider.h:35
AABBQuantizedNode
Definition:
OPC_OptimizedTree.h:100
VolumeCache
Definition:
OPC_VolumeCollider.h:23
AABBNoLeafNode
Definition:
OPC_OptimizedTree.h:116
AABBTree
Definition:
OPC_AABBTree.h:113
SphereCollider::mCenter
Point mCenter
Sphere center.
Definition:
OPC_SphereCollider.h:64
openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Thu Sep 8 2022 02:24:04