BALL  1.5.0
triangulatedSurface.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 
5 #ifndef BALL_STRUCTURE_TRIANGULATEDSURFACE_H
6 #define BALL_STRUCTURE_TRIANGULATEDSURFACE_H
7 
8 #ifndef BALL_STRUCTURE_TRIANGLE_H
10 #endif
11 
12 #ifndef BALL_STRUCTURE_TRIANGLEEDGE_H
14 #endif
15 
16 #ifndef BALL_STRUCTURE_TRIANGLEPOINT_H
18 #endif
19 
20 #ifndef BALL_MATHS_PLANE3_H
21 # include <BALL/MATHS/plane3.h>
22 #endif
23 
24 #ifndef BALL_MATHS_SURFACE_H
25 # include <BALL/MATHS/surface.h>
26 #endif
27 
28 #ifndef BALL_MATHS_VECTOR3_H
29 # include <BALL/MATHS/vector3.h>
30 #endif
31 
32 #include <list>
33 #include <vector>
34 
35 namespace BALL
36 {
41  {
42 
43  public:
44 
46 
47 
50 
51  typedef std::list<TrianglePoint*>::iterator
53  typedef std::list<TrianglePoint*>::const_iterator
55  typedef std::list<TriangleEdge*>::iterator
57  typedef std::list<TriangleEdge*>::const_iterator
59  typedef std::list<Triangle*>::iterator
61  typedef std::list<Triangle*>::const_iterator
63 
65 
68 
73  ;
74 
80  TriangulatedSurface(const TriangulatedSurface& surface, bool = true)
81  ;
82 
87  ;
89 
93 
103  static TriangulatedSurface* createTube(unsigned int num_vertices, unsigned int subdiv = 0, bool closed = false, bool out = true);
104 
112  static TriangulatedSurface* createDisk(unsigned int num_vertices, bool out = true);
114 
118 
121  void clear()
122  ;
123 
128  void set(const TriangulatedSurface& surface, bool = true)
129  ;
130 
134  TriangulatedSurface& operator = (const TriangulatedSurface& surface)
135  ;
136 
138 
142 
146  void insert(TrianglePoint* point);
147 
151  void insert(TriangleEdge* edge);
152 
156  void insert(Triangle* triangle);
157 
162 
166 
171 
177  void remove(TrianglePoint* point, bool deep = true);
178 
185  void remove(PointIterator p, bool deep = true);
186 
192  void remove(TriangleEdge* edge, bool deep = true);
193 
200  void remove(EdgeIterator e, bool deep = true);
201 
207  void remove(Triangle* triangle, bool deep = true);
208 
216  void remove(TriangleIterator t, bool deep = true);
217 
221  void exportSurface(Surface& surface);
222 
229  TriangulatedSurface& operator += (const TriangulatedSurface& surface);
230 
237  void join(TriangulatedSurface& source);
238 
243  void shift(const TVector3<double>& c);
244 
249  void blowUp(const double& r);
250 
253  void setIndices();
254 
257  void setDensity(const double& density);
258 
261  double getDensity() const;
262 
267  void cut(const TPlane3<double>& plane, const double& fuzzy = 0);
268 
271  void shrink();
272 
276 
280 
285  void getBorder(std::list<TriangleEdge*>& border);
286 
288 
291 
293 
295 
297 
299 
301 
303 
305 
307 
309 
311 
313 
315 
317  /*_ @name protected help functions
318  */
320 
321  protected:
322 
323  /*_ Test whether a TriangulatedSurface object can be copied
324  */
325  bool canBeCopied() const;
326 
327  /*_ Copy a TriangulatedSurface object
328  */
329  void copy(const TriangulatedSurface& surface);
330 
332 
333  protected:
334 
335  /*_ @name Attributes
336  */
338 
339  /*_ the number of points of the triangulated surface
340  */
342  /*_ the points of the surface.
343  */
344  std::list<TrianglePoint*> points_;
345  /*_ the number of edges of the triangulated surface
346  */
348  /*_ the edges of the surface.
349  */
350  std::list<TriangleEdge*> edges_;
351  /*_ the number of triangles of the triangulated surface
352  */
354  /*_ the triangles of the surface.
355  */
356  std::list<Triangle*> triangles_;
357 
358  /*_ the density used by triangulation algorithms
359  */
360  double density_;
361 
363 
364  };
365 
370 
373  BALL_EXPORT std::ostream& operator << (std::ostream& s,
374  const TriangulatedSurface& surface);
375 
377 
378 
379 
380 
388  {
389 
390  public:
391 
393 
394  struct Face
395  {
400  };
401 
405 
410  ;
411 
417  TriangulatedSphere(const TriangulatedSphere& sphere, bool = true)
418  ;
419 
424  ;
426 
430 
435  void set(const TriangulatedSphere& sphere, bool = true)
436  ;
437 
441  TriangulatedSphere& operator = (const TriangulatedSphere& sphere)
442  ;
443 
445 
449 
456  void icosaeder(bool out = true);
457 
464  void pentakisDodecaeder(bool out = true);
465 
471  void refine(Position iterations, bool out = true);
472 
473 
474  private:
475 
476  /*_ Refine a triangulated sphere once.
477  */
478  void refine(bool out);
479 
480  void buildFourTriangles
481  (Face face,
482  Triangle* face0,
483  Triangle* face1,
484  Triangle* face2,
485  Triangle* face3)
486  ;
487 
488  /*_ Set the incidences of a refined triangulated sphere.
489  */
490  void setIncidences();
491 
493 
494  };
495 
496 } // namespace BALL
497 
498 
499 #endif // BALL_STRUCTURE_TRIANGULATEDSURFACE_H
500 
501 
#define BALL_CREATE(name)
Definition: create.h:62
BALL_EXPORT std::ostream & operator<<(std::ostream &os, const Exception::GeneralException &e)
Definition: constants.h:13
BALL_EXTERN_VARIABLE const double c
Definition: constants.h:149
Size getNumberOfTriangles() const
void exportSurface(Surface &surface)
static TriangulatedSurface * createTube(unsigned int num_vertices, unsigned int subdiv=0, bool closed=false, bool out=true)
std::list< Triangle * > triangles_
std::list< Triangle * >::const_iterator ConstTriangleIterator
void remove(TriangleEdge *edge, bool deep=true)
void blowUp(const double &r)
std::list< TrianglePoint * >::const_iterator ConstPointIterator
void shift(const TVector3< double > &c)
void getBorder(std::list< TriangleEdge * > &border)
void remove(TriangleIterator t, bool deep=true)
void copy(const TriangulatedSurface &surface)
void join(TriangulatedSurface &source)
ConstTriangleIterator beginTriangle() const
std::list< TriangleEdge * >::iterator EdgeIterator
void setDensity(const double &density)
ConstPointIterator endPoint() const
void set(const TriangulatedSurface &surface, bool=true)
std::list< TrianglePoint * >::iterator PointIterator
std::list< TriangleEdge * >::const_iterator ConstEdgeIterator
ConstEdgeIterator endEdge() const
Size getNumberOfEdges() const
void insert(Triangle *triangle)
TriangleIterator beginTriangle()
static TriangulatedSurface * createDisk(unsigned int num_vertices, bool out=true)
void insert(TrianglePoint *point)
void insert(TriangleEdge *edge)
void remove(PointIterator p, bool deep=true)
PointIterator beginPoint()
void cut(const TPlane3< double > &plane, const double &fuzzy=0)
ConstPointIterator beginPoint() const
std::list< Triangle * >::iterator TriangleIterator
std::list< TriangleEdge * > edges_
TriangleIterator endTriangle()
double getDensity() const
TriangulatedSurface(const TriangulatedSurface &surface, bool=true)
void remove(TrianglePoint *point, bool deep=true)
void remove(Triangle *triangle, bool deep=true)
ConstTriangleIterator endTriangle() const
EdgeIterator beginEdge()
PointIterator endPoint()
std::list< TrianglePoint * > points_
ConstEdgeIterator beginEdge() const
Size getNumberOfPoints() const
void remove(EdgeIterator e, bool deep=true)
TriangulatedSphere(const TriangulatedSphere &sphere, bool=true)
void refine(Position iterations, bool out=true)
void icosaeder(bool out=true)
void set(const TriangulatedSphere &sphere, bool=true)
void pentakisDodecaeder(bool out=true)
#define BALL_EXPORT
Definition: COMMON/global.h:50