CFx SDK Documentation  2022 SP0
FMMdlFace.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2015, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2015 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 
24 #ifndef __FMMDL_FACE_H__
25 #define __FMMDL_FACE_H__
26 
27 #include "Modeler/FMMdlEntity.h"
28 #include "FMProfile3D.h"
29 
33 namespace FacetModeler
34 {
35 
36 const OdUInt32 VFF = FLAG(0);
37 const OdUInt32 OFF = FLAG(1);
38 const OdUInt32 SKIP_HATCH = FLAG(18);
39 
40 struct Vertex2Surface;
41 class Surface;
42 
46 class FMGEOMETRY_API Face : public Entity
47 {
48  public:
52  Face* next() const;
53 
57  Face* prev() const;
58 
62  const OdGePlane& plane() const;
63 
68 
72  bool isConvex() const;
73 
77  bool hasHoles() const;
78 
83 
88 
92  OdUInt32 loopEdgeCount( OdUInt32 iLoopIndex = 0 ) const;
93 
100  Edge* edge( OdUInt32 nLoop = 0 ) const;
101 
105  Edge* addEdge( OdUInt32 nLoop, FacetModeler::Vertex* pVertex, bool bInverseOrder = false );
106 
110  OdUInt32 findLoop( const Edge* pEdge ) const;
111 
115  double area() const;
116 
120  void deletePlane() const;
121 
126 
131 
135  void negate();
136 
140  void profile( Profile3D& rResult, const OdGePlane* pPlane = 0, bool bIncludeHoles = true) const;
141 
145  void profile( const OdGePlane& plane, Profile2D& result, bool bIncludeHoles = true, OdArray<const Edge*>* pSourceEdges = NULL ) const;
146 
150  void profileOuter( Profile3D& rResult, const OdGePlane* pPlane = 0 ) const;
151 
156 
160  void setOrientation( FaceOrientation eOrientation );
161 
166  bool intersectLine( const OdGeLinearEnt3d& gLine, OdGePoint3d* pptResult = 0, bool* pbCoplanar = 0 ) const;
167 
171  Surface* surface( ) const { return m_pSurface; }
172 
176  OdUInt32 color() const { return m_iColor; }
177 
181  void setColor ( OdUInt32 color ) { m_iColor = color; }
182 
184  void debugValidate( bool bValidateEdgePartners = false ) const;
185 
188 
190  struct EdgeLoop
191  {
193  {
194  m_pFace = 0;
195  m_pFirstEdge = 0;
196  m_pNextLoop = 0;
197  }
201 
202  void zero()
203  {
204  m_pNextLoop = NULL;
205  m_pFirstEdge = NULL;
206  m_pFace = NULL;
207  }
208  };
209 
211  EdgeLoop* loop( OdUInt32 nLoop ) const;
212 
213  // all code below is secret and opened for testing purposes. DO NOT USE DIRECT ACCESS TO THESE VARIABLES!
214  //protected:
215 
216  Face();
217  ~Face();
218 
219 
220 
221  Face(const Face&);
222  Face& operator=(const Face&);
223 
224  //private:
225  Face* clone( Body& to ) const;
226  void clear();
227  void evaluatePlane() const;
228 
229 
230 
231  EdgeLoop* insertLoop( OdUInt32 nIndex, Edge* pFirstEdge = 0 );
232 
233 
234 
235  // Previous face.
237 
238  // Next face.
240 
241  // First loop.
243 
244  // Cached face plane.
245  mutable OdGePlane* m_Plane;
246 
247  // Surface
249 
250  // Color
252 
253  friend class Body;
254  friend class BodyInternalConsistencyRestorer;
255  friend class BodyImpl;
256  friend class Edge;
257 };
258 
259 inline void Face::profileOuter( Profile3D& result, const OdGePlane* pPlane ) const {
260  profile( result, pPlane, false );
261 }
262 
263 #if 0
264 // debug finctions for memory leaks checking
265 class FaceTracker
266 {
267  int m_id;
268  std::map<Face*, int> m_faces;
269 
270 public:
271  FaceTracker()
272  {
273  m_id = 0;
274  }
275 
276  ~FaceTracker();
277 
278  void FaceCreated(Face* pFace)
279  {
280  if(m_id == 5677163)
281  {
282  int breakHere = 0;
283  }
284  m_faces.insert(std::make_pair(pFace, m_id));
285  m_id++;
286  }
287 
288  void FaceDeleted(Face* pFace)
289  {
290  m_faces.erase(pFace);
291  }
292 
293  void CheckFloatingEdges();
294 };
295 
296 FaceTracker* GetFaceTracker();
297 #endif
298 
299 }
300 
301 #endif //__FMMDL_FACE_H__
#define NULL
Definition: GsProperties.h:177
unsigned int OdUInt32
bool isConvex() const
EdgeLoop m_Loops
Definition: FMMdlFace.h:242
bool intersectLine(const OdGeLinearEnt3d &gLine, OdGePoint3d *pptResult=0, bool *pbCoplanar=0) const
void debugValidate(bool bValidateEdgePartners=false) const
DOM.
Face * clone(Body &to) const
OdUInt32 color() const
Definition: FMMdlFace.h:176
Surface * m_pSurface
Definition: FMMdlFace.h:248
double area() const
OdUInt32 loopEdgeCount(OdUInt32 iLoopIndex=0) const
void profileOuter(Profile3D &rResult, const OdGePlane *pPlane=0) const
Definition: FMMdlFace.h:259
void nullLoopEdgesRefs()
DOM.
Face(const Face &)
void setColor(OdUInt32 color)
Definition: FMMdlFace.h:181
OdUInt32 m_iColor
Definition: FMMdlFace.h:251
bool hasHoles() const
void deletePlane() const
EdgeLoop * loop(OdUInt32 nLoop) const
DOM.
Face * next() const
OdGeVector3d normal() const
FaceOrientation orientation() const
Face * prev() const
void profile(Profile3D &rResult, const OdGePlane *pPlane=0, bool bIncludeHoles=true) const
void setOrientation(FaceOrientation eOrientation)
Edge * addEdge(OdUInt32 nLoop, FacetModeler::Vertex *pVertex, bool bInverseOrder=false)
OdUInt32 findLoop(const Edge *pEdge) const
void evaluatePlane() const
Face & operator=(const Face &)
Surface * surface() const
Definition: FMMdlFace.h:171
OdUInt32 loopCount() const
void setLoopCount(OdUInt32 n)
void profile(const OdGePlane &plane, Profile2D &result, bool bIncludeHoles=true, OdArray< const Edge * > *pSourceEdges=NULL) const
OdGePlane * m_Plane
Definition: FMMdlFace.h:245
const OdGePlane & plane() const
EdgeLoop * insertLoop(OdUInt32 nIndex, Edge *pFirstEdge=0)
Edge * edge(OdUInt32 nLoop=0) const
OdUInt32 FLAG(OdUInt32 i)
Definition: FMMdlEntity.h:35
const OdUInt32 SKIP_HATCH
Definition: FMMdlFace.h:38
const OdUInt32 OFF
Definition: FMMdlFace.h:37
const OdUInt32 VFF
Definition: FMMdlFace.h:36