Fade2.5D Documentation pages v2.16.8
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 // unclear to you.
14 //
15 // Support: https://www.geom.at/contact/
16 // Project: https://www.geom.at/fade2d/html/
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 
39 enum CAFTYP
40 {
43  CT_FILL
44 };
45 
46 class Triangle2;
47 class Point2;
48 class Zone2;
49 
50 
51 
62 class CLASS_DECLSPEC CAF_Component
63 {
64 public:
69  std::vector<Triangle2*>& vT_,
70  std::map<Point2*,std::pair<double,double> >& mVtx2BeforeAfter_,
71  int label_
72  );
77 
85  CAFTYP getCAFType() const;
86 
87 
98  double getVolume() const;
99 
106  int getLabel() const;
107 
117  void getTriangles(std::vector<Triangle2*>& vTrianglesOut) const;
118 
126  void getBorder(std::vector<Segment2>& vBorderSegments) const;
127 
128 private:
130  CAF_Component& operator=(const CAF_Component&);
131 protected:
133  void init(std::map<Point2*,std::pair<double,double> >& mVtx2BeforeAfter);
135  void showGeomview(const char* name,std::vector<Point2>* pvBeforeT, std::vector<Point2>* pvAfterT, std::vector<Point2>* pvWallT) const;
137  void setVolume(std::vector<Point2>* pvBeforeT, std::vector<Point2>* pvAfterT, std::vector<Point2>* pvWallT);
138  std::vector<Triangle2*>* pVT;
139  CAFTYP caftype;
140  double volume;
141  int label;
142 };
143 
144 
145 
154 inline std::ostream &operator<<(std::ostream &stream, const CAF_Component& c)
155 {
156  stream<<"Component "<<c.getLabel();
157  switch(c.getCAFType())
158  {
159  case CT_NULL: stream<<", Type: NULL";break;
160  case CT_CUT: stream<<", Type: CUT ";break;
161  case CT_FILL: stream<<", Type: FILL";break;
162  }
163  stream<<", Volume: "<<c.getVolume();
164  return stream;
165 }
166 
167 
168 } // (namespace)
169 
170 
171 #elif GEOM_PSEUDO3D==GEOM_FALSE
172 #else
173  #error GEOM_PSEUDO3D is not defined
174 #endif
std::ostream & operator<<(std::ostream &stream, const Bbox2 &pC)
Prints the bounding box to a stream.
Definition: Bbox2.h:605
CAFTYP
Definition: CAF_Component.h:40
@ CT_FILL
the first surface is below the second one
Definition: CAF_Component.h:43
@ CT_NULL
the first surface corresponds to the second one
Definition: CAF_Component.h:41
@ CT_CUT
the first surface is above the second one
Definition: CAF_Component.h:42
CAF_Component represents a connected area of the surface.
Definition: CAF_Component.h:63
void getTriangles(std::vector< Triangle2 * > &vTrianglesOut) const
Get the triangles of the component.
void getBorder(std::vector< Segment2 > &vBorderSegments) const
Get the border segments of the component.
CAF_Component(std::vector< Triangle2 * > &vT_, std::map< Point2 *, std::pair< double, double > > &mVtx2BeforeAfter_, int label_)
Constructor.
int getLabel() const
Get the label of the component.
CAFTYP getCAFType() const
Get Cut&Fill-Type.
double getVolume() const
Get the volume of the component.
Represents a 2.5D point.
Definition: Point2.h:76