CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
FMMdlBody.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2024, 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 Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2024 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
31class OdGeCircArc3d;
32namespace GeMesh { class OdGeTrMesh; }
33
34namespace FacetModeler
35{
40 {
41 public:
46
55 Body(const Body& B);
56
66 Body& operator = (const Body& B);
67
74 bool operator == (const Body& aBody) const;
75
82 bool operator != (const Body& aBody) const;
83
87 void clear();
88
94 Body clone() const;
95
105 Body combine(Body& rAnother);
106
117 void decomposeIntoLumps(std::vector<Body>& aLumps);
118
124 void transform(const OdGeMatrix3d& mMatrix);
125
129 void negate();
130
135
140
145
152
153
159 void mergeCoplanarEntities(bool mergeOnlyWithDiffrentFlags = false);
160
167
179 bool checkInternalConsistence(OdString* pFirstErrorDetected = NULL) const;
180
186 bool hasCoincidentEdges() const;
187
194
200 bool isNull() const;
201
207 bool isClosed() const;
208
217 void splitFace(Face* pFace,
218 const OdGePlane& pPlane,
219 std::vector<Face*>* pNewOuter = NULL,
220 std::vector<Face*>* pNewInner = NULL);
221
223 // Tags and flags
225
231 void clearVertexTags(TagType clearValue = 0);
232
238 void clearSurfaceTags(TagType clearValue = 0);
239
245 void clearEdgeTags(TagType clearValue = 0);
246
252 void clearFaceTags(TagType clearValue = 0);
253
259 void clearFaceFlags(OdUInt32 clearValue = 0);
260
266 inline void clearBodyTags(TagType clearValue = 0) { setTag(clearValue); }
267
273 TagType tag() const;
274
280 void setTag(TagType iTag);
281
283 // Geometric properties
285
292
298 double volume() const;
299
301 // Intersections
303
311 void slice(const OdGePlane& rCutter,
312 Profile3D& rResult, bool bIncludeBoundary = true) const;
313
320 void slice(const OdGePlane& rCutter, Body& result, TagType tagSection = 0) const;
321
333 bool intersectLine(const OdGeLinearEnt3d& gLine,
334 std::vector< OdGePoint3d >& aPoints, bool bSortResults = false) const;
335
337 // Primitives
339
348 static Body box(const OdGePoint3d& ptOrigin,
349 const OdGeVector3d& vSizes);
350
360 static Body pyramid(const Profile2D& rBase,
361 const OdGePoint3d& ptApex,
362 const DeviationParams& deviation = FMGeGbl::gDefDev);
363
373 static Body extrusion(const Profile2D& rBase,
374 const OdGeVector3d& vDir,
375 const DeviationParams& deviation = FMGeGbl::gDefDev);
376
386 static Body extrusion(const Profile2D& rBase,
387 const Contour3D& rPath,
388 const DeviationParams& deviation = FMGeGbl::gDefDev);
389
400 static Body extrusion(const Profile2D& rBase,
401 const OdGePoint3dArray& rPath,
402 const OdGeVector3d& vNormal,
403 const DeviationParams& devDeviation = FMGeGbl::gDefDev);
404
419 static Body extrusion(const Profile2D& rBase,
420 const OdGeMatrix3d& mBasePlane,
421 const OdGeVector3d& vDir,
422 const DeviationParams& deviation = FMGeGbl::gDefDev);
423
433 static Body revolution(const Profile2D& rBase,
434 double dRadius, double dHeight,
435 const DeviationParams& deviation = FMGeGbl::gDefDev);
436
447 const Profile2D& base,
448 const OdGeCircArc3d& revAxisAndAngles,
449 const DeviationParams& deviation = FMGeGbl::gDefDev,
450 const OdGeMatrix2d* pBaseTransform = NULL);
451
469 const Profile2D& base,
470 const OdGeVector3d& revAxis,
471 const OdGePoint3d& axisPosition,
472 double startAng,
473 double endAng,
474 const DeviationParams& deviation = FMGeGbl::gDefDev);
475
486 static Body boolOper(BooleanOperation eOperation,
487 Body& rOperandA, Body& rOperandB, bool bOptimization = false);
488
512 const std::vector<OdGePoint3d>& aVertices,
513 const std::vector<OdInt32>& aFaceData,
514 const std::vector<OdUInt32>* aFaceFlags = NULL,
515 const std::vector<OdUInt32>* aEdgeFlags = NULL,
516 const std::vector<OdUInt32>* aVertexFlags = NULL,
517 const std::vector<OdUInt32>* pFaceColors = NULL,
518 const std::vector<OdUInt32>* pEdgeColors = NULL,
519 const std::vector<OdGePoint2d>* pMappingCoords = NULL
520 );
521
528
530 // Working with topological entities
532
538 void setColor(OdUInt32 iColor);
539
548 void addFace(Face* pFace);
549
558 void removeFace(Face* pFace);
559
568 void deleteFace(Face* pFace);
569
575 void addSurface(Surface* pSurface);
576
582 void addVertex(Vertex* pVertex);
583
591
598 Face* addFace(Surface* pSurface = NULL);
599
606
613
623
630
637
643 Face* faceList() const;
644
651
658
664 void setVertexList(Vertex* pList);
665
671 void setFaceList(Face* pList);
672
679
685
695
705
715
718
723
735 void simplify(double param);
736
737#if 0
738 public:
739 void testCheckUnusedSurfaceData();
740#endif
741
742 protected:
748 explicit Body(class BodyImpl* pImpl);
749
750 private:
751
752 BodyImpl* m_pImpl; // Implementation object pointer.
753
754 //DOM-IGNORE-BEGIN
755 friend class Vertex;
756 friend class Face;
757 friend class Surface;
758 friend class BodyImpl;
759 friend class BodyCustom;
761 //DOM-IGNORE-END
762 };
763
775 FMGEOMETRY_API void MarkShadedSurfaces(Body& aBody, double angleTol, bool bDetectSharpEdges = false);
776
783
790 void MergeShadedSurfaces(Body& aBody, const OdArray<std::set<Surface*> >& shadedMergeData);
791
792}
793
794#endif //__FMMDL_BODY_H__
OdArray< OdGePoint3d, OdMemoryAllocator< OdGePoint3d > > OdGePoint3dArray
#define FMGEOMETRY_API
#define FMGEOMETRY_API_STATIC
bool operator!=(T left, const OdGiVariant::EnumType right)
Definition GiVariant.h:405
bool operator==(T left, const OdGiVariant::EnumType right)
Definition GiVariant.h:399
unsigned int OdUInt32
static Body pyramid(const Profile2D &rBase, const OdGePoint3d &ptApex, const DeviationParams &deviation=FMGeGbl::gDefDev)
static Body extrusion(const Profile2D &rBase, const Contour3D &rPath, const DeviationParams &deviation=FMGeGbl::gDefDev)
void setVertexList(Vertex *pList)
void removeFace(Face *pFace)
void deleteUnusedSurfaces()
bool checkInternalConsistence(OdString *pFirstErrorDetected=NULL) const
friend class Vertex
Definition FMMdlBody.h:755
void setSurfaceCount(OdUInt32 count)
bool mergeCoincidentVertices()
Surface * surfaceList() const
void setTag(TagType iTag)
OdUInt32 surfaceCount() const
static Body extrusion(const Profile2D &rBase, const OdGeVector3d &vDir, const DeviationParams &deviation=FMGeGbl::gDefDev)
static Body createFromMesh(const std::vector< OdGePoint3d > &aVertices, const std::vector< OdInt32 > &aFaceData, const std::vector< OdUInt32 > *aFaceFlags=NULL, const std::vector< OdUInt32 > *aEdgeFlags=NULL, const std::vector< OdUInt32 > *aVertexFlags=NULL, const std::vector< OdUInt32 > *pFaceColors=NULL, const std::vector< OdUInt32 > *pEdgeColors=NULL, const std::vector< OdGePoint2d > *pMappingCoords=NULL)
void setVertexCount(OdUInt32 count)
friend class BodyInternalConsistencyRestorer
Definition FMMdlBody.h:760
void addSurface(Surface *pSurface)
void slice(const OdGePlane &rCutter, Profile3D &rResult, bool bIncludeBoundary=true) const
friend class Surface
Definition FMMdlBody.h:757
void deleteUnusedVertices()
static Body box(const OdGePoint3d &ptOrigin, const OdGeVector3d &vSizes)
Body combine(Body &rAnother)
void clearFaceFlags(OdUInt32 clearValue=0)
double volume() const
static Body boolOper(BooleanOperation eOperation, Body &rOperandA, Body &rOperandB, bool bOptimization=false)
void regeneratePairEdges()
OdUInt32 faceCount() const
void splitFace(Face *pFace, const OdGePlane &pPlane, std::vector< Face * > *pNewOuter=NULL, std::vector< Face * > *pNewInner=NULL)
bool intersectLine(const OdGeLinearEnt3d &gLine, std::vector< OdGePoint3d > &aPoints, bool bSortResults=false) const
void transform(const OdGeMatrix3d &mMatrix)
friend class Face
Definition FMMdlBody.h:756
static Body revolution(const Profile2D &rBase, double dRadius, double dHeight, const DeviationParams &deviation=FMGeGbl::gDefDev)
void clearBodyTags(TagType clearValue=0)
Definition FMMdlBody.h:266
void slice(const OdGePlane &rCutter, Body &result, TagType tagSection=0) const
void setFaceList(Face *pList)
OdUInt32 cachedEdgesCount() const
Face * faceList() const
void addFace(Face *pFace)
static Body extrusion(const Profile2D &rBase, const OdGeMatrix3d &mBasePlane, const OdGeVector3d &vDir, const DeviationParams &deviation=FMGeGbl::gDefDev)
Vertex * vertexList() const
void clearEdgeTags(TagType clearValue=0)
Vertex * addVertex(const OdGePoint3d &pt)
bool hasCoincidentEdges() const
void mergeCoplanarEntities(bool mergeOnlyWithDiffrentFlags=false)
void setSurfaceList(Surface *pList)
void setColor(OdUInt32 iColor)
bool hasCoincidentVertices() const
OdUInt32 vertexCount() const
static Body revolution(const Profile2D &base, const OdGeVector3d &revAxis, const OdGePoint3d &axisPosition, double startAng, double endAng, const DeviationParams &deviation=FMGeGbl::gDefDev)
void setFaceCount(OdUInt32 count)
bool isClosed() const
void clearSurfaceTags(TagType clearValue=0)
bool containsNonManifoldEdges() const
friend class BodyImpl
Definition FMMdlBody.h:758
void clearFaceTags(TagType clearValue=0)
void generateMesh(GeMesh::OdGeTrMesh &mesh) const
OdGeExtents3d interval() const
static Body extrusion(const Profile2D &rBase, const OdGePoint3dArray &rPath, const OdGeVector3d &vNormal, const DeviationParams &devDeviation=FMGeGbl::gDefDev)
Body(const Body &B)
OdUInt32 countEdges() const
static Body revolution(const Profile2D &base, const OdGeCircArc3d &revAxisAndAngles, const DeviationParams &deviation=FMGeGbl::gDefDev, const OdGeMatrix2d *pBaseTransform=NULL)
void simplify(double param)
void decomposeIntoLumps(std::vector< Body > &aLumps)
void addVertex(Vertex *pVertex)
void clearVertexTags(TagType clearValue=0)
TagType tag() const
void deleteFace(Face *pFace)
friend class BodyCustom
Definition FMMdlBody.h:759
static FMGEOMETRY_API_STATIC const Body kEmpty
Definition FMMdlBody.h:717
Body clone() const
Face * addFace(Surface *pSurface=NULL)
bool isNull() const
Body(class BodyImpl *pImpl)
GLsizei GLsizei * count
Definition gles2_ext.h:276
FMGEOMETRY_API void MarkShadedSurfaces(Body &aBody, double angleTol, bool bDetectSharpEdges=false)
void MergeShadedSurfaces(Body &aBody, const OdArray< std::set< Surface * > > &shadedMergeData)
FMGEOMETRY_API void ClearShadedSurfaces(Body &aBody)
ptrdiff_t TagType
Definition FMMdlBase.h:46
static FMGEOMETRY_API_STATIC DeviationParams gDefDev
Definition FMGeometry.h:161