Fade2.5D Documentation pages v2.15
Delaunay Features
CAF_Component.h
Go to the documentation of this file.
1 // Copyright (C) Geom Software e.U, Bernhard Kornberger, Graz/Austria
2 //
3 // This file is part of the Fade2D library. The student license is free
4 // of charge and covers personal non-commercial research. Licensees
5 // holding a commercial license may use this file in accordance with
6 // the Commercial License Agreement.
7 //
8 // This software is provided AS IS with NO WARRANTY OF ANY KIND,
9 // INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS
10 // FOR A PARTICULAR PURPOSE.
11 //
12 // Please contact the author if any conditions of this licensing are
13 // not clear to you.
14 //
15 // Author: Bernhard Kornberger, bkorn (at) geom.at
16 // http://www.geom.at
17 
19 
20 #pragma once
21 #include <map>
22 #include "common.h"
23 #include "Segment2.h"
24 
25 
26 
27 // Only defined for 2.5D
28 #if GEOM_PSEUDO3D==GEOM_TRUE
29 namespace GEOM_FADE25D {
30 
31 
36 enum CAFTYP
37 {
40  CT_FILL
41 };
42 
43 class Triangle2;
44 class Point2;
45 class Zone2;
46 
47 
48 
58 class CLASS_DECLSPEC CAF_Component
59 {
60 public:
62  std::vector<Triangle2*>& vT_,
63  std::map<Point2*,std::pair<double,double> >& mVtx2BeforeAfter_,
64  int label_
65  );
66  ~CAF_Component();
78  CAFTYP getCAFType() const;
79 
80 
91  double getVolume() const;
92 
99  int getLabel() const;
100 
110  void getTriangles(std::vector<Triangle2*>& vTrianglesOut) const;
111 
112 
117  void getBorder(std::vector<Segment2>& vBorderSegments) const;
118 
119 private:
121  CAF_Component& operator=(const CAF_Component&);
122 protected:
123  void init(std::map<Point2*,std::pair<double,double> >& mVtx2BeforeAfter);
124  void showGeomview(const char* name,std::vector<Point2>* pvBeforeT, std::vector<Point2>* pvAfterT, std::vector<Point2>* pvWallT) const;
125 
126  std::vector<Triangle2*>* pVT;
127  void setVolume(std::vector<Point2>* pvBeforeT, std::vector<Point2>* pvAfterT, std::vector<Point2>* pvWallT);
128  CAFTYP caftype;
129  double volume;
130  int label;
131 
132 };
133 
134 
139 inline std::ostream &operator<<(std::ostream &stream, const CAF_Component& c)
140 {
141  stream<<"Component "<<c.getLabel();
142  switch(c.getCAFType())
143  {
144  case CT_NULL: stream<<", Type: NULL";break;
145  case CT_CUT: stream<<", Type: CUT ";break;
146  case CT_FILL: stream<<", Type: FILL";break;
147  }
148  stream<<", Volume: "<<c.getVolume();
149  return stream;
150 }
151 
152 
153 } // (namespace)
154 
155 
156 #elif GEOM_PSEUDO3D==GEOM_FALSE
157 #else
158  #error GEOM_PSEUDO3D is not defined
159 #endif
CAFTYP
Definition: CAF_Component.h:37
@ CT_FILL
the first surface is below the second one
Definition: CAF_Component.h:40
@ CT_NULL
the first surface corresponds to the second one
Definition: CAF_Component.h:38
@ CT_CUT
the first surface is above the second one
Definition: CAF_Component.h:39
CAF_Component stands for CUT AND FILL COMPONENT. It represents a connected area of the surface.
Definition: CAF_Component.h:59
void getTriangles(std::vector< Triangle2 * > &vTrianglesOut) const
Get Triangles.
void getBorder(std::vector< Segment2 > &vBorderSegments) const
Get border.
int getLabel() const
Get label.
CAFTYP getCAFType() const
Get Cut&Fill-Type.
double getVolume() const
Get the volume.
Point.
Definition: Point2.h:53