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       private:
00046 
00047         class tri
00048         {
00049           public:
00050             int id;
00051             Vector3 p1, p2, p3;
00052         };
00053         
00054         class col_tri
00055         {
00056           public:
00057             int status; // 0: unvisited, 1: visited, 2: included in the convex neighbor 
00058             Vector3 p1, p2, p3;
00059             Vector3 n;
00060         };
00061 
00062         static void copy_tri(col_tri* t1, tri* t2);
00063         
00064         static void copy_tri(col_tri* t1, col_tri* t2);
00065         
00066         static void calc_normal_vector(col_tri* t);
00067         
00068         static int is_convex_neighbor(col_tri* t1, col_tri* t2);
00069         
00070         void triangleIndexToPoint(ColdetModelSharedDataSet* model, int id, col_tri& tri);
00071         
00072         int get_triangles_in_convex_neighbor(ColdetModelSharedDataSet* model, int id, col_tri* tri_convex_neighbor, int max_num);
00073         
00074         void get_triangles_in_convex_neighbor(ColdetModelSharedDataSet* model, int id, col_tri* tri_convex_neighbor, std::vector<int>& map, int& count);
00075         
00076         void examine_normal_vector(int id1, int id2, int ctype);
00077 
00078         void check_separability(int id1, int id2, int ctype);
00079 
00080         void find_signed_distance(
00081             Vector3 &signed_distance, col_tri *trp, int nth, int ctype, int obj);
00082 
00083         void find_signed_distance(
00084             Vector3& signed_distance, const Vector3& vert, int nth, int ctype, int obj);
00085 
00086         void find_signed_distance(Vector3& signed_distance1, ColdetModelSharedDataSet* model0, int id1, int contactIndex, int ctype, int obj);
00087 
00088         int new_point_test(int k);
00089     };
00090 }
00091 
00092 #endif


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sun Apr 2 2017 03:43:53