CollisionPairInserter.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
00003  * All rights reserved. This program is made available under the terms of the
00004  * Eclipse Public License v1.0 which accompanies this distribution, and is
00005  * available at http://www.eclipse.org/legal/epl-v10.html
00006  * Contributors:
00007  * National Institute of Advanced Industrial Science and Technology (AIST)
00008  * General Robotix Inc. 
00009  */
00010 
00011 #ifndef HRPCOLLISION_COLLISION_PAIR_INSERTER_H_INCLUDED
00012 #define HRPCOLLISION_COLLISION_PAIR_INSERTER_H_INCLUDED
00013 
00014 #include "CollisionPairInserterBase.h"
00015 
00016 namespace hrp {
00017 
00018     class CollisionPairInserter : public CollisionPairInserterBase
00019     {
00020       public:
00021         CollisionPairInserter();
00022         virtual ~CollisionPairInserter();
00023         virtual int detectTriTriOverlap(
00024             const Vector3& P1,
00025             const Vector3& P2,
00026             const Vector3& P3,
00027             const Vector3& Q1,
00028             const Vector3& Q2,
00029             const Vector3& Q3,
00030             collision_data* col_p);
00031 
00032         virtual int apply(const Opcode::AABBCollisionNode* b1,
00033                   const Opcode::AABBCollisionNode* b2,
00034                   int id1, int id2,
00035                   int num_of_i_points,
00036                   Vector3 i_points[4],
00037                   Vector3& n_vector,
00038                   double depth,
00039                   Vector3& n1,
00040                   Vector3& m1,
00041                   int ctype,
00042                   Opcode::MeshInterface* mesh1,
00043                   Opcode::MeshInterface* mesh2);
00044 
00045 
00046       private:
00047 
00048         class tri
00049         {
00050           public:
00051             int id;
00052             Vector3 p1, p2, p3;
00053         };
00054         
00055         class col_tri
00056         {
00057           public:
00058             int status; // 0: unvisited, 1: visited, 2: included in the convex neighbor 
00059             Vector3 p1, p2, p3;
00060             Vector3 n;
00061         };
00062 
00063         static void copy_tri(col_tri* t1, tri* t2);
00064         
00065         static void copy_tri(col_tri* t1, col_tri* t2);
00066         
00067         static void calc_normal_vector(col_tri* t);
00068         
00069         static int is_convex_neighbor(col_tri* t1, col_tri* t2);
00070         
00071         void triangleIndexToPoint(ColdetModelSharedDataSet* model, int id, col_tri& tri);
00072         
00073         int get_triangles_in_convex_neighbor(ColdetModelSharedDataSet* model, int id, col_tri* tri_convex_neighbor, int max_num);
00074         
00075         void get_triangles_in_convex_neighbor(ColdetModelSharedDataSet* model, int id, col_tri* tri_convex_neighbor, std::vector<int>& map, int& count);
00076         
00077         void examine_normal_vector(int id1, int id2, int ctype);
00078 
00079         void check_separability(int id1, int id2, int ctype);
00080 
00081         void find_signed_distance(
00082             Vector3 &signed_distance, col_tri *trp, int nth, int ctype, int obj);
00083 
00084         void find_signed_distance(
00085             Vector3& signed_distance, const Vector3& vert, int nth, int ctype, int obj);
00086 
00087         void find_signed_distance(Vector3& signed_distance1, ColdetModelSharedDataSet* model0, int id1, int contactIndex, int ctype, int obj);
00088 
00089         int new_point_test(int k);
00090     };
00091 }
00092 
00093 #endif


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:15