ColdetModelSharedDataSet.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
3  * All rights reserved. This program is made available under the terms of the
4  * Eclipse Public License v1.0 which accompanies this distribution, and is
5  * available at http://www.eclipse.org/legal/epl-v10.html
6  * Contributors:
7  * National Institute of Advanced Industrial Science and Technology (AIST)
8  */
13 #ifndef OPENHRP_COLDET_MODEL_SHARED_DATA_SET_H_INCLUDED
14 #define OPENHRP_COLDET_MODEL_SHARED_DATA_SET_H_INCLUDED
15 
16 
17 #include "ColdetModel.h"
18 #include "Opcode/Opcode.h"
19 #include <vector>
20 
21 using namespace std;
22 using namespace hrp;
23 
24 namespace hrp {
25  struct triangle3 {
26  int triangles[3];
27  };
28 
30  {
31  public:
33  int triangles[3];
35  triangles[0] = triangles[1] = triangles[2] = -1;
36  }
37  void addNeighbor(int neighbor){
38  for(int i=0; i < 3; ++i){
39  if(triangles[i] < 0){
40  triangles[i] = neighbor;
41  break;
42  }
43  }
44  }
45  void deleteNeighbor(int neighbor){
46  for(int i=0; i<3; i++){
47  if(triangles[i]==neighbor){
48  for(int j=i+1; j<3; j++){
49  triangles[j-1] = triangles[j];
50  }
51  triangles[2] = -1;
52  }
53  break;
54  }
55  }
56  int operator[](int index) const { return triangles[index]; }
57  };
58 
59  typedef std::vector<NeighborTriangleSet> NeighborTriangleSetArray;
60 
62 
63  bool build();
64 
65  // need two instances ?
66  Opcode::Model model;
67 
68  Opcode::MeshInterface iMesh;
69 
70  vector<IceMaths::Point> vertices;
71  vector<IceMaths::IndexedTriangle> triangles;
72 
74  std::vector<float> pParams;
75 
77 
79  return AABBTreeMaxDepth;
80  };
81  int getNumofBB(int depth){
82  return numBBMap.at(depth);
83  };
85  if(AABBTreeMaxDepth>0)
86  return numBBMap.at(AABBTreeMaxDepth-1);
87  else
88  return 0;
89  };
90 
91  private:
92  int refCounter;
94  std::vector<int> numBBMap;
95  std::vector<int> numLeafMap;
96  int computeDepth(const Opcode::AABBCollisionNode* node, int currentDepth, int max );
97 
98  friend class ColdetModel;
99  };
100 }
101 
102 #endif
hrp::ColdetModelSharedDataSet::NeighborTriangleSet
Definition: ColdetModelSharedDataSet.h:32
i
png_uint_32 i
Definition: png.h:2732
hrp::ColdetModel
Definition: ColdetModel.h:61
Opcode.h
hrp::triangle3
Definition: ColdetModelSharedDataSet.h:25
hrp::ColdetModelSharedDataSet::pType
ColdetModel::PrimitiveType pType
Definition: ColdetModelSharedDataSet.h:73
hrp::ColdetModelSharedDataSet::model
Opcode::Model model
Definition: ColdetModelSharedDataSet.h:66
hrp::ColdetModelSharedDataSet::numBBMap
std::vector< int > numBBMap
Definition: ColdetModelSharedDataSet.h:94
hrp::ColdetModelSharedDataSet::vertices
vector< IceMaths::Point > vertices
Definition: ColdetModelSharedDataSet.h:70
hrp
Definition: ColdetModel.h:28
hrp::ColdetModelSharedDataSet::AABBTreeMaxDepth
int AABBTreeMaxDepth
Definition: ColdetModelSharedDataSet.h:93
hrp::max
static int max(int a, int b)
Definition: MatrixSolvers.cpp:54
hrp::ColdetModelSharedDataSet::numLeafMap
std::vector< int > numLeafMap
Definition: ColdetModelSharedDataSet.h:95
hrp::ColdetModelSharedDataSet::NeighborTriangleSet::deleteNeighbor
void deleteNeighbor(int neighbor)
Definition: ColdetModelSharedDataSet.h:45
hrp::ColdetModelSharedDataSet::iMesh
Opcode::MeshInterface iMesh
Definition: ColdetModelSharedDataSet.h:68
hrp::ColdetModelSharedDataSet::NeighborTriangleSet::NeighborTriangleSet
NeighborTriangleSet()
Definition: ColdetModelSharedDataSet.h:34
hrp::ColdetModelSharedDataSet
Definition: ColdetModelSharedDataSet.h:29
hrp::ColdetModelSharedDataSet::triangles
vector< IceMaths::IndexedTriangle > triangles
Definition: ColdetModelSharedDataSet.h:71
hrp::ColdetModelSharedDataSet::NeighborTriangleSetArray
std::vector< NeighborTriangleSet > NeighborTriangleSetArray
Definition: ColdetModelSharedDataSet.h:59
ColdetModel.h
hrp::ColdetModelSharedDataSet::neighbor
NeighborTriangleSetArray neighbor
Definition: ColdetModelSharedDataSet.h:76
hrp::ColdetModelSharedDataSet::getNumofBB
int getNumofBB(int depth)
Definition: ColdetModelSharedDataSet.h:81
hrp::ColdetModelSharedDataSet::getAABBTreeDepth
int getAABBTreeDepth()
Definition: ColdetModelSharedDataSet.h:78
hrp::ColdetModelSharedDataSet::pParams
std::vector< float > pParams
Definition: ColdetModelSharedDataSet.h:74
hrp::ColdetModelSharedDataSet::NeighborTriangleSet::operator[]
int operator[](int index) const
Definition: ColdetModelSharedDataSet.h:56
hrp::ColdetModel::PrimitiveType
PrimitiveType
Definition: ColdetModel.h:64
hrp::ColdetModelSharedDataSet::NeighborTriangleSet::addNeighbor
void addNeighbor(int neighbor)
Definition: ColdetModelSharedDataSet.h:37
hrp::ColdetModelSharedDataSet::getmaxNumofBB
int getmaxNumofBB()
Definition: ColdetModelSharedDataSet.h:84


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Wed Sep 7 2022 02:51:02