Triangulator.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  */
9 
14 #ifndef HRPUTIL_TRIANGULATOR_H_INCLUDED
15 #define HRPUTIL_TRIANGULATOR_H_INCLUDED
16 
17 #include <vector>
18 #include <boost/dynamic_bitset.hpp>
19 #include <hrpUtil/Eigen3d.h>
20 #include "VrmlNodes.h"
21 
22 namespace hrp {
23 
25  {
26  public:
27 
28  void setVertices(const MFVec3f& vertices) {
29  this->vertices = &vertices;
30  }
31 
35  int apply(const std::vector<int>& polygon);
36 
42  const std::vector<int>& triangles() {
43  return triangles_;
44  }
45 
46  private:
47 
49 
50  const MFVec3f* vertices;
51  const std::vector<int>* orgPolygon;
52  std::vector<int> triangles_;
53  std::vector<int> workPolygon;
54  Vector3 ccs; // cyclic cross sum
55  boost::dynamic_bitset<> earMask;
56 
57  Vector3Ref vertex(int localIndex){
58  return getVector3Ref((*vertices)[(*orgPolygon)[localIndex]].data());
59  }
60 
61  Vector3Ref workVertex(int workPolygonIndex){
62  return getVector3Ref((*vertices)[(*orgPolygon)[workPolygon[workPolygonIndex]]].data());
63  }
64 
65  Convexity calcConvexity(int ear);
66  bool checkIfEarContainsOtherVertices(int ear);
67  };
68 
69 }
70 
71 #endif
const MFVec3f * vertices
Definition: Triangulator.h:50
std::vector< int > workPolygon
Definition: Triangulator.h:53
Vector3Ref getVector3Ref(const double *data)
Definition: Eigen3d.h:20
Eigen::Vector3d Vector3Ref
Definition: Eigen3d.h:19
Eigen::Vector3d Vector3
Definition: EigenTypes.h:11
boost::dynamic_bitset earMask
Definition: Triangulator.h:55
Vector3Ref workVertex(int workPolygonIndex)
Definition: Triangulator.h:61
std::vector< SFVec3f > MFVec3f
Definition: VrmlNodes.h:72
void setVertices(const MFVec3f &vertices)
Definition: Triangulator.h:28
Vector3Ref vertex(int localIndex)
Definition: Triangulator.h:57
const std::vector< int > & triangles()
Definition: Triangulator.h:42
int apply(const std::vector< int > &polygon)
bool checkIfEarContainsOtherVertices(int ear)
const std::vector< int > * orgPolygon
Definition: Triangulator.h:51
JSAMPIMAGE data
Definition: jpeglib.h:945
Convexity calcConvexity(int ear)
std::vector< int > triangles_
Definition: Triangulator.h:52


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Thu Sep 8 2022 02:24:05