CFx SDK Documentation  2020SP3
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__
FacetModeler::Body::hasCoincidentVertices
bool hasCoincidentVertices() const
FMProfile3D.h
FacetModeler::Body::mergeCoplanarEntities
void mergeCoplanarEntities()
FacetModeler::Body::Body
Body()
OdGePlane
Definition: GePlane.h:45
OdGeVector3d
Definition: GeVector3d.h:54
OdString
Definition: OdString.h:95
FacetModeler::Body::custom
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)
FacetModeler::Body::clearSurfaceTags
void clearSurfaceTags(FacetModeler::AecTagType clearValue=0)
FacetModeler::Body::insideBody
static Body insideBody(const Profile2D &rBase, double dDepth, double dDepthOrigin, const DeviationParams &devDeviation=FMGeGbl::gDefDev)
count
GLsizei GLsizei * count
Definition: gles2_ext.h:276
FacetModeler::Contour2D
Definition: FMContour2D.h:75
FacetModeler
Definition: FMContour2D.h:35
FacetModeler::Body::countEdges
OdUInt32 countEdges() const
FacetModeler::Body::deleteFace
void deleteFace(FacetModeler::Face *pFace)
FacetModeler::Body::interval
OdGeExtents3d interval() const
FacetModeler::Body::getSurfaceCount
OdUInt32 getSurfaceCount()
FacetModeler::Body::Body
Body(const Body &B)
FacetModeler::Body::clearVertexTags
void clearVertexTags(FacetModeler::AecTagType clearValue=0)
OdArray
Definition: OdArray.h:591
FacetModeler::Body::clearFaceTags
void clearFaceTags(FacetModeler::AecTagType clearValue=0)
FacetModeler::Body::SurfaceData::surfaces
OdArray< Surface * > surfaces
Definition: FMMdlBody.h:431
FacetModeler::Body::resetColors
void resetColors()
FacetModeler::Body::getSurfaceList
FacetModeler::Surface * getSurfaceList()
FacetModeler::Body::pyramid
static Body pyramid(const Profile2D &rBase, const OdGePoint3d &ptApex, const DeviationParams &devDeviation=FMGeGbl::gDefDev)
FacetModeler::Body::clear
void clear()
FacetModeler::Body::revolution
static Body revolution(const Profile2D &base, const OdGeCircArc3d &revolutionAxisAndAngles, const DeviationParams &deviation=FMGeGbl::gDefDev, const OdGeMatrix2d *pBaseTransform=0)
OdUInt32
unsigned int OdUInt32
Definition: OdPlatformSettings.h:783
FacetModeler::Body::Body
Body(class BodyImpl *pImpl)
OdGeMatrix3d
Definition: GeMatrix3d.h:73
FacetModeler::Body::addFace
void addFace(FacetModeler::Face *pFace)
FacetModeler::Body::box
static Body box(const OdGePoint3d &ptOrigin, const OdGeVector3d &vSizes)
FacetModeler::Body::addFace
FacetModeler::Face * addFace(Surface *pSurface=0)
FacetModeler::Body::clearEdgeTags
void clearEdgeTags(FacetModeler::AecTagType clearValue=0)
FacetModeler::Body::vertexCount
OdUInt32 vertexCount() const
FacetModeler::Body::clearBodyTags
void clearBodyTags(FacetModeler::AecTagType clearValue=0)
Definition: FMMdlBody.h:202
FacetModeler::Body::removeFace
void removeFace(FacetModeler::Face *pFace)
FacetModeler::Body::isClosed
bool isClosed() const
FacetModeler::Body::cachedEdgesCount
OdUInt32 cachedEdgesCount() const
FacetModeler::Surface
Definition: FMMdlSurface.h:40
FacetModeler::Body::transform
void transform(const OdGeMatrix3d &mMatrix)
FacetModeler::Body::~Body
~Body()
FacetModeler::Body::decomposeIntoLumps
void decomposeIntoLumps(std::vector< Body > &aLumps)
FacetModeler::Body::insideFrame
static Body insideFrame(const Profile2D &rBase, double dWidth, double dDepth, double dDepthOrigin, const DeviationParams &devDeviation=FMGeGbl::gDefDev)
FacetModeler::Body
Definition: FMMdlBody.h:47
FacetModeler::Body::clone
Body clone() const
OdGePoint3d
Definition: GePoint3d.h:55
OdDAI::operator!=
bool DAI_EXPORT operator!=(const OdDAI::OdSelect &left, const OdDAI::OdSelect &right)
FacetModeler::Body::slice
void slice(const OdGePlane &rCutter, Profile3D &rResult, bool bIncludeBoundary=true) const
FacetModeler::Body::slice
void slice(const Contour2D &cCutLine, const OdGePlane &pProjectOn, Profile3D &rResult, bool bIncludeBoundary=true) const
FacetModeler::Body::surfaceList
Surface * surfaceList() const
FacetModeler::revolution
FMGEOMETRY_API Body revolution(const Profile2D &base, const OdGeVector3d &revAxis, const OdGePoint3d &axisPosition, double startAng, double endAng, const DeviationParams &deviation=FMGeGbl::gDefDev)
FacetModeler::Edge
Definition: FMMdlEdge.h:43
FacetModeler::Body::vertexList
FacetModeler::Vertex * vertexList() const
FacetModeler::Body::tag
FacetModeler::AecTagType tag() const
FacetModeler::Body::intersectLine
bool intersectLine(const OdGeLinearEnt3d &gLine, std::vector< OdGePoint3d > &vecPoints, bool bSortResults=false) const
FacetModeler::Body::customC
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)
FacetModeler::Body::regeneratePairEdges
void regeneratePairEdges()
FacetModeler::Body::SurfaceData::vertexSurfData
OdArray< VertexSurfData * > vertexSurfData
Definition: FMMdlBody.h:433
FacetModeler::Body::surfaceCount
OdUInt32 surfaceCount() const
FacetModeler::Body::infExtrusion
static Body infExtrusion(const Body &rBase, const Profile3D &rCutter, const DeviationParams &devDeviation=FMGeGbl::gDefDev)
FacetModeler::FaceConstPtrArray
OdArray< const Face *, OdMemoryAllocator< const Face * > > FaceConstPtrArray
Definition: FMMdlBody.h:40
FacetModeler::Body::customInternal
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)
FacetModeler::Body::sliceFaceDbg
void sliceFaceDbg(const OdGePlane &rCutter, OdUInt32 faceNum)
FacetModeler::Body::faceCount
OdUInt32 faceCount() const
FacetModeler::Body::slice
void slice(const OdGePlane &rCutter, Profile2D *pResultIncludingBoundary, Profile2D *pResultExcludingCoincidingBoundary=0, Profile2D *pResultExcludingOppositeBoundary=0, Profile2D *pResultExcludingBoundary=0, FaceConstPtrArray *pCoincidingFaces=0, FaceConstPtrArray *pOppositeFaces=0) const
FacetModeler::Body::faceList
FacetModeler::Face * faceList() const
FacetModeler::Body::splitFace
void splitFace(FacetModeler::Face *pFace, const OdGePlane &pPlane, std::vector< FacetModeler::Face * > *pNewOuter=0, std::vector< FacetModeler::Face * > *pNewInner=0)
FacetModeler::Body::mergeCoincidentVertices
bool mergeCoincidentVertices()
FacetModeler::DeviationParams
Definition: FMGeometry.h:43
FMContour3D.h
FacetModeler::Body::boolOper
static Body boolOper(BooleanOperation eOperation, Body &rOperandA, Body &rOperandB)
FacetModeler::Body::checkInternalConsistence
bool checkInternalConsistence(OdString *pFirstErrorDetected=0) const
FacetModeler::AecTagType
ptrdiff_t AecTagType
Definition: FMMdlBase.h:42
FacetModeler::FMGeGbl::gDefDev
static FMGEOMETRY_API_STATIC DeviationParams gDefDev
Definition: FMGeometry.h:148
FacetModeler::Body::addVertex
FacetModeler::Vertex * addVertex(const OdGePoint3d &pt)
FacetModeler::Body::singleFace
static Body singleFace(const Profile2D &rBase, const DeviationParams &devDeviation=FMGeGbl::gDefDev)
FacetModeler::Face
Definition: FMMdlFace.h:47
FacetModeler::Vertex
Definition: FMMdlVertex.h:42
FacetModeler::Body::addSurface
void addSurface(Surface *pSurface)
FacetModeler::Body::combine
Body combine(Body &rAnother)
FacetModeler::Body::setSurfaceList
void setSurfaceList(FacetModeler::Surface *pList)
FacetModeler::Body::hasCoincidentEdges
bool hasCoincidentEdges() const
OdGeExtents3d
Definition: GeExtents3d.h:45
OdGeMatrix2d
Definition: GeMatrix2d.h:73
FacetModeler::Body::getVertexList
FacetModeler::Vertex * getVertexList()
FacetModeler::extrusion
FMGEOMETRY_API Body extrusion(const Profile2D &rBase, const OdGeMatrix3d &mBasePlane, const OdGeVector3d &vDir, const DeviationParams &devDeviation=FMGeGbl::gDefDev)
FacetModeler::Body::revolution
static Body revolution(const Profile2D &rBase, double dRadius, double dHeight, const DeviationParams &devDeviation=FMGeGbl::gDefDev)
FacetModeler::Body::setVertexList
void setVertexList(FacetModeler::Vertex *pList)
FacetModeler::Body::SurfaceData
Definition: FMMdlBody.h:430
FacetModeler::Profile3D
Definition: FMProfile3D.h:43
FacetModeler::Body::volume
double volume() const
OdGeLinearEnt3d
Definition: GeLinearEnt3d.h:44
FacetModeler::Profile2D
Definition: FMProfile2D.h:39
FacetModeler::Body::deleteUnusedVertices
void deleteUnusedVertices()
FacetModeler::Body::setSurfaceCount
void setSurfaceCount(OdUInt32 count)
FMMdlBase.h
OdGeTol
Definition: GeTol.h:49
FacetModeler::Body::kEmpty
static FMGEOMETRY_API_STATIC const Body kEmpty
Definition: FMMdlBody.h:265
FacetModeler::Body::isNull
bool isNull() const
FacetModeler::Body::SurfaceData::addVertexSurfData
void addVertexSurfData(int nVertex, Surface *pSurf)
FacetModeler::Body::extrusion
static Body extrusion(const Profile2D &rBase, const OdGeVector3d &vDir, const DeviationParams &devDeviation=FMGeGbl::gDefDev)
FacetModeler::Body::negate
void negate()
FacetModeler::Body::cutWithExtrusion
static Body cutWithExtrusion(Body &rBase, const Profile3D &rCutter, bool bInside, double dDepth, const DeviationParams &devDeviation=FMGeGbl::gDefDev)
FacetModeler::Body::clone_impl_if_referenced
void clone_impl_if_referenced()
OdGeCircArc3d
Definition: GeCircArc3d.h:48
FacetModeler::BooleanOperation
BooleanOperation
Definition: FMGeometry.h:56
FacetModeler::Body::containsNonManifoldEdges
bool containsNonManifoldEdges() const
FacetModeler::Body::SurfaceData::face2Surface
OdArray< Surface * > face2Surface
Definition: FMMdlBody.h:432
FacetModeler::Body::setVertexCount
void setVertexCount(OdUInt32 count)
FacetModeler::Body::setTag
void setTag(FacetModeler::AecTagType iTag)
FacetModeler::Body::cutWithInfExtrusion
static Body cutWithInfExtrusion(Body &rBase, const Profile3D &rCutter, bool bInside, const DeviationParams &devDeviation=FMGeGbl::gDefDev)