2 #ifndef CNOID_COLLISION_COLLISION_PAIR_INSERTER_H_INCLUDED
3 #define CNOID_COLLISION_COLLISION_PAIR_INSERTER_H_INCLUDED
10 class AABBCollisionNode;
35 int apply(
const Opcode::AABBCollisionNode* b1,
36 const Opcode::AABBCollisionNode* b2,
45 Opcode::MeshInterface* mesh1,
46 Opcode::MeshInterface* mesh2);
79 static void copy_tri(col_tri* t1, tri* t2);
81 static void copy_tri(col_tri* t1, col_tri* t2);
83 static void calc_normal_vector(col_tri* t);
85 static int is_convex_neighbor(col_tri* t1, col_tri* t2);
89 static int is_neighboring_triangle(col_tri* t1, col_tri* t2);
91 static void get_neighboring_triangles(
92 col_tri* tri_convex_neighbor, col_tri* tri_neighbor,
93 int* start_tri,
int* end_tri,
int num_tri);
95 static int get_triangles_in_convex_neighbor(
96 tri* root, col_tri* tri_convex_neighbor, col_tri* tri_neighbor,
97 int num_tri,
int max_num);
99 static int get_triangles_in_convex_neighbor(
100 tri* root, col_tri* tri_convex_neighbor, col_tri* tri_neighbor,
int num_tri);
102 static void get_triangles_in_neighbor(
103 col_tri* neighbor_tris,
105 const Opcode::AABBCollisionNode* root,
106 Opcode::MeshInterface* mesh);
108 static int count_num_of_triangles(
const Opcode::AABBCollisionNode* root);
110 void examine_normal_vector(
111 const Opcode::AABBCollisionNode* b1,
112 const Opcode::AABBCollisionNode* b2,
114 Opcode::MeshInterface* mesh1,
115 Opcode::MeshInterface* mesh2);
117 void check_separability(
118 const Opcode::AABBCollisionNode* b1,
119 const Opcode::AABBCollisionNode* root1,
int num_tri1,
120 const Opcode::AABBCollisionNode* b2,
121 const Opcode::AABBCollisionNode* root2,
int num_tri2,
123 Opcode::MeshInterface* mesh1, Opcode::MeshInterface* mesh2);
125 void find_signed_distance(
126 Vector3 &signed_distance, col_tri *trp,
int nth,
int ctype,
int obj);
128 void find_signed_distance(
129 Vector3& signed_distance,
const Vector3& vert,
int nth,
int ctype,
int obj);
131 void find_signed_distance(
133 const Opcode::AABBCollisionNode* b1,
134 const Opcode::AABBCollisionNode* root,
139 Opcode::MeshInterface* mesh);
141 int new_point_test(
int k);