xc
GTSSurface.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // xc utils library; general purpose classes and functions.
4 //
5 // Copyright (C) Luis C. PĂ©rez Tato
6 //
7 // XC utils is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // This software is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program.
19 // If not, see <http://www.gnu.org/licenses/>.
20 //----------------------------------------------------------------------------
21 //GTSSuface.h
22 //C++ wrapper para la clase GtsSurface de la biblioteca GTS.
23 
24 #ifndef GTS_SURFACE_H
25 #define GTS_SURFACE_H
26 
27 #include "gts.h"
28 
29 class GTSVertex;
30 class GTSFace;
31 class GTSSurfaceTraverse;
32 class GTSBBoxTree;
33 class GTSGraph;
34 class GTSSplit;
35 class Vector3d;
36 class TriangleMap;
37 
39  {
40  GtsSurface *s;
41 
42  bool borrar;
43 
44  void crea(void);
45  void borra(void);
46 
47  protected:
48  GtsSurface const *get_const_ptr(void) const
49  { return s; }
50  GtsSurface *get_ptr(void)
51  { return s; }
52  GTSSurface(GtsSurface *ptr);
53  public:
54  friend class GTSVertex;
55  friend class GTSSurfaceTraverse;
56  friend class GTSSurfaceIntersection;
57  friend class GTSGraph;
58 
59  GTSSurface(void);
60  GTSSurface(const GTSSurface &);
61  GTSSurface &operator=(const GTSSurface &);
62 
63  int Read(GtsFile *fp);
64  void Write(FILE *fp);
65  void WriteOogl(FILE *fp);
66 
67  void PrintStats(FILE* fp) const;
68  bool IsClosed(void) const;
69  bool IsOpen(void) const;
70  bool IsOrientable(void) const;
71  GTSSurface selfIntersecting(void) const;
72  bool Vacia(void) const;
73  bool CheckSelfIntersection(bool verbose) const;
74 
75  void appendFace(GTSFace &f);
76  void removeFace(GTSFace &f);
77  void Merge(const GTSSurface &);
78 
79  guint getNumVertices(void) const;
80  guint getNumEdges(void) const;
81  guint GetNumCaras(void) const;
82  GTSSurfaceTraverse Begin(void) const;
83  GTSGraph Graph(void) const;
84  void ForEachVertex(GtsFunc func,gpointer data) const;
85  void ForEachEdge(GtsFunc func,gpointer data) const;
86  void ForEachFace(GtsFunc func,gpointer data) const;
87 
88  GNode *BBoxTree(void) const;
89 
90  double GaussianCurvature(const GTSVertex &v) const;
91  Vector3d MeanCurvatureNormal(const GTSVertex &v) const;
92  void PrincipalCurvatures(const GTSVertex &v,double &k1,double &k2) const;
93  void PrincipalDirections(const GTSVertex &v,Vector3d &e1,Vector3d &e2) const;
94 
95  double Volume(void) const
96  { return gts_surface_volume(s); }
98  double getArea(void) const
99  { return gts_surface_area(s); }
100 
101  TriangleMap GetTriangleMap(void) const;
102 
103  ~GTSSurface(void);
104  };
105 
106 
107 GTSSurface Union(const GTSSurface &a,const GTSSurface &b,bool check_self_intersection=false,bool verbose=false);
108 GTSSurface intersection(const GTSSurface &a,const GTSSurface &b,bool check_self_intersection=false,bool verbose=false);
109 GTSSurface Diferencia(const GTSSurface &a,const GTSSurface &b,bool check_self_intersection=false,bool verbose=false);
110 
111 
112 #endif
Polyhedron3d Union(const Polyhedron3d &a, const Polyhedron3d &b)
Union of the polyhedron arguments.
Definition: polyhedron3d_bool_op.cc:110
Definition: GTSBBoxTree.h:29
Definition: GTSSurfaceTraverse.h:32
Definition: GTSFace.h:31
Definition: GTSSurfaceIntersection.h:32
Definition: GTSGraph.h:31
bool CheckSelfIntersection(bool verbose) const
Return true if the surface intersects itself.
Definition: GTSSurface.cc:108
double getArea(void) const
Return the sum of the areas (with sign) of the faces.
Definition: GTSSurface.h:98
Definition: TriangleMap.h:131
Definition: GTSSurface.h:38
Definition: GTSVertex.h:34
Definition: GTSSplit.h:31
Vector en tres dimensiones.
Definition: Vector3d.h:39