OPC_VolumeCollider.cpp
Go to the documentation of this file.
00001 
00002 /*
00003  *      OPCODE - Optimized Collision Detection
00004  *      Copyright (C) 2001 Pierre Terdiman
00005  *      Homepage: http://www.codercorner.com/Opcode.htm
00006  */
00008 
00010 
00016 
00017 
00019 
00027 
00028 
00030 // Precompiled Header
00031 #include "Stdafx.h"
00032 
00033 using namespace Opcode;
00034 
00036 
00039 
00040 VolumeCollider::VolumeCollider() :
00041         mTouchedPrimitives      (null),
00042         mNbVolumeBVTests        (0),
00043         mNbVolumePrimTests      (0)
00044 {
00045 }
00046 
00048 
00051 
00052 VolumeCollider::~VolumeCollider()
00053 {
00054         mTouchedPrimitives = null;
00055 }
00056 
00058 
00062 
00063 const char* VolumeCollider::ValidateSettings()
00064 {
00065         return null;
00066 }
00067 
00068 // Pretty dumb way to dump - to do better - one day...
00069 
00070 #define IMPLEMENT_NOLEAFDUMP(type)                                                                                              \
00071 void VolumeCollider::_Dump(const type* node)                                                                    \
00072 {                                                                                                                                                               \
00073         if(node->HasPosLeaf())  mTouchedPrimitives->Add(node->GetPosPrimitive());       \
00074         else                                    _Dump(node->GetPos());                                                          \
00075                                                                                                                                                                 \
00076         if(ContactFound()) return;                                                                                                      \
00077                                                                                                                                                                 \
00078         if(node->HasNegLeaf())  mTouchedPrimitives->Add(node->GetNegPrimitive());       \
00079         else                                    _Dump(node->GetNeg());                                                          \
00080 }
00081 
00082 #define IMPLEMENT_LEAFDUMP(type)                                                \
00083 void VolumeCollider::_Dump(const type* node)                    \
00084 {                                                                                                               \
00085         if(node->IsLeaf())                                                                      \
00086         {                                                                                                       \
00087                 mTouchedPrimitives->Add(node->GetPrimitive());  \
00088         }                                                                                                       \
00089         else                                                                                            \
00090         {                                                                                                       \
00091                 _Dump(node->GetPos());                                                  \
00092                                                                                                                 \
00093                 if(ContactFound()) return;                                              \
00094                                                                                                                 \
00095                 _Dump(node->GetNeg());                                                  \
00096         }                                                                                                       \
00097 }
00098 
00099 IMPLEMENT_NOLEAFDUMP(AABBNoLeafNode)
00100 IMPLEMENT_NOLEAFDUMP(AABBQuantizedNoLeafNode)
00101 
00102 IMPLEMENT_LEAFDUMP(AABBCollisionNode)
00103 IMPLEMENT_LEAFDUMP(AABBQuantizedNode)


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Thu Apr 11 2019 03:30:18