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 
BALL::TrianglePoint
Definition: trianglePoint.h:43
BALL_EXPORT
#define BALL_EXPORT
Definition: COMMON/global.h:50
BALL::TriangulatedSurface::number_of_points_
Size number_of_points_
Definition: triangulatedSurface.h:341
BALL::TriangulatedSurface::points_
std::list< TrianglePoint * > points_
Definition: triangulatedSurface.h:344
BALL::TriangulatedSurface::beginPoint
PointIterator beginPoint()
BALL::TriangulatedSurface::copy
void copy(const TriangulatedSurface &surface)
plane3.h
BALL::TriangulatedSurface::insert
void insert(TriangleEdge *edge)
BALL::TriangulatedSurface::remove
void remove(Triangle *triangle, bool deep=true)
BALL::TPlane3
Definition: plane3.h:53
BALL::TriangulatedSurface::ConstTriangleIterator
std::list< Triangle * >::const_iterator ConstTriangleIterator
Definition: triangulatedSurface.h:62
BALL::TriangulatedSurface::insert
void insert(Triangle *triangle)
BALL::TriangulatedSurface::getNumberOfPoints
Size getNumberOfPoints() const
BALL::TriangulatedSphere::Face::pcount
Position pcount
Definition: triangulatedSurface.h:398
BALL::TriangulatedSurface::beginTriangle
ConstTriangleIterator beginTriangle() const
vector3.h
BALL::TriangulatedSurface::TriangleIterator
std::list< Triangle * >::iterator TriangleIterator
Definition: triangulatedSurface.h:60
BALL::TriangulatedSurface::set
void set(const TriangulatedSurface &surface, bool=true)
BALL::TriangulatedSurface::remove
void remove(TriangleEdge *edge, bool deep=true)
BALL::TriangulatedSurface::PointIterator
std::list< TrianglePoint * >::iterator PointIterator
Definition: triangulatedSurface.h:52
BALL::TriangulatedSurface::beginEdge
ConstEdgeIterator beginEdge() const
BALL::TriangulatedSurface::~TriangulatedSurface
virtual ~TriangulatedSurface()
BALL::TriangulatedSurface::ConstPointIterator
std::list< TrianglePoint * >::const_iterator ConstPointIterator
Definition: triangulatedSurface.h:54
BALL::TriangulatedSphere
Definition: triangulatedSurface.h:388
BALL::TriangulatedSphere::icosaeder
void icosaeder(bool out=true)
BALL::TriangulatedSurface::endEdge
EdgeIterator endEdge()
BALL::TriangulatedSurface::shift
void shift(const TVector3< double > &c)
BALL::TriangulatedSurface::endTriangle
TriangleIterator endTriangle()
BALL::TriangulatedSurface::beginEdge
EdgeIterator beginEdge()
BALL::TriangulatedSurface::clear
void clear()
triangle.h
BALL
Definition: constants.h:13
BALL::TriangulatedSurface::endPoint
PointIterator endPoint()
BALL::TriangulatedSurface::insert
void insert(TrianglePoint *point)
BALL::TriangulatedSurface::ConstEdgeIterator
std::list< TriangleEdge * >::const_iterator ConstEdgeIterator
Definition: triangulatedSurface.h:58
BALL::TriangulatedSurface::join
void join(TriangulatedSurface &source)
BALL::TriangulatedSurface::number_of_edges_
Size number_of_edges_
Definition: triangulatedSurface.h:347
BALL::TriangulatedSurface::deleteIsolatedPoints
void deleteIsolatedPoints()
BALL::TriangulatedSphere::pentakisDodecaeder
void pentakisDodecaeder(bool out=true)
BALL::Constants::c
BALL_EXTERN_VARIABLE const double c
Definition: constants.h:149
BALL::TriangulatedSurface::endEdge
ConstEdgeIterator endEdge() const
BALL::TriangulatedSurface::beginTriangle
TriangleIterator beginTriangle()
BALL::TriangulatedSphere::TriangulatedSphere
TriangulatedSphere()
BALL::TriangulatedSurface::getNumberOfEdges
Size getNumberOfEdges() const
BALL::TriangulatedSurface::setDensity
void setDensity(const double &density)
BALL_SIZE_TYPE
BALL::TVector3< double >
BALL::TriangulatedSurface::remove
void remove(TrianglePoint *point, bool deep=true)
BALL::TriangulatedSphere::refine
void refine(Position iterations, bool out=true)
BALL::TriangleEdge
Definition: triangleEdge.h:39
BALL::TriangulatedSurface::TriangulatedSurface
TriangulatedSurface(const TriangulatedSurface &surface, bool=true)
BALL::TriangulatedSurface::number_of_triangles_
Size number_of_triangles_
Definition: triangulatedSurface.h:353
BALL::TriangulatedSurface::getNumberOfTriangles
Size getNumberOfTriangles() const
BALL::TriangulatedSurface::remove
void remove(TriangleIterator t, bool deep=true)
BALL::TriangulatedSurface::canBeCopied
bool canBeCopied() const
triangleEdge.h
BALL::TriangulatedSphere::set
void set(const TriangulatedSphere &sphere, bool=true)
BALL::TriangulatedSurface::endPoint
ConstPointIterator endPoint() const
BALL::Triangle
Definition: triangle.h:39
BALL::operator<<
BALL_EXPORT std::ostream & operator<<(std::ostream &os, const Exception::GeneralException &e)
BALL::TSurface< float >
BALL::TriangulatedSurface::EdgeIterator
std::list< TriangleEdge * >::iterator EdgeIterator
Definition: triangulatedSurface.h:56
BALL::TriangulatedSphere::TriangulatedSphere
TriangulatedSphere(const TriangulatedSphere &sphere, bool=true)
BALL::TriangulatedSurface::deleteIsolatedEdges
void deleteIsolatedEdges()
BALL::TriangulatedSphere::Face
Definition: triangulatedSurface.h:395
BALL::TriangulatedSurface::endTriangle
ConstTriangleIterator endTriangle() const
BALL_CREATE
#define BALL_CREATE(name)
Definition: create.h:62
BALL::TriangulatedSphere::Face::ecount
Position ecount
Definition: triangulatedSurface.h:399
trianglePoint.h
BALL::TriangulatedSurface::getBorder
void getBorder(std::list< TriangleEdge * > &border)
BALL::TriangulatedSurface::cut
void cut(const TPlane3< double > &plane, const double &fuzzy=0)
BALL::TriangulatedSurface
Definition: triangulatedSurface.h:41
surface.h
BALL::TriangulatedSurface::triangles_
std::list< Triangle * > triangles_
Definition: triangulatedSurface.h:356
BALL::TriangulatedSurface::setIndices
void setIndices()
BALL::TriangulatedSurface::edges_
std::list< TriangleEdge * > edges_
Definition: triangulatedSurface.h:350
BALL::TriangulatedSurface::exportSurface
void exportSurface(Surface &surface)
BALL::TriangulatedSurface::createTube
static TriangulatedSurface * createTube(unsigned int num_vertices, unsigned int subdiv=0, bool closed=false, bool out=true)
BALL::TriangulatedSurface::TriangulatedSurface
TriangulatedSurface()
BALL::TriangulatedSurface::remove
void remove(EdgeIterator e, bool deep=true)
BALL::TriangulatedSphere::~TriangulatedSphere
virtual ~TriangulatedSphere()
BALL::TriangulatedSurface::createDisk
static TriangulatedSurface * createDisk(unsigned int num_vertices, bool out=true)
BALL::TriangulatedSurface::blowUp
void blowUp(const double &r)
BALL::TriangulatedSurface::density_
double density_
Definition: triangulatedSurface.h:360
BALL::TriangulatedSurface::remove
void remove(PointIterator p, bool deep=true)
BALL::TriangulatedSurface::getDensity
double getDensity() const
BALL::TriangulatedSurface::shrink
void shrink()
BALL::TriangulatedSurface::beginPoint
ConstPointIterator beginPoint() const