Choreonoid  1.8
StdCollisionPairInserter.h
Go to the documentation of this file.
1 
2 #ifndef CNOID_AIST_COLLISION_DETECTOR_STD_COLLISION_PAIR_INSERTER_H
3 #define CNOID_AIST_COLLISION_DETECTOR_STD_COLLISION_PAIR_INSERTER_H
4 
6 
7 namespace Opcode {
8 
9 class StdCollisionPairInserter : public CollisionPairInserter
10 {
11 public:
12  StdCollisionPairInserter();
13  virtual ~StdCollisionPairInserter();
14  virtual int detectTriTriOverlap(
15  const cnoid::Vector3& P1,
16  const cnoid::Vector3& P2,
17  const cnoid::Vector3& P3,
18  const cnoid::Vector3& Q1,
19  const cnoid::Vector3& Q2,
20  const cnoid::Vector3& Q3,
21  cnoid::collision_data* col_p);
22 
23  virtual int apply(const Opcode::AABBCollisionNode* b1,
24  const Opcode::AABBCollisionNode* b2,
25  int id1, int id2,
26  int num_of_i_points,
27  cnoid::Vector3 i_points[4],
28  cnoid::Vector3& n_vector,
29  double depth,
30  cnoid::Vector3& n1,
31  cnoid::Vector3& m1,
32  int ctype,
33  Opcode::MeshInterface* mesh1,
34  Opcode::MeshInterface* mesh2);
35 
36 private:
37 
38  class tri
39  {
40  public:
41  int id;
42  cnoid::Vector3 p1, p2, p3;
43  };
44 
45  class col_tri
46  {
47  public:
48  int status; // 0: unvisited, 1: visited, 2: included in the convex neighbor
49  cnoid::Vector3 p1, p2, p3;
51  };
52 
53  static void copy_tri(col_tri* t1, tri* t2);
54 
55  static void copy_tri(col_tri* t1, col_tri* t2);
56 
57  static void calc_normal_vector(col_tri* t);
58 
59  static int is_convex_neighbor(col_tri* t1, col_tri* t2);
60 
61  void triangleIndexToPoint(cnoid::ColdetModelInternalModel* model, int id, col_tri& tri);
62 
63  int get_triangles_in_convex_neighbor(cnoid::ColdetModelInternalModel* model, int id, col_tri* tri_convex_neighbor, int max_num);
64 
65  void get_triangles_in_convex_neighbor(cnoid::ColdetModelInternalModel* model, int id, col_tri* tri_convex_neighbor, std::vector<int>& map, int& count);
66 
67  void examine_normal_vector(int id1, int id2, int ctype);
68 
69  void check_separability(int id1, int id2, int ctype);
70 
71  void find_signed_distance(
72  cnoid::Vector3 &signed_distance, col_tri *trp, int nth, int ctype, int obj);
73 
74  void find_signed_distance(
75  cnoid::Vector3& signed_distance, const cnoid::Vector3& vert, int nth, int ctype, int obj);
76 
77  void find_signed_distance(cnoid::Vector3& signed_distance1, cnoid::ColdetModelInternalModel* model0, int id1, int contactIndex, int ctype, int obj);
78 
79  int new_point_test(int k);
80 };
81 
82 }
83 
84 #endif
cnoid::Vector3
Eigen::Vector3d Vector3
Definition: EigenTypes.h:57
cnoid::ColdetModelInternalModel
Definition: ColdetModelInternalModel.h:14
cnoid::collision_data
Definition: CollisionData.h:16
CollisionPairInserter.h