CFx SDK Documentation  2022 SP0
FMMdlBody.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_BODY_H__
25 #define __FMMDL_BODY_H__
26 
27 #include "Modeler/FMMdlBase.h"
28 #include "FMContour3D.h"
29 #include "FMProfile3D.h"
30 
31 class OdGeCircArc3d;
32 
36 namespace FacetModeler
37 {
38 
39 class VertexSurfData;
40 class Surface;
42 
46 class FMGEOMETRY_API Body
47 {
48  protected:
49  Body( class BodyImpl* pImpl );
50  public:
54  Body();
55 
62  Body(const Body& B);
63 
67  ~Body();
68 
75  Body& operator = (const Body& B);
76 
80  void clear();
81 
85  Body clone() const;
86 
90  void transform( const OdGeMatrix3d& mMatrix );
91 
95  void negate();
96 
100  bool isNull() const;
101 
105  bool isClosed() const;
106 
111 
116 
120 
123  void decomposeIntoLumps( std::vector<Body>& aLumps );
124 
130  Body combine( Body& rAnother );
131 
136 
138 
143 
148 
153 
155 
160 
161  void addSurface(Surface* pSurface);
162 
167 
172 
177 
178 
183 
188 
192  void clearEdgeTags( FacetModeler::AecTagType clearValue = 0 );
193 
197  void clearFaceTags( FacetModeler::AecTagType clearValue = 0 );
198 
202  void clearBodyTags( FacetModeler::AecTagType clearValue = 0 ) { setTag( clearValue ); }
203 
208 
213 
218 
223 
227  double volume() const;
228 
232  void slice( const OdGePlane& rCutter,
233  Profile3D& rResult, bool bIncludeBoundary = true ) const;
234 
235  void sliceFaceDbg(const OdGePlane& rCutter, OdUInt32 faceNum);
236 
240  void slice( const OdGePlane& rCutter,
241  Profile2D* pResultIncludingBoundary,
242  Profile2D* pResultExcludingCoincidingBoundary = 0,
243  Profile2D* pResultExcludingOppositeBoundary = 0,
244  Profile2D* pResultExcludingBoundary = 0,
245  FaceConstPtrArray* pCoincidingFaces = 0,
246  FaceConstPtrArray* pOppositeFaces = 0
247  ) const;
248 
252  void slice( const Contour2D& cCutLine, const OdGePlane& pProjectOn,
253  Profile3D& rResult, bool bIncludeBoundary = true ) const;
254 
260  bool intersectLine( const OdGeLinearEnt3d& gLine, std::vector< OdGePoint3d >& vecPoints, bool bSortResults = false ) const;
261 
262  bool operator == (const Body& aBody) const;
263  bool operator != (const Body& aBody) const;
264 
265  FMGEOMETRY_API_STATIC static const Body kEmpty;
266 
276  static Body box( const OdGePoint3d& ptOrigin,
277  const OdGeVector3d& vSizes );
278 
289  static Body pyramid( const Profile2D& rBase,
290  const OdGePoint3d& ptApex,
291  const DeviationParams& devDeviation = FMGeGbl::gDefDev );
292 
303  static Body extrusion( const Profile2D& rBase,
304  const OdGeVector3d& vDir,
305  const DeviationParams& devDeviation = FMGeGbl::gDefDev );
306 
317  /*static Body extrusion( const Profile2D& rBase,
318  const Contour3D& rPath,
319  const DeviationParams& devDeviation = FMGeGbl::gDefDev );*/
320 
332  /*static Body extrusion( const Profile2D& rBase,
333  const std::vector<OdGePoint3d>& rPath,
334  const OdGeVector3d& vNormal,
335  const DeviationParams& devDeviation = FMGeGbl::gDefDev );*/
336 
348  static Body revolution( const Profile2D& rBase,
349  double dRadius, double dHeight,
350  const DeviationParams& devDeviation = FMGeGbl::gDefDev );
351 
364  static Body revolution(
365  const Profile2D& base,
366  const OdGeCircArc3d& revolutionAxisAndAngles,
367  const DeviationParams& deviation = FMGeGbl::gDefDev,
368  const OdGeMatrix2d* pBaseTransform = 0 );
369 
381  static Body insideBody( const Profile2D& rBase,
382  double dDepth, double dDepthOrigin,
383  const DeviationParams& devDeviation = FMGeGbl::gDefDev );
384 
397  static Body insideFrame( const Profile2D& rBase,
398  double dWidth, double dDepth, double dDepthOrigin,
399  const DeviationParams& devDeviation = FMGeGbl::gDefDev );
400 
411  static Body infExtrusion( const Body& rBase,
412  const Profile3D& rCutter,
413  const DeviationParams& devDeviation = FMGeGbl::gDefDev ) ;
427  static Body singleFace( const Profile2D& rBase,
428  const DeviationParams& devDeviation = FMGeGbl::gDefDev );
429 
430  struct FMGEOMETRY_API SurfaceData {
434 
435  void addVertexSurfData( int nVertex, Surface* pSurf );
436  };
437 
454  static Body custom( const std::vector<OdGePoint3d>& aVertices,
455  const std::vector<OdInt32>& aFaceData,
456  const std::vector<OdUInt32>* aEdgeFlags = 0,
457  const std::vector<OdUInt32>* aFaceFlags = 0,
458  const std::vector<OdUInt32>* aVertexFlags = 0,
459  const SurfaceData* pSurfaceData = 0
460  );
461 
479  static Body customC( const std::vector<OdGePoint3d>& aVertices,
480  const std::vector<OdInt32>& aFaceData,
481  const std::vector<OdUInt32>* aEdgeFlags = 0,
482  const std::vector<OdUInt32>* aFaceFlags = 0,
483  const std::vector<OdUInt32>* aVertexFlags = 0,
484  const SurfaceData* pSurfaceData = 0,
485  std::vector<OdUInt32>* pFaceColors = 0,
486  std::vector<OdUInt32>* pEdgeColors = 0
487  );
488 
489 
502  /*static Body customRemoveTJ( const std::vector<OdGePoint3d>& aVertices,
503  const std::vector<OdInt32>& aFaceData,
504  std::vector<OdUInt32>* aEdgeFlags = 0,
505  std::vector<OdUInt32>* aFaceFlags = 0,
506  std::vector<OdUInt32>* aVertexFlags = 0 );*/
507 
516  //static Body convertFromEntity( const OdDbObjectId& idEntity );
517 
521  void resetColors();
522 
533  static Body boolOper( BooleanOperation eOperation,
534  Body& rOperandA, Body& rOperandB );
535 
545  //static Body section( Body& rBase,
546  // const OdGePlane& rCutter );
547 
560  static Body cutWithExtrusion( Body& rBase,
561  const Profile3D& rCutter, bool bInside, double dDepth,
562  const DeviationParams& devDeviation = FMGeGbl::gDefDev );
563 
564 
576  static Body cutWithInfExtrusion( Body& rBase,
577  const Profile3D& rCutter, bool bInside,
578  const DeviationParams& devDeviation = FMGeGbl::gDefDev );
579 
589  const OdGePlane& pPlane,
590  std::vector<FacetModeler::Face*>* pNewOuter = 0,
591  std::vector<FacetModeler::Face*>* pNewInner = 0 );
592 
596  void addFace( FacetModeler::Face* pFace );
597 
602 
607 
608  //
610 
611  // If pFirstErrorDetected is provided then method returns false and assign error message to passed OdString
612  // otherwise OdError with the error message is thrown if error is detected
613  bool checkInternalConsistence( OdString* pFirstErrorDetected = 0 ) const;
614 
615  bool hasCoincidentEdges() const;
616  bool hasCoincidentVertices() const;
617 
619 
620 private:
621  void addFace2(Face* pFace);
622 
623  Face* addFace2(Surface* pSurface);
624 
625  // returns new starting edge of the loop
626  Edge* mergeEdgesInLoop( Edge* pFirstEdge, const OdGeTol& gTol );
627 
628  // delete edge (without partners) and update face loop start, if the edge was first in a loop
629  void deleteEdge( Edge* pEdge, Edge* pNewLoopStart );
630 
631  // split edge and all partners preserving topology
632  // the vertex->point() must be at the edge
633  void splitEdge( Edge* pEdge, Vertex* pNewVertex );
634 
635  //
636  //void removeTJunctions();
637 
638  //
639  void collectLoopsLight( Face* pFace );
640  Body cloneByFaceList(std::vector<Face*> aFaceList) const;
641 
642  public:
643  static Body customInternal( const std::vector<OdGePoint3d>& aVertices,
644  const std::vector<OdInt32>& aFaceData,
645  bool bRemoveTJ,
646  const std::vector<OdUInt32>* aEdgeFlags = 0,
647  const std::vector<OdUInt32>* aFaceFlags = 0,
648  const std::vector<OdUInt32>* aVertexFlags = 0,
649  const SurfaceData* pSurfaceData = 0,
650  const std::vector<OdUInt32>* aFaceColors = 0,
651  const std::vector<OdUInt32>* aEdgeColors = 0);
652  private:
653 
654  //static Body CallOldBooleanOp( BooleanOperation operation, Body& rOperandA, Body& rOperandB );
655  static Body DoUnionOperation( Body& rOperandA, Body& rOperandB );
656  static Body DoIntersectionOperation( Body& rOperandA, Body& rOperandB );
657  static Body DoDifferenceOperation( Body& rOperandA, Body& rOperandB );
658  static Body DoXOROperation( Body& rOperandA, Body& rOperandB );
659 
660  static void CheckOperationResult( BooleanOperation operation, Body& rOperandA, Body& rOperandB, Body& rResult );
661 
662  public:
669  //OdUInt32 getVertexCount();
671 
672  private:
673 
674  class BodyImpl* m_pImpl;
675 
676  friend class Vertex;
677  friend class Face;
678  friend class Surface;
679  friend class BodyImpl;
680  friend class BodyInternalConsistencyRestorer;
681 };
682 
683 FMGEOMETRY_API Body extrusion( const Profile2D& rBase,
684  const OdGeMatrix3d& mBasePlane,
685  const OdGeVector3d& vDir,
686  const DeviationParams& devDeviation = FMGeGbl::gDefDev );
687 
688 FMGEOMETRY_API Body revolution( const Profile2D& base,
689  const OdGeVector3d& revAxis,
690  const OdGePoint3d& axisPosition,
691  double startAng,
692  double endAng,
693  const DeviationParams& deviation = FMGeGbl::gDefDev );
694 
695 }
696 
697 #endif //__FMMDL_BODY_H__
unsigned int OdUInt32
FacetModeler::Vertex * getVertexList()
static Body pyramid(const Profile2D &rBase, const OdGePoint3d &ptApex, const DeviationParams &devDeviation=FMGeGbl::gDefDev)
Surface * surfaceList() const
static Body revolution(const Profile2D &base, const OdGeCircArc3d &revolutionAxisAndAngles, const DeviationParams &deviation=FMGeGbl::gDefDev, const OdGeMatrix2d *pBaseTransform=0)
void removeFace(FacetModeler::Face *pFace)
void setSurfaceCount(OdUInt32 count)
bool mergeCoincidentVertices()
OdUInt32 surfaceCount() const
void clearSurfaceTags(FacetModeler::AecTagType clearValue=0)
void setVertexCount(OdUInt32 count)
void sliceFaceDbg(const OdGePlane &rCutter, OdUInt32 faceNum)
void addSurface(Surface *pSurface)
void slice(const OdGePlane &rCutter, Profile3D &rResult, bool bIncludeBoundary=true) const
void addFace(FacetModeler::Face *pFace)
void deleteUnusedVertices()
static Body box(const OdGePoint3d &ptOrigin, const OdGeVector3d &vSizes)
Body combine(Body &rAnother)
double volume() const
void regeneratePairEdges()
OdUInt32 faceCount() const
static Body insideBody(const Profile2D &rBase, double dDepth, double dDepthOrigin, const DeviationParams &devDeviation=FMGeGbl::gDefDev)
void clone_impl_if_referenced()
static Body extrusion(const Profile2D &rBase, const OdGeVector3d &vDir, const DeviationParams &devDeviation=FMGeGbl::gDefDev)
FacetModeler::Face * faceList() const
FacetModeler::Vertex * addVertex(const OdGePoint3d &pt)
void transform(const OdGeMatrix3d &mMatrix)
void slice(const Contour2D &cCutLine, const OdGePlane &pProjectOn, Profile3D &rResult, bool bIncludeBoundary=true) const
OdUInt32 cachedEdgesCount() const
void slice(const OdGePlane &rCutter, Profile2D *pResultIncludingBoundary, Profile2D *pResultExcludingCoincidingBoundary=0, Profile2D *pResultExcludingOppositeBoundary=0, Profile2D *pResultExcludingBoundary=0, FaceConstPtrArray *pCoincidingFaces=0, FaceConstPtrArray *pOppositeFaces=0) const
static Body boolOper(BooleanOperation eOperation, Body &rOperandA, Body &rOperandB)
void clearEdgeTags(FacetModeler::AecTagType clearValue=0)
void clearVertexTags(FacetModeler::AecTagType clearValue=0)
static Body custom(const std::vector< OdGePoint3d > &aVertices, const std::vector< OdInt32 > &aFaceData, const std::vector< OdUInt32 > *aEdgeFlags=0, const std::vector< OdUInt32 > *aFaceFlags=0, const std::vector< OdUInt32 > *aVertexFlags=0, const SurfaceData *pSurfaceData=0)
bool checkInternalConsistence(OdString *pFirstErrorDetected=0) const
FacetModeler::Surface * getSurfaceList()
static Body cutWithExtrusion(Body &rBase, const Profile3D &rCutter, bool bInside, double dDepth, const DeviationParams &devDeviation=FMGeGbl::gDefDev)
static Body revolution(const Profile2D &rBase, double dRadius, double dHeight, const DeviationParams &devDeviation=FMGeGbl::gDefDev)
static Body cutWithInfExtrusion(Body &rBase, const Profile3D &rCutter, bool bInside, const DeviationParams &devDeviation=FMGeGbl::gDefDev)
bool hasCoincidentEdges() const
bool intersectLine(const OdGeLinearEnt3d &gLine, std::vector< OdGePoint3d > &vecPoints, bool bSortResults=false) const
bool hasCoincidentVertices() const
OdUInt32 vertexCount() const
FacetModeler::AecTagType tag() const
void mergeCoplanarEntities()
bool isClosed() const
FacetModeler::Face * addFace(Surface *pSurface=0)
bool containsNonManifoldEdges() const
OdGeExtents3d interval() const
Body(const Body &B)
OdUInt32 countEdges() const
FacetModeler::Vertex * vertexList() const
void clearFaceTags(FacetModeler::AecTagType clearValue=0)
static Body insideFrame(const Profile2D &rBase, double dWidth, double dDepth, double dDepthOrigin, const DeviationParams &devDeviation=FMGeGbl::gDefDev)
void clearBodyTags(FacetModeler::AecTagType clearValue=0)
Definition: FMMdlBody.h:202
void deleteFace(FacetModeler::Face *pFace)
static Body customC(const std::vector< OdGePoint3d > &aVertices, const std::vector< OdInt32 > &aFaceData, const std::vector< OdUInt32 > *aEdgeFlags=0, const std::vector< OdUInt32 > *aFaceFlags=0, const std::vector< OdUInt32 > *aVertexFlags=0, const SurfaceData *pSurfaceData=0, std::vector< OdUInt32 > *pFaceColors=0, std::vector< OdUInt32 > *pEdgeColors=0)
static Body customInternal(const std::vector< OdGePoint3d > &aVertices, const std::vector< OdInt32 > &aFaceData, bool bRemoveTJ, const std::vector< OdUInt32 > *aEdgeFlags=0, const std::vector< OdUInt32 > *aFaceFlags=0, const std::vector< OdUInt32 > *aVertexFlags=0, const SurfaceData *pSurfaceData=0, const std::vector< OdUInt32 > *aFaceColors=0, const std::vector< OdUInt32 > *aEdgeColors=0)
static Body infExtrusion(const Body &rBase, const Profile3D &rCutter, const DeviationParams &devDeviation=FMGeGbl::gDefDev)
OdUInt32 getSurfaceCount()
void decomposeIntoLumps(std::vector< Body > &aLumps)
void setSurfaceList(FacetModeler::Surface *pList)
void setTag(FacetModeler::AecTagType iTag)
static Body singleFace(const Profile2D &rBase, const DeviationParams &devDeviation=FMGeGbl::gDefDev)
void splitFace(FacetModeler::Face *pFace, const OdGePlane &pPlane, std::vector< FacetModeler::Face * > *pNewOuter=0, std::vector< FacetModeler::Face * > *pNewInner=0)
static FMGEOMETRY_API_STATIC const Body kEmpty
Definition: FMMdlBody.h:265
Body clone() const
void setVertexList(FacetModeler::Vertex *pList)
bool isNull() const
Body(class BodyImpl *pImpl)
Definition: GeTol.h:49
GLsizei GLsizei * count
Definition: gles2_ext.h:276
FMGEOMETRY_API Body extrusion(const Profile2D &rBase, const OdGeMatrix3d &mBasePlane, const OdGeVector3d &vDir, const DeviationParams &devDeviation=FMGeGbl::gDefDev)
OdArray< const Face *, OdMemoryAllocator< const Face * > > FaceConstPtrArray
Definition: FMMdlBody.h:40
ptrdiff_t AecTagType
Definition: FMMdlBase.h:42
FMGEOMETRY_API Body revolution(const Profile2D &base, const OdGeVector3d &revAxis, const OdGePoint3d &axisPosition, double startAng, double endAng, const DeviationParams &deviation=FMGeGbl::gDefDev)
bool DAI_EXPORT operator!=(const OdDAI::OdSelect &left, const OdDAI::OdSelect &right)
OdArray< VertexSurfData * > vertexSurfData
Definition: FMMdlBody.h:433
OdArray< Surface * > surfaces
Definition: FMMdlBody.h:431
OdArray< Surface * > face2Surface
Definition: FMMdlBody.h:432
void addVertexSurfData(int nVertex, Surface *pSurf)
static FMGEOMETRY_API_STATIC DeviationParams gDefDev
Definition: FMGeometry.h:148