Polyhedron_algorithms.h
Go to the documentation of this file.
1 #pragma once
2 
3 #ifndef _POLYHEDRON_ALGORITHMS
4 # define _POLYHEDRON_ALGORITHMS
5 
6 # include <sch/Matrix/SCH_Types.h>
8 # include <string>
9 # include <vector>
10 namespace sch
11 {
13 {
14  unsigned int a, b, c;
16 
17 public:
18  template<class Archive>
19  void serialize(Archive & ar, const unsigned int /*version*/)
20  {
21  ar & a;
22  ar & b;
23  ar & c;
24  ar & normal;
25  }
26 };
27 
29 {
30  size_t a, b;
32 
33 public:
34  template<class Archive>
35  void serialize(Archive & ar, const unsigned int /*version*/)
36  {
37  ar & a;
38  ar & b;
39  ar & edge;
40  }
41  void computeEdge(const std::vector<S_PolyhedronVertex *> & v)
42  {
43  const Vector3 & p1 = v[a]->getCoordinates();
44  const Vector3 & p2 = v[b]->getCoordinates();
45  edge = p1 - p2;
46  }
47 };
48 
50 {
51 public:
54 
56 
58 
63 
64  SCH_API Point3 naiveSupport(const Vector3 & v) const;
65 
71 
75  SCH_API void clearNeighbors();
76 
80  SCH_API void clear();
81 
86 
91  SCH_API Point3 support(const Vector3 & v, int & lastFeature) const;
92 
98  SCH_API void openFromFile(const std::string & filename);
99 
104  SCH_API void fillEdges();
105 
111 
112  template<class Archive>
113  void serialize(Archive & ar, const unsigned int /*version*/)
114  {
115  ar & vertexes_;
116  ar & triangles_;
117  // ar & fastVertexes_;
118  // ar & lastVertexes_;
119  }
120 
121  std::vector<S_PolyhedronVertex *> vertexes_;
122 
123  std::vector<PolyhedronTriangle> triangles_;
124  std::vector<PolyhedronEdge> edges_;
125 
129 };
130 } // namespace sch
131 
132 #endif
sch::Polyhedron_algorithms::~Polyhedron_algorithms
SCH_API ~Polyhedron_algorithms(void)
sch::PolyhedronEdge
Definition: Polyhedron_algorithms.h:28
sch
Definition: CD_Pair.h:11
sch::PolyhedronEdge::edge
Vector3 edge
Definition: Polyhedron_algorithms.h:31
sch::PolyhedronEdge::b
size_t b
Definition: Polyhedron_algorithms.h:30
sch::Polyhedron_algorithms::edges_
std::vector< PolyhedronEdge > edges_
Definition: Polyhedron_algorithms.h:124
sch::Polyhedron_algorithms::fastVertexes_
S_PolyhedronVertex ** fastVertexes_
Definition: Polyhedron_algorithms.h:126
SCH_API
#define SCH_API
Definition: sch_api.h:13
sch::Polyhedron_algorithms::fillEdges
SCH_API void fillEdges()
Fill the edges_ variable using the data from the polyhedron.
sch::Polyhedron_algorithms::clearNeighbors
SCH_API void clearNeighbors()
clears the neighbors tables;
S_PolyhedronVertex.h
sch::PolyhedronTriangle::c
unsigned int c
Definition: Polyhedron_algorithms.h:14
sch::PolyhedronEdge::serialize
void serialize(Archive &ar, const unsigned int)
Definition: Polyhedron_algorithms.h:35
SCH_Types.h
sch::Polyhedron_algorithms::serialize
void serialize(Archive &ar, const unsigned int)
Definition: Polyhedron_algorithms.h:113
sch::Polyhedron_algorithms::triangles_
std::vector< PolyhedronTriangle > triangles_
Definition: Polyhedron_algorithms.h:123
sch::Polyhedron_algorithms::deleteVertexesWithoutNeighbors
SCH_API void deleteVertexesWithoutNeighbors()
deletes aal the vertexes that dont have neighbors;
sch::PolyhedronEdge::computeEdge
void computeEdge(const std::vector< S_PolyhedronVertex * > &v)
Definition: Polyhedron_algorithms.h:41
sch::Polyhedron_algorithms::updateVertexNeighbors
SCH_API void updateVertexNeighbors()
updates the Neighborhood of the vertexes, must be called on polyhedron \which vertexes have no neighb...
sch::Polyhedron_algorithms::getEdgeKey
SCH_API size_t getEdgeKey(PolyhedronEdge e)
get the key of an edge computed automatically from its vertices
sch::Polyhedron_algorithms::Polyhedron_algorithms
SCH_API Polyhedron_algorithms(void)
sch::PolyhedronTriangle::b
unsigned int b
Definition: Polyhedron_algorithms.h:14
sch::PolyhedronEdge::a
size_t a
Definition: Polyhedron_algorithms.h:30
sch::Polyhedron_algorithms::lastVertexes_
S_PolyhedronVertex ** lastVertexes_
Definition: Polyhedron_algorithms.h:127
sch::Polyhedron_algorithms::naiveSupport
SCH_API Point3 naiveSupport(const Vector3 &v) const
sch::S_PolyhedronVertex
Definition: S_PolyhedronVertex.h:14
sch::Polyhedron_algorithms::clear
SCH_API void clear()
clears all the polyhedron;
sch::Polyhedron_algorithms::numberOfVertices_
unsigned numberOfVertices_
Definition: Polyhedron_algorithms.h:128
sch::Polyhedron_algorithms::support
SCH_API Point3 support(const Vector3 &v, int &lastFeature) const
Computes the support point of the polyhedron.
sch::Polyhedron_algorithms::operator=
const SCH_API Polyhedron_algorithms & operator=(const Polyhedron_algorithms &)
sch::PolyhedronTriangle::a
unsigned int a
Definition: Polyhedron_algorithms.h:14
sch::Polyhedron_algorithms::openFromFile
SCH_API void openFromFile(const std::string &filename)
loads the polyhedron from a file. the file must be in the format of Qhull conconvex....
CD_Matrix::Vector3T< Scalar, false >
sch::PolyhedronTriangle::normal
Vector3 normal
Definition: Polyhedron_algorithms.h:15
sch::PolyhedronTriangle::serialize
void serialize(Archive &ar, const unsigned int)
Definition: Polyhedron_algorithms.h:19
sch::Polyhedron_algorithms::updateFastArrays
SCH_API void updateFastArrays()
updates the fast access arrays, must be called after each polyhedron modification
sch::PolyhedronTriangle
Definition: Polyhedron_algorithms.h:12
sch::Polyhedron_algorithms
Definition: Polyhedron_algorithms.h:49
sch::Polyhedron_algorithms::vertexes_
std::vector< S_PolyhedronVertex * > vertexes_
Definition: Polyhedron_algorithms.h:121