BALL  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
86  virtual ~TriangulatedSurface()
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 
161  BALL_DEPRECATED Size numberOfPoints() const;
162 
166  Size getNumberOfPoints() const;
167 
171  BALL_DEPRECATED Size numberOfEdges() const;
172 
175  Size getNumberOfEdges() const;
176 
180  BALL_DEPRECATED Size numberOfTriangles() const;
181 
185  Size getNumberOfTriangles() const;
186 
192  void remove(TrianglePoint* point, bool deep = true);
193 
200  void remove(PointIterator p, bool deep = true);
201 
207  void remove(TriangleEdge* edge, bool deep = true);
208 
215  void remove(EdgeIterator e, bool deep = true);
216 
222  void remove(Triangle* triangle, bool deep = true);
223 
231  void remove(TriangleIterator t, bool deep = true);
232 
236  void exportSurface(Surface& surface);
237 
244  TriangulatedSurface& operator += (const TriangulatedSurface& surface);
245 
252  void join(TriangulatedSurface& source);
253 
258  void shift(const TVector3<double>& c);
259 
264  void blowUp(const double& r);
265 
268  void setIndices();
269 
272  void setDensity(const double& density);
273 
276  double getDensity() const;
277 
282  void cut(const TPlane3<double>& plane, const double& fuzzy = 0);
283 
286  void shrink();
287 
290  void deleteIsolatedEdges();
291 
294  void deleteIsolatedPoints();
295 
300  void getBorder(std::list<TriangleEdge*>& border);
301 
303 
306 
307  PointIterator beginPoint();
308 
309  ConstPointIterator beginPoint() const;
310 
311  PointIterator endPoint();
312 
313  ConstPointIterator endPoint() const;
314 
315  EdgeIterator beginEdge();
316 
317  ConstEdgeIterator beginEdge() const;
318 
319  EdgeIterator endEdge();
320 
321  ConstEdgeIterator endEdge() const;
322 
323  TriangleIterator beginTriangle();
324 
325  ConstTriangleIterator beginTriangle() const;
326 
327  TriangleIterator endTriangle();
328 
329  ConstTriangleIterator endTriangle() const;
330 
332  /*_ @name protected help functions
333  */
335 
336  protected:
337 
338  /*_ Test whether a TriangulatedSurface object can be copied
339  */
340  bool canBeCopied() const;
341 
342  /*_ Copy a TriangulatedSurface object
343  */
344  void copy(const TriangulatedSurface& surface);
345 
347 
348  protected:
349 
350  /*_ @name Attributes
351  */
353 
354  /*_ the number of points of the triangulated surface
355  */
357  /*_ the points of the surface.
358  */
359  std::list<TrianglePoint*> points_;
360  /*_ the number of edges of the triangulated surface
361  */
363  /*_ the edges of the surface.
364  */
365  std::list<TriangleEdge*> edges_;
366  /*_ the number of triangles of the triangulated surface
367  */
369  /*_ the triangles of the surface.
370  */
371  std::list<Triangle*> triangles_;
372 
373  /*_ the density used by triangulation algorithms
374  */
375  double density_;
376 
378 
379  };
380 
385 
388  BALL_EXPORT std::ostream& operator << (std::ostream& s,
389  const TriangulatedSurface& surface);
390 
392 
393 
394 
395 
403  {
404 
405  public:
406 
408 
409  struct Face
410  {
415  };
416 
420 
425  ;
426 
432  TriangulatedSphere(const TriangulatedSphere& sphere, bool = true)
433  ;
434 
438  virtual ~TriangulatedSphere()
439  ;
441 
445 
450  void set(const TriangulatedSphere& sphere, bool = true)
451  ;
452 
456  TriangulatedSphere& operator = (const TriangulatedSphere& sphere)
457  ;
458 
460 
464 
471  void icosaeder(bool out = true);
472 
479  void pentakisDodecaeder(bool out = true);
480 
486  void refine(Position iterations, bool out = true);
487 
488 
489  private:
490 
491  /*_ Refine a triangulated sphere once.
492  */
493  void refine(bool out);
494 
495  void buildFourTriangles
496  (Face face,
497  Triangle* face0,
498  Triangle* face1,
499  Triangle* face2,
500  Triangle* face3)
501  ;
502 
503  /*_ Set the incidences of a refined triangulated sphere.
504  */
505  void setIncidences();
506 
508 
509  };
510 
511 } // namespace BALL
512 
513 
514 #endif // BALL_STRUCTURE_TRIANGULATEDSURFACE_H
515 
516