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 
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 
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
Definition: S_PolyhedronVertex.h:15
Definition: CD_Pair.h:12
#define SCH_API
Definition: sch_api.h:13
Definition: Polyhedron_algorithms.h:29
size_t a
Definition: Polyhedron_algorithms.h:30
Vector3 edge
Definition: Polyhedron_algorithms.h:31
void computeEdge(const std::vector< S_PolyhedronVertex * > &v)
Definition: Polyhedron_algorithms.h:41
size_t b
Definition: Polyhedron_algorithms.h:30
void serialize(Archive &ar, const unsigned int)
Definition: Polyhedron_algorithms.h:35
Definition: Polyhedron_algorithms.h:13
unsigned int b
Definition: Polyhedron_algorithms.h:14
unsigned int a
Definition: Polyhedron_algorithms.h:14
unsigned int c
Definition: Polyhedron_algorithms.h:14
void serialize(Archive &ar, const unsigned int)
Definition: Polyhedron_algorithms.h:19
Vector3 normal
Definition: Polyhedron_algorithms.h:15
Definition: Polyhedron_algorithms.h:50
SCH_API void deleteVertexesWithoutNeighbors()
deletes aal the vertexes that dont have neighbors;
SCH_API void updateFastArrays()
updates the fast access arrays, must be called after each polyhedron modification
S_PolyhedronVertex ** fastVertexes_
Definition: Polyhedron_algorithms.h:126
SCH_API void fillEdges()
Fill the edges_ variable using the data from the polyhedron.
unsigned numberOfVertices_
Definition: Polyhedron_algorithms.h:128
SCH_API Polyhedron_algorithms(void)
SCH_API Point3 support(const Vector3 &v, int &lastFeature) const
Computes the support point of the polyhedron.
SCH_API void clearNeighbors()
clears the neighbors tables;
SCH_API size_t getEdgeKey(PolyhedronEdge e)
get the key of an edge computed automatically from its vertices
S_PolyhedronVertex ** lastVertexes_
Definition: Polyhedron_algorithms.h:127
std::vector< S_PolyhedronVertex * > vertexes_
Definition: Polyhedron_algorithms.h:121
SCH_API void openFromFile(const std::string &filename)
loads the polyhedron from a file. the file must be in the format of Qhull conconvex....
SCH_API ~Polyhedron_algorithms(void)
std::vector< PolyhedronTriangle > triangles_
Definition: Polyhedron_algorithms.h:123
SCH_API Polyhedron_algorithms(const Polyhedron_algorithms &)
SCH_API void clear()
clears all the polyhedron;
SCH_API Point3 naiveSupport(const Vector3 &v) const
SCH_API void updateVertexNeighbors()
updates the Neighborhood of the vertexes, must be called on polyhedron \which vertexes have no neighb...
std::vector< PolyhedronEdge > edges_
Definition: Polyhedron_algorithms.h:124
SCH_API const Polyhedron_algorithms & operator=(const Polyhedron_algorithms &)
void serialize(Archive &ar, const unsigned int)
Definition: Polyhedron_algorithms.h:113