Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef HRPCOLLISION_COLLISION_PAIR_INSERTER_BASE_H_INCLUDED
00012 #define HRPCOLLISION_COLLISION_PAIR_INSERTER_BASE_H_INCLUDED
00013
00014 #include "CollisionData.h"
00015 #include <boost/intrusive_ptr.hpp>
00016 #include <vector>
00017
00018 namespace Opcode {
00019
00020 class AABBCollisionNode;
00021 class MeshInterface;
00022 }
00023
00024 namespace hrp {
00025 class ColdetModelSharedDataSet;
00026
00027 class CollisionPairInserterBase
00028 {
00029 public:
00030 CollisionPairInserterBase() : normalVectorCorrection(true) {}
00031 virtual ~CollisionPairInserterBase(){}
00035 void clear(){
00036 cdContact.clear();
00037 }
00038
00051 virtual int detectTriTriOverlap(
00052 const Vector3& P1,
00053 const Vector3& P2,
00054 const Vector3& P3,
00055 const Vector3& Q1,
00056 const Vector3& Q2,
00057 const Vector3& Q3,
00058 collision_data* col_p)=0;
00059
00078 virtual int apply(const Opcode::AABBCollisionNode* b1,
00079 const Opcode::AABBCollisionNode* b2,
00080 int id1, int id2,
00081 int num_of_i_points,
00082 Vector3 i_points[4],
00083 Vector3& n_vector,
00084 double depth,
00085 Vector3& n1,
00086 Vector3& m1,
00087 int ctype,
00088 Opcode::MeshInterface* mesh1,
00089 Opcode::MeshInterface* mesh2)=0;
00090
00095 std::vector<collision_data>& collisions() {
00096 return cdContact;
00097 }
00098
00099 void set(ColdetModelSharedDataSet* model0,
00100 ColdetModelSharedDataSet* model1){
00101 models[0] = model0;
00102 models[1] = model1;
00103 }
00104
00105 Matrix33 CD_Rot1;
00106 Vector3 CD_Trans1;
00107 double CD_s1;
00108
00109 Matrix33 CD_Rot2;
00110 Vector3 CD_Trans2;
00111 double CD_s2;
00112
00113 std::vector<collision_data> cdContact;
00114
00115 ColdetModelSharedDataSet *models[2];
00116
00118 bool normalVectorCorrection;
00119 };
00120 }
00121 #endif