aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ode-0.9/OPCODE/OPC_LSSCollider.h
diff options
context:
space:
mode:
authordan miller2007-10-19 05:15:33 +0000
committerdan miller2007-10-19 05:15:33 +0000
commit79eca25c945a535a7a0325999034bae17da92412 (patch)
tree40ff433d94859d629aac933d5ec73b382f62ba1a /libraries/ode-0.9/OPCODE/OPC_LSSCollider.h
parentadding ode source to /libraries (diff)
downloadopensim-SC-79eca25c945a535a7a0325999034bae17da92412.zip
opensim-SC-79eca25c945a535a7a0325999034bae17da92412.tar.gz
opensim-SC-79eca25c945a535a7a0325999034bae17da92412.tar.bz2
opensim-SC-79eca25c945a535a7a0325999034bae17da92412.tar.xz
resubmitting ode
Diffstat (limited to 'libraries/ode-0.9/OPCODE/OPC_LSSCollider.h')
-rw-r--r--libraries/ode-0.9/OPCODE/OPC_LSSCollider.h99
1 files changed, 99 insertions, 0 deletions
diff --git a/libraries/ode-0.9/OPCODE/OPC_LSSCollider.h b/libraries/ode-0.9/OPCODE/OPC_LSSCollider.h
new file mode 100644
index 0000000..b4d0893
--- /dev/null
+++ b/libraries/ode-0.9/OPCODE/OPC_LSSCollider.h
@@ -0,0 +1,99 @@
1///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2/*
3 * OPCODE - Optimized Collision Detection
4 * Copyright (C) 2001 Pierre Terdiman
5 * Homepage: http://www.codercorner.com/Opcode.htm
6 */
7///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
8
9///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
10/**
11 * Contains code for an LSS collider.
12 * \file OPC_LSSCollider.h
13 * \author Pierre Terdiman
14 * \date December, 28, 2002
15 */
16///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
17
18///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
19// Include Guard
20#ifndef __OPC_LSSCOLLIDER_H__
21#define __OPC_LSSCOLLIDER_H__
22
23 struct OPCODE_API LSSCache : VolumeCache
24 {
25 LSSCache()
26 {
27 Previous.mP0 = Point(0.0f, 0.0f, 0.0f);
28 Previous.mP1 = Point(0.0f, 0.0f, 0.0f);
29 Previous.mRadius = 0.0f;
30 FatCoeff = 1.1f;
31 }
32
33 // Cached faces signature
34 LSS Previous; //!< LSS used when performing the query resulting in cached faces
35 // User settings
36 float FatCoeff; //!< mRadius2 multiplier used to create a fat LSS
37 };
38
39 class OPCODE_API LSSCollider : public VolumeCollider
40 {
41 public:
42 // Constructor / Destructor
43 LSSCollider();
44 virtual ~LSSCollider();
45
46 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
47 /**
48 * Generic collision query for generic OPCODE models. After the call, access the results:
49 * - with GetContactStatus()
50 * - with GetNbTouchedPrimitives()
51 * - with GetTouchedPrimitives()
52 *
53 * \param cache [in/out] an lss cache
54 * \param lss [in] collision lss in local space
55 * \param model [in] Opcode model to collide with
56 * \param worldl [in] lss world matrix, or null
57 * \param worldm [in] model's world matrix, or null
58 * \return true if success
59 * \warning SCALE NOT SUPPORTED. The matrices must contain rotation & translation parts only.
60 */
61 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
62 bool Collide(LSSCache& cache, const LSS& lss, const Model& model, const Matrix4x4* worldl=null, const Matrix4x4* worldm=null);
63 //
64 bool Collide(LSSCache& cache, const LSS& lss, const AABBTree* tree);
65 protected:
66 // LSS in model space
67 Segment mSeg; //!< Segment
68 float mRadius2; //!< LSS radius squared
69 // Internal methods
70 void _Collide(const AABBCollisionNode* node);
71 void _Collide(const AABBNoLeafNode* node);
72 void _Collide(const AABBQuantizedNode* node);
73 void _Collide(const AABBQuantizedNoLeafNode* node);
74 void _Collide(const AABBTreeNode* node);
75 void _CollideNoPrimitiveTest(const AABBCollisionNode* node);
76 void _CollideNoPrimitiveTest(const AABBNoLeafNode* node);
77 void _CollideNoPrimitiveTest(const AABBQuantizedNode* node);
78 void _CollideNoPrimitiveTest(const AABBQuantizedNoLeafNode* node);
79 // Overlap tests
80 inline_ BOOL LSSContainsBox(const Point& bc, const Point& be);
81 inline_ BOOL LSSAABBOverlap(const Point& center, const Point& extents);
82 inline_ BOOL LSSTriOverlap(const Point& vert0, const Point& vert1, const Point& vert2);
83 // Init methods
84 BOOL InitQuery(LSSCache& cache, const LSS& lss, const Matrix4x4* worldl=null, const Matrix4x4* worldm=null);
85 };
86
87 class OPCODE_API HybridLSSCollider : public LSSCollider
88 {
89 public:
90 // Constructor / Destructor
91 HybridLSSCollider();
92 virtual ~HybridLSSCollider();
93
94 bool Collide(LSSCache& cache, const LSS& lss, const HybridModel& model, const Matrix4x4* worldl=null, const Matrix4x4* worldm=null);
95 protected:
96 Container mTouchedBoxes;
97 };
98
99#endif // __OPC_LSSCOLLIDER_H__