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 virtual ~CollisionPairInserterBase(){}
00034 void clear(){
00035 cdContact.clear();
00036 }
00037
00050 virtual int detectTriTriOverlap(
00051 const Vector3& P1,
00052 const Vector3& P2,
00053 const Vector3& P3,
00054 const Vector3& Q1,
00055 const Vector3& Q2,
00056 const Vector3& Q3,
00057 collision_data* col_p)=0;
00058
00077 virtual int apply(const Opcode::AABBCollisionNode* b1,
00078 const Opcode::AABBCollisionNode* b2,
00079 int id1, int id2,
00080 int num_of_i_points,
00081 Vector3 i_points[4],
00082 Vector3& n_vector,
00083 double depth,
00084 Vector3& n1,
00085 Vector3& m1,
00086 int ctype,
00087 Opcode::MeshInterface* mesh1,
00088 Opcode::MeshInterface* mesh2)=0;
00089
00094 std::vector<collision_data>& collisions() {
00095 return cdContact;
00096 }
00097
00098 void set(ColdetModelSharedDataSet* model0,
00099 ColdetModelSharedDataSet* model1){
00100 models[0] = model0;
00101 models[1] = model1;
00102 }
00103
00104 Matrix33 CD_Rot1;
00105 Vector3 CD_Trans1;
00106 double CD_s1;
00107
00108 Matrix33 CD_Rot2;
00109 Vector3 CD_Trans2;
00110 double CD_s2;
00111
00112 std::vector<collision_data> cdContact;
00113
00114 ColdetModelSharedDataSet *models[2];
00115 };
00116 }
00117 #endif