Mesh::MeshObject Class Reference

The MeshObject class provides an interface for the underlying MeshKernel class and most of its algorithm on it. More...

#include <Mesh.h>

Classes

class  const_facet_iterator
 
class  const_point_iterator
 

Public Types

enum  CutType { INNER , OUTER }
 
enum  GeometryType { PLANE , CYLINDER , SPHERE }
 
typedef std::pair< Base::Vector3f, Base::Vector3fTPlane
 
typedef std::list< std::vector< Base::Vector3f > > TPolylines
 

Public Member Functions

 MeshObject ()
 
 MeshObject (const MeshCore::MeshKernel &Kernel)
 
 MeshObject (const MeshCore::MeshKernel &Kernel, const Base::Matrix4D &Mtrx)
 
 MeshObject (const MeshObject &)
 
void operator= (const MeshObject &)
 
virtual ~MeshObject ()
 
Subelement management
virtual std::vector< const char * > getElementTypes (void) const
 Sub type list List of different subelement types its NOT a list of the subelements itself. More...
 
virtual unsigned long countSubElements (const char *Type) const
 
virtual Data::SegmentgetSubElement (const char *Type, unsigned long) const
 get the subelement by type and number More...
 
virtual void getFacesFromSubelement (const Data::Segment *, std::vector< Base::Vector3d > &Points, std::vector< Base::Vector3d > &PointNormals, std::vector< Facet > &faces) const
 Get faces from segment. More...
 
void setTransform (const Base::Matrix4D &rclTrf)
 Override the current transformation with the new one. More...
 
Base::Matrix4D getTransform (void) const
 Return the current matrix This method has to be handled by the child classes. More...
 
void transformGeometry (const Base::Matrix4D &rclMat)
 Applies a transformation on the real geometric data type. More...
 
void swap (MeshCore::MeshKernel &Kernel)
 Swaps the content of Kernel and the internal mesh kernel. More...
 
void swap (MeshObject &mesh)
 
Querying
std::string representation () const
 
std::string topologyInfo () const
 
unsigned long countPoints () const
 
unsigned long countFacets () const
 
unsigned long countEdges () const
 
unsigned long countSegments () const
 
bool isSolid () const
 
MeshPoint getPoint (unsigned long) const
 
Mesh::Facet getFacet (unsigned long) const
 
double getSurface () const
 
double getVolume () const
 
virtual void getPoints (std::vector< Base::Vector3d > &Points, std::vector< Base::Vector3d > &Normals, float Accuracy, uint16_t flags=0) const
 Get points from object with given accuracy. More...
 
virtual void getFaces (std::vector< Base::Vector3d > &Points, std::vector< Facet > &Topo, float Accuracy, uint16_t flags=0) const
 Get faces from object with given accuracy. More...
 
std::vector< unsigned long > getPointsFromFacets (const std::vector< unsigned long > &facets) const
 
void setKernel (const MeshCore::MeshKernel &m)
 
MeshCore::MeshKernelgetKernel (void)
 
const MeshCore::MeshKernelgetKernel (void) const
 
virtual Base::BoundBox3d getBoundBox (void) const
 Get the bound box. More...
 
I/O
unsigned int getMemSize (void) const
 This method is used to get the size of objects It is not meant to have the exact size, it is more or less an estimation which runs fast! Is it two bytes or a GB? More...
 
void Save (Base::Writer &writer) const
 This method is used to save properties to an XML document. More...
 
void SaveDocFile (Base::Writer &writer) const
 This method is used to save large amounts of data to a binary file. More...
 
void Restore (Base::XMLReader &reader)
 This method is used to restore properties from an XML document. More...
 
void RestoreDocFile (Base::Reader &reader)
 This method is used to restore large amounts of data from a file In this method you simply stream in your SaveDocFile() saved data. More...
 
void save (const char *file, MeshCore::MeshIO::Format f=MeshCore::MeshIO::Undefined, const MeshCore::Material *mat=0, const char *objectname=0) const
 
void save (std::ostream &, MeshCore::MeshIO::Format f, const MeshCore::Material *mat=0, const char *objectname=0) const
 
bool load (const char *file, MeshCore::Material *mat=0)
 
bool load (std::istream &, MeshCore::MeshIO::Format f, MeshCore::Material *mat=0)
 
void save (std::ostream &) const
 
void load (std::istream &)
 
Manipulation
void addFacet (const MeshCore::MeshGeomFacet &facet)
 
void addFacets (const std::vector< MeshCore::MeshGeomFacet > &facets)
 
void addFacets (const std::vector< MeshCore::MeshFacet > &facets, bool checkManifolds)
 
void addFacets (const std::vector< MeshCore::MeshFacet > &facets, const std::vector< Base::Vector3f > &points, bool checkManifolds)
 
void addFacets (const std::vector< Data::ComplexGeoData::Facet > &facets, const std::vector< Base::Vector3d > &points, bool checkManifolds)
 
void setFacets (const std::vector< MeshCore::MeshGeomFacet > &facets)
 
void setFacets (const std::vector< Data::ComplexGeoData::Facet > &facets, const std::vector< Base::Vector3d > &points)
 
void addMesh (const MeshObject &)
 Combines two independent mesh objects. More...
 
void addMesh (const MeshCore::MeshKernel &)
 Combines two independent mesh objects. More...
 
void deleteFacets (const std::vector< unsigned long > &removeIndices)
 
void deletePoints (const std::vector< unsigned long > &removeIndices)
 
std::vector< std::vector< unsigned long > > getComponents () const
 
unsigned long countComponents () const
 
void removeComponents (unsigned long)
 
unsigned long getPointDegree (const std::vector< unsigned long > &facets, std::vector< unsigned long > &point_degree) const
 Checks for the given facet indices what will be the degree for each point when these facets are removed from the mesh kernel. More...
 
void fillupHoles (unsigned long, int, MeshCore::AbstractPolygonTriangulator &)
 
void offset (float fSize)
 
void offsetSpecial2 (float fSize)
 
void offsetSpecial (float fSize, float zmax, float zmin)
 
void clear (void)
 clears the Mesh More...
 
void transformToEigenSystem ()
 
Base::Matrix4D getEigenSystem (Base::Vector3d &v) const
 
void movePoint (unsigned long, const Base::Vector3d &v)
 
void setPoint (unsigned long, const Base::Vector3d &v)
 
void smooth (int iterations, float d_max)
 
void decimate (float fTolerance, float fReduction)
 
void decimate (int targetSize)
 
Base::Vector3d getPointNormal (unsigned long) const
 
std::vector< Base::Vector3dgetPointNormals () const
 
void crossSections (const std::vector< TPlane > &, std::vector< TPolylines > &sections, float fMinEps=1.0e-2f, bool bConnectPolygons=false) const
 
void cut (const Base::Polygon2d &polygon, const Base::ViewProjMethod &proj, CutType)
 
void trim (const Base::Polygon2d &polygon, const Base::ViewProjMethod &proj, CutType)
 
void trim (const Base::Vector3f &base, const Base::Vector3f &normal)
 
Selection
void deleteSelectedFacets ()
 
void deleteSelectedPoints ()
 
void addFacetsToSelection (const std::vector< unsigned long > &) const
 
void addPointsToSelection (const std::vector< unsigned long > &) const
 
void removeFacetsFromSelection (const std::vector< unsigned long > &) const
 
void removePointsFromSelection (const std::vector< unsigned long > &) const
 
unsigned long countSelectedFacets () const
 
bool hasSelectedFacets () const
 
unsigned long countSelectedPoints () const
 
bool hasSelectedPoints () const
 
void getFacetsFromSelection (std::vector< unsigned long > &) const
 
void getPointsFromSelection (std::vector< unsigned long > &) const
 
void clearFacetSelection () const
 
void clearPointSelection () const
 
Boolean operations
MeshObjectunite (const MeshObject &) const
 
MeshObjectintersect (const MeshObject &) const
 
MeshObjectsubtract (const MeshObject &) const
 
MeshObjectinner (const MeshObject &) const
 
MeshObjectouter (const MeshObject &) const
 
Topological operations
void refine ()
 
void removeNeedles (float)
 
void optimizeTopology (float)
 
void optimizeEdges ()
 
void splitEdges ()
 
void splitEdge (unsigned long, unsigned long, const Base::Vector3f &)
 
void splitFacet (unsigned long, const Base::Vector3f &, const Base::Vector3f &)
 
void swapEdge (unsigned long, unsigned long)
 
void collapseEdge (unsigned long, unsigned long)
 
void collapseFacet (unsigned long)
 
void collapseFacets (const std::vector< unsigned long > &)
 
void insertVertex (unsigned long, const Base::Vector3f &v)
 
void snapVertex (unsigned long, const Base::Vector3f &v)
 
Mesh validation
unsigned long countNonUniformOrientedFacets () const
 
void flipNormals ()
 
void harmonizeNormals ()
 
void validateIndices ()
 
void validateCaps (float fMaxAngle, float fSplitFactor)
 
void validateDeformations (float fMaxAngle, float fEps)
 
void validateDegenerations (float fEps)
 
void removeDuplicatedPoints ()
 
void removeDuplicatedFacets ()
 
bool hasNonManifolds () const
 
bool hasInvalidNeighbourhood () const
 
bool hasPointsOutOfRange () const
 
bool hasFacetsOutOfRange () const
 
bool hasCorruptedFacets () const
 
void removeNonManifolds ()
 
void removeNonManifoldPoints ()
 
bool hasSelfIntersections () const
 
void removeSelfIntersections ()
 
void removeSelfIntersections (const std::vector< unsigned long > &)
 
void removeFoldsOnSurface ()
 
void removeFullBoundaryFacets ()
 
bool hasInvalidPoints () const
 
void removeInvalidPoints ()
 
void mergeFacets ()
 
Mesh segments
void addSegment (const Segment &)
 
void addSegment (const std::vector< unsigned long > &)
 
const SegmentgetSegment (unsigned long) const
 
SegmentgetSegment (unsigned long)
 
MeshObjectmeshFromSegment (const std::vector< unsigned long > &) const
 
std::vector< SegmentgetSegmentsOfType (GeometryType, float dev, unsigned long minFacets) const
 
- Public Member Functions inherited from Data::ComplexGeoData
 ComplexGeoData (void)
 Constructor. More...
 
virtual ~ComplexGeoData ()
 Destructor. More...
 
virtual SegmentgetSubElementByName (const char *Name) const
 get subelement by combined name More...
 
virtual void getLinesFromSubelement (const Segment *, std::vector< Base::Vector3d > &Points, std::vector< Line > &lines) const
 Get lines from segment. More...
 
void applyTransform (const Base::Matrix4D &rclTrf)
 Applies an additional transformation to the current transformation. More...
 
void applyTranslation (const Base::Vector3d &)
 Applies an additional translation to the current transformation. More...
 
void applyRotation (const Base::Rotation &)
 Applies an additional rotation to the current transformation. More...
 
void setPlacement (const Base::Placement &rclPlacement)
 Override the current transformation with a placement using the setTransform() method. More...
 
Base::Placement getPlacement () const
 Return the current transformation as placement using getTransform(). More...
 
virtual Base::Vector3d getPointFromLineIntersection (const Base::Vector3f &base, const Base::Vector3f &dir) const
 Get point from line object intersection
More...
 
virtual void getLines (std::vector< Base::Vector3d > &Points, std::vector< Line > &lines, float Accuracy, uint16_t flags=0) const
 Get lines from object with given accuracy. More...
 
virtual bool getCenterOfGravity (Base::Vector3d &center) const
 Get the center of gravity If this method is implemented then true is returned and the center of gravity. More...
 
- Public Member Functions inherited from Base::Persistence
void dumpToStream (std::ostream &stream, int compression)
 
virtual Base::Type getTypeId (void) const
 
void restoreFromStream (std::istream &stream)
 
- Public Member Functions inherited from Base::BaseClass
 BaseClass ()
 Construction. More...
 
virtual PyObjectgetPyObject (void)
 This method returns the Python wrapper for a C++ object. More...
 
bool isDerivedFrom (const Type type) const
 
virtual void setPyObject (PyObject *)
 
virtual ~BaseClass ()
 Destruction. More...
 
- Public Member Functions inherited from Base::Handled
int getRefCount (void) const
 
 Handled ()
 
const Handledoperator= (const Handled &)
 
void ref () const
 
void unref () const
 
virtual ~Handled ()
 

Static Public Member Functions

Primitives
static MeshObjectcreateMeshFromList (Py::List &list)
 
static MeshObjectcreateSphere (float, int)
 
static MeshObjectcreateEllipsoid (float, float, int)
 
static MeshObjectcreateCylinder (float, float, int, float, int)
 
static MeshObjectcreateCone (float, float, float, int, float, int)
 
static MeshObjectcreateTorus (float, float, int)
 
static MeshObjectcreateCube (float, float, float)
 
static MeshObjectcreateCube (float, float, float, float)
 
- Static Public Member Functions inherited from Data::ComplexGeoData
static const std::string & elementMapPrefix ()
 Special prefix to mark the beginning of a mapped sub-element name. More...
 
static const std::string & tagPostfix ()
 Special postfix to mark the following tag. More...
 
static const std::string & indexPostfix ()
 Special postfix to mark the index of an array element. More...
 
static const std::string & missingPrefix ()
 Special prefix to mark a missing element. More...
 
static bool hasMissingElement (const char *subname)
 Check if a subname contains missing element. More...
 
static const char * isMappedElement (const char *name)
 Check if the name starts with elementMapPrefix() More...
 
static std::string newElementName (const char *name)
 Strip out the trailing element name if there is mapped element name precedes it. More...
 
static std::string oldElementName (const char *name)
 Strip out the mapped element name if there is one. More...
 
static std::string noElementName (const char *name)
 Strip out the old and new element name if there is one. More...
 
static const char * findElementName (const char *subname)
 Find the start of an element name in a subname. More...
 
static const char * hasMappedElementName (const char *subname)
 
- Static Public Member Functions inherited from Base::Persistence
static void * create (void)
 
static std::string encodeAttribute (const std::string &)
 Encodes an attribute upon saving. More...
 
static Base::Type getClassTypeId (void)
 
static void init (void)
 
- Static Public Member Functions inherited from Base::BaseClass
static void * create (void)
 
static Type getClassTypeId (void)
 
static void init (void)
 

Iterator

typedef std::vector< Segment >::const_iterator const_segment_iterator
 
class Segment
 
const_point_iterator points_begin () const
 
const_point_iterator points_end () const
 
const_facet_iterator facets_begin () const
 
const_facet_iterator facets_end () const
 
const_segment_iterator segments_begin () const
 
const_segment_iterator segments_end () const
 

Additional Inherited Members

- Public Attributes inherited from Data::ComplexGeoData
long Tag
 
- Protected Member Functions inherited from Data::ComplexGeoData
Base::Vector3d transformToOutside (const Base::Vector3f &vec) const
 from local to outside More...
 
Base::Vector3f transformToInside (const Base::Vector3d &vec) const
 from local to inside More...
 
- Static Protected Member Functions inherited from Base::BaseClass
static void initSubclass (Base::Type &toInit, const char *ClassName, const char *ParentName, Type::instantiationMethod method=nullptr)
 

Detailed Description

The MeshObject class provides an interface for the underlying MeshKernel class and most of its algorithm on it.

Note
Each instance of MeshObject has its own instance of a MeshKernel so it's not possible that several instances of MeshObject manage one instance of MeshKernel.

Member Typedef Documentation

◆ const_segment_iterator

typedef std::vector<Segment>::const_iterator Mesh::MeshObject::const_segment_iterator

◆ TPlane

◆ TPolylines

typedef std::list<std::vector<Base::Vector3f> > Mesh::MeshObject::TPolylines

Member Enumeration Documentation

◆ CutType

Enumerator
INNER 
OUTER 

◆ GeometryType

Enumerator
PLANE 
CYLINDER 
SPHERE 

Constructor & Destructor Documentation

◆ MeshObject() [1/4]

MeshObject::MeshObject ( )

◆ MeshObject() [2/4]

MeshObject::MeshObject ( const MeshCore::MeshKernel Kernel)
explicit

◆ MeshObject() [3/4]

MeshObject::MeshObject ( const MeshCore::MeshKernel Kernel,
const Base::Matrix4D Mtrx 
)
explicit

◆ MeshObject() [4/4]

MeshObject::MeshObject ( const MeshObject mesh)

◆ ~MeshObject()

MeshObject::~MeshObject ( )
virtual

Member Function Documentation

◆ addFacet()

void MeshObject::addFacet ( const MeshCore::MeshGeomFacet facet)

Referenced by Mesh::MeshPy::addFacet().

◆ addFacets() [1/4]

void MeshObject::addFacets ( const std::vector< Data::ComplexGeoData::Facet > &  facets,
const std::vector< Base::Vector3d > &  points,
bool  checkManifolds 
)

◆ addFacets() [2/4]

void MeshObject::addFacets ( const std::vector< MeshCore::MeshFacet > &  facets,
bool  checkManifolds 
)

◆ addFacets() [3/4]

void MeshObject::addFacets ( const std::vector< MeshCore::MeshFacet > &  facets,
const std::vector< Base::Vector3f > &  points,
bool  checkManifolds 
)

◆ addFacets() [4/4]

void MeshObject::addFacets ( const std::vector< MeshCore::MeshGeomFacet > &  facets)

◆ addFacetsToSelection()

◆ addMesh() [1/2]

void MeshObject::addMesh ( const MeshCore::MeshKernel kernel)

Combines two independent mesh objects.

Note
The mesh object we want to add must not overlap or intersect with this mesh object.

◆ addMesh() [2/2]

void MeshObject::addMesh ( const MeshObject mesh)

Combines two independent mesh objects.

Note
The mesh object we want to add must not overlap or intersect with this mesh object.

Referenced by Mesh::MergeExporter::addMesh(), and Mesh::MeshPy::addMesh().

◆ addPointsToSelection()

void MeshObject::addPointsToSelection ( const std::vector< unsigned long > &  inds) const

◆ addSegment() [1/2]

◆ addSegment() [2/2]

void MeshObject::addSegment ( const std::vector< unsigned long > &  inds)

◆ clear()

void MeshObject::clear ( void  )

clears the Mesh

References setTransform().

Referenced by Mesh::MeshPy::clear().

◆ clearFacetSelection()

◆ clearPointSelection()

void MeshObject::clearPointSelection ( ) const

◆ collapseEdge()

void MeshObject::collapseEdge ( unsigned long  facet,
unsigned long  neighbour 
)

◆ collapseFacet()

void MeshObject::collapseFacet ( unsigned long  facet)

◆ collapseFacets()

void MeshObject::collapseFacets ( const std::vector< unsigned long > &  facets)

◆ countComponents()

unsigned long MeshObject::countComponents ( ) const

◆ countEdges()

unsigned long MeshObject::countEdges ( ) const

◆ countFacets()

◆ countNonUniformOrientedFacets()

unsigned long MeshObject::countNonUniformOrientedFacets ( ) const

◆ countPoints()

◆ countSegments()

◆ countSelectedFacets()

unsigned long MeshObject::countSelectedFacets ( ) const

◆ countSelectedPoints()

unsigned long MeshObject::countSelectedPoints ( ) const

◆ countSubElements()

unsigned long MeshObject::countSubElements ( const char *  Type) const
virtual

Implements Data::ComplexGeoData.

References countSegments().

◆ createCone()

MeshObject * MeshObject::createCone ( float  radius1,
float  radius2,
float  len,
int  closed,
float  edgelen,
int  sampling 
)
static

References createMeshFromList().

Referenced by Mesh::Cone::execute().

◆ createCube() [1/2]

MeshObject * MeshObject::createCube ( float  length,
float  width,
float  height 
)
static

References createMeshFromList().

Referenced by Mesh::Cube::execute().

◆ createCube() [2/2]

MeshObject * MeshObject::createCube ( float  length,
float  width,
float  height,
float  edgelen 
)
static

References createMeshFromList().

◆ createCylinder()

MeshObject * MeshObject::createCylinder ( float  radius,
float  length,
int  closed,
float  edgelen,
int  sampling 
)
static

References createMeshFromList().

Referenced by Mesh::Cylinder::execute().

◆ createEllipsoid()

MeshObject * MeshObject::createEllipsoid ( float  radius1,
float  radius2,
int  sampling 
)
static

◆ createMeshFromList()

◆ createSphere()

MeshObject * MeshObject::createSphere ( float  radius,
int  sampling 
)
static

References createMeshFromList().

Referenced by Mesh::Sphere::execute().

◆ createTorus()

MeshObject * MeshObject::createTorus ( float  radius1,
float  radius2,
int  sampling 
)
static

References createMeshFromList().

Referenced by Mesh::Torus::execute().

◆ crossSections()

void MeshObject::crossSections ( const std::vector< TPlane > &  planes,
std::vector< TPolylines > &  sections,
float  fMinEps = 1.0e-2f,
bool  bConnectPolygons = false 
) const

◆ cut()

void MeshObject::cut ( const Base::Polygon2d polygon,
const Base::ViewProjMethod proj,
MeshObject::CutType  type 
)

◆ decimate() [1/2]

void MeshObject::decimate ( float  fTolerance,
float  fReduction 
)

◆ decimate() [2/2]

void MeshObject::decimate ( int  targetSize)

◆ deleteFacets()

◆ deletePoints()

void MeshObject::deletePoints ( const std::vector< unsigned long > &  removeIndices)

◆ deleteSelectedFacets()

void MeshObject::deleteSelectedFacets ( )

◆ deleteSelectedPoints()

void MeshObject::deleteSelectedPoints ( )

◆ facets_begin()

const_facet_iterator Mesh::MeshObject::facets_begin ( ) const

◆ facets_end()

const_facet_iterator Mesh::MeshObject::facets_end ( ) const

◆ fillupHoles()

void MeshObject::fillupHoles ( unsigned long  length,
int  level,
MeshCore::AbstractPolygonTriangulator cTria 
)

◆ flipNormals()

void MeshObject::flipNormals ( )

◆ getBoundBox()

◆ getComponents()

std::vector< std::vector< unsigned long > > MeshObject::getComponents ( ) const

◆ getEigenSystem()

◆ getElementTypes()

std::vector< const char * > MeshObject::getElementTypes ( void  ) const
virtual

Sub type list List of different subelement types its NOT a list of the subelements itself.

Implements Data::ComplexGeoData.

◆ getFaces()

void MeshObject::getFaces ( std::vector< Base::Vector3d > &  Points,
std::vector< Facet > &  faces,
float  Accuracy,
uint16_t  flags = 0 
) const
virtual

Get faces from object with given accuracy.

Reimplemented from Data::ComplexGeoData.

References getPoint(), and Data::ComplexGeoData::Facet::I1.

Referenced by getFacesFromSubelement(), and Mesh::MeshPy::getTopology().

◆ getFacesFromSubelement()

void MeshObject::getFacesFromSubelement ( const Data::Segment ,
std::vector< Base::Vector3d > &  Points,
std::vector< Base::Vector3d > &  PointNormals,
std::vector< Facet > &  faces 
) const
virtual

Get faces from segment.

Reimplemented from Data::ComplexGeoData.

References getFaces().

◆ getFacet()

Mesh::Facet MeshObject::getFacet ( unsigned long  index) const

◆ getFacetsFromSelection()

void MeshObject::getFacetsFromSelection ( std::vector< unsigned long > &  inds) const

◆ getKernel() [1/2]

MeshCore::MeshKernel& Mesh::MeshObject::getKernel ( void  )

Referenced by Mesh::MeshPy::collapseEdge(), MeshPartGui::CurveOnMeshHandler::Private::createGrid(), MeshGui::MeshSelection::deleteSelection(), MeshGui::MeshSelection::deleteSelectionBorder(), MeshGui::MeshSelection::deselectComponent(), MeshGui::ViewProviderMesh::deselectComponent(), Mesh::Curvature::execute(), Mesh::SegmentByMesh::execute(), Mesh::SetOperations::execute(), MeshGui::ViewProviderMesh::faceInfo(), MeshGui::ViewProviderMesh::fillHole(), Mesh::MeshPy::getCurvaturePerVertex(), MeshGui::ViewProviderMesh::getFacetsFromPolygon(), Mesh::MeshPy::getInternalFacets(), Mesh::MeshPy::getNonUniformOrientedFacets(), Mesh::MeshPy::getSegmentsByCurvature(), MeshGui::ViewProviderMeshNode::handleEvent(), Inspection::InspectNominalFastMesh::InspectNominalFastMesh(), MeshGui::ViewProviderMesh::invertSelection(), MeshGui::ViewProviderMesh::isFacetSelected(), MeshGui::RemeshGmsh::loadOutput(), MeshPartGui::Mesh2ShapeGmsh::loadOutput(), MeshGui::SoFCMeshPickNode::notify(), MeshGui::DlgEvaluateMeshImp::on_analyzeDegeneratedButton_clicked(), MeshGui::DlgEvaluateMeshImp::on_analyzeDuplicatedFacesButton_clicked(), MeshGui::DlgEvaluateMeshImp::on_analyzeDuplicatedPointsButton_clicked(), MeshGui::DlgEvaluateMeshImp::on_analyzeFoldsButton_clicked(), MeshGui::DlgEvaluateMeshImp::on_analyzeIndicesButton_clicked(), MeshGui::DlgEvaluateMeshImp::on_analyzeNonmanifoldsButton_clicked(), MeshGui::DlgEvaluateMeshImp::on_analyzeOrientationButton_clicked(), MeshGui::DlgEvaluateMeshImp::on_analyzeSelfIntersectionButton_clicked(), MeshGui::DlgEvaluateMeshImp::on_repairAllTogether_clicked(), MeshGui::SoFCMeshPickNode::pick(), Mesh::MeshPy::rebuildNeighbourHood(), Mesh::MeshPy::rotate(), MeshGui::ViewProviderMesh::segmentMesh(), MeshGui::MeshSelection::selectComponent(), MeshGui::ViewProviderMesh::selectComponent(), MeshGui::DlgEvaluateMeshImp::showInformation(), Mesh::MeshPy::smooth(), Mesh::MeshPy::splitEdge(), Mesh::MeshPy::splitFacet(), MeshGui::ViewProviderMesh::splitMesh(), Mesh::MeshPy::swapEdge(), Mesh::MeshPy::transform(), Mesh::MeshPy::translate(), and MeshGui::PropertyMeshKernelItem::value().

◆ getKernel() [2/2]

const MeshCore::MeshKernel& Mesh::MeshObject::getKernel ( void  ) const

◆ getMemSize()

unsigned int MeshObject::getMemSize ( void  ) const
virtual

This method is used to get the size of objects It is not meant to have the exact size, it is more or less an estimation which runs fast! Is it two bytes or a GB?

Implements Base::Persistence.

◆ getPoint()

◆ getPointDegree()

unsigned long MeshObject::getPointDegree ( const std::vector< unsigned long > &  facets,
std::vector< unsigned long > &  point_degree 
) const

Checks for the given facet indices what will be the degree for each point when these facets are removed from the mesh kernel.

The point degree information is stored in point_degree. The return value gives the number of points which will have a degree of zero.

Referenced by MeshGui::ViewProviderMesh::removeFacets().

◆ getPointNormal()

◆ getPointNormals()

◆ getPoints()

void MeshObject::getPoints ( std::vector< Base::Vector3d > &  Points,
std::vector< Base::Vector3d > &  Normals,
float  Accuracy,
uint16_t  flags = 0 
) const
virtual

Get points from object with given accuracy.

Reimplemented from Data::ComplexGeoData.

References Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.

◆ getPointsFromFacets()

std::vector< unsigned long > MeshObject::getPointsFromFacets ( const std::vector< unsigned long > &  facets) const

◆ getPointsFromSelection()

void MeshObject::getPointsFromSelection ( std::vector< unsigned long > &  inds) const

◆ getSegment() [1/2]

Segment & MeshObject::getSegment ( unsigned long  index)

◆ getSegment() [2/2]

const Segment & MeshObject::getSegment ( unsigned long  index) const

◆ getSegmentsOfType()

std::vector< Segment > MeshObject::getSegmentsOfType ( MeshObject::GeometryType  type,
float  dev,
unsigned long  minFacets 
) const

◆ getSubElement()

Data::Segment * MeshObject::getSubElement ( const char *  Type,
unsigned long   
) const
virtual

get the subelement by type and number

Implements Data::ComplexGeoData.

◆ getSurface()

double MeshObject::getSurface ( ) const

◆ getTransform()

Base::Matrix4D MeshObject::getTransform ( void  ) const
virtual

Return the current matrix This method has to be handled by the child classes.

the actual placement and matrix is not part of this class.

Implements Data::ComplexGeoData.

Referenced by MeshPartGui::CurveOnMeshHandler::Private::createGrid(), Inspection::InspectActualMesh::InspectActualMesh(), Inspection::InspectNominalFastMesh::InspectNominalFastMesh(), and Inspection::InspectNominalMesh::InspectNominalMesh().

◆ getVolume()

double MeshObject::getVolume ( void  ) const

◆ harmonizeNormals()

◆ hasCorruptedFacets()

bool MeshObject::hasCorruptedFacets ( ) const

◆ hasFacetsOutOfRange()

bool MeshObject::hasFacetsOutOfRange ( ) const

◆ hasInvalidNeighbourhood()

bool MeshObject::hasInvalidNeighbourhood ( ) const

◆ hasInvalidPoints()

bool MeshObject::hasInvalidPoints ( ) const

◆ hasNonManifolds()

bool MeshObject::hasNonManifolds ( ) const

◆ hasPointsOutOfRange()

bool MeshObject::hasPointsOutOfRange ( ) const

◆ hasSelectedFacets()

◆ hasSelectedPoints()

bool MeshObject::hasSelectedPoints ( ) const

References countSelectedPoints().

◆ hasSelfIntersections()

bool MeshObject::hasSelfIntersections ( ) const

◆ inner()

◆ insertVertex()

void MeshObject::insertVertex ( unsigned long  facet,
const Base::Vector3f v 
)

◆ intersect()

◆ isSolid()

bool MeshObject::isSolid ( ) const

◆ load() [1/3]

◆ load() [2/3]

◆ load() [3/3]

bool MeshObject::load ( std::istream &  str,
MeshCore::MeshIO::Format  f,
MeshCore::Material mat = 0 
)

◆ mergeFacets()

void MeshObject::mergeFacets ( )

◆ meshFromSegment()

MeshObject * MeshObject::meshFromSegment ( const std::vector< unsigned long > &  indices) const

◆ movePoint()

void MeshObject::movePoint ( unsigned long  index,
const Base::Vector3d v 
)

◆ offset()

◆ offsetSpecial()

void MeshObject::offsetSpecial ( float  fSize,
float  zmax,
float  zmin 
)

◆ offsetSpecial2()

◆ operator=()

void MeshObject::operator= ( const MeshObject mesh)

References setTransform().

◆ optimizeEdges()

void MeshObject::optimizeEdges ( )

◆ optimizeTopology()

void MeshObject::optimizeTopology ( float  fMaxAngle)

◆ outer()

◆ points_begin()

const_point_iterator Mesh::MeshObject::points_begin ( ) const

◆ points_end()

const_point_iterator Mesh::MeshObject::points_end ( ) const

◆ refine()

◆ removeComponents()

void MeshObject::removeComponents ( unsigned long  count)

◆ removeDuplicatedFacets()

◆ removeDuplicatedPoints()

◆ removeFacetsFromSelection()

void MeshObject::removeFacetsFromSelection ( const std::vector< unsigned long > &  inds) const

◆ removeFoldsOnSurface()

◆ removeFullBoundaryFacets()

void MeshObject::removeFullBoundaryFacets ( )

◆ removeInvalidPoints()

◆ removeNeedles()

void MeshObject::removeNeedles ( float  length)

◆ removeNonManifoldPoints()

◆ removeNonManifolds()

◆ removePointsFromSelection()

void MeshObject::removePointsFromSelection ( const std::vector< unsigned long > &  inds) const

◆ removeSelfIntersections() [1/2]

◆ removeSelfIntersections() [2/2]

void MeshObject::removeSelfIntersections ( const std::vector< unsigned long > &  indices)

◆ representation()

◆ Restore()

void MeshObject::Restore ( Base::XMLReader )
virtual

This method is used to restore properties from an XML document.

It uses the XMLReader class, which bases on SAX, to read the in Save() written information. Again the Vector as an example:

void PropertyVector::Restore(Base::XMLReader &reader)
{
// read my Element
reader.readElement("PropertyVector");
// get the value of my Attribute
_cVec.x = reader.getAttributeAsFloat("valueX");
_cVec.y = reader.getAttributeAsFloat("valueY");
_cVec.z = reader.getAttributeAsFloat("valueZ");
}
The XML reader class This is an important helper class for the store and retrieval system of objects ...
Definition: Reader.h:118
void readElement(const char *ElementName=0)
read until a start element is found (<name>) or start-end element (<name/>) (with special name if giv...
Definition: Reader.cpp:240
double getAttributeAsFloat(const char *AttrName) const
return the named attribute as a double floating point (does type checking)
Definition: Reader.cpp:158

Implements Base::Persistence.

◆ RestoreDocFile()

void MeshObject::RestoreDocFile ( Base::Reader )
virtual

This method is used to restore large amounts of data from a file In this method you simply stream in your SaveDocFile() saved data.

Again you have to apply for the call of this method in the Restore() call:

{
reader.readElement("Mesh");
std::string file (reader.getAttribute("file") );
if(file == "")
{
// read XML
MeshCore::MeshDocXML restorer(*_pcMesh);
restorer.Restore(reader);
}else{
// initiate a file read
reader.addFile(file.c_str(),this);
}
}
const char * getAttribute(const char *AttrName) const
return the named attribute as a double floating point (does type checking)
Definition: Reader.cpp:173
const char * addFile(const char *Name, Base::Persistence *Object)
add a read request of a persistent object
Definition: Reader.cpp:371
void Restore(Base::XMLReader &reader)
This method is used to restore properties from an XML document.
Definition: MeshProperties.cpp:589
file
Definition: DrawingExample.py:75

After you issued the reader.addFile() your RestoreDocFile() is called:

{
_pcMesh->Read( reader );
}
Definition: Reader.h:296
void RestoreDocFile(Base::Reader &reader)
This method is used to restore large amounts of data from a file In this method you simply stream in ...
Definition: MeshProperties.cpp:620
See also
Base::Reader,Base::XMLReader

Reimplemented from Base::Persistence.

References load().

◆ Save()

void MeshObject::Save ( Base::Writer ) const
virtual

This method is used to save properties to an XML document.

A good example you'll find in PropertyStandard.cpp, e.g. the vector:

void PropertyVector::Save (Writer &writer) const
{
writer << writer.ind() << "<PropertyVector valueX=\"" << _cVec.x <<
"\" valueY=\"" << _cVec.y <<
"\" valueZ=\"" << _cVec.z <<"\"/>" << endl;
}

The writer.ind() expression writes the indentation, just for pretty printing of the XML. As you see, the writing of the XML document is not done with a DOM implementation because of performance reasons. Therefore the programmer has to take care that a valid XML document is written. This means closing tags and writing UTF-8.

See also
Base::Writer

Implements Base::Persistence.

◆ save() [1/3]

◆ save() [2/3]

◆ save() [3/3]

◆ SaveDocFile()

void MeshObject::SaveDocFile ( Base::Writer ) const
virtual

This method is used to save large amounts of data to a binary file.

Sometimes it makes no sense to write property data as XML. In case the amount of data is too big or the data type has a more effective way to save itself. In this cases it is possible to write the data in a separate file inside the document archive. In case you want do so you have to re-implement SaveDocFile(). First, you have to inform the framework in Save() that you want do so. Here an example from the Mesh module which can save a (pontetionaly big) triangle mesh:

{
if (writer.isForceXML())
{
writer << writer.ind() << "<Mesh>" << std::endl;
MeshCore::MeshDocXML saver(*_pcMesh);
saver.Save(writer);
}else{
writer << writer.ind() << "<Mesh file=\"" << writer.addFile("MeshKernel.bms", this) << "\"/>" << std::endl;
}
The Writer class This is an important helper class for the store and retrieval system of persistent o...
Definition: Writer.h:58
const char * ind(void) const
get the current indentation
Definition: Writer.h:109
std::string addFile(const char *Name, const Base::Persistence *Object)
add a write request of a persistent object
Definition: Writer.cpp:165
bool isForceXML(void)
check on state
Definition: Writer.cpp:97
void Save(Base::Writer &writer) const
This method is used to save properties to an XML document.
Definition: MeshProperties.cpp:576

The writer.isForceXML() is an indication to force you to write XML. Regardless of size and effectiveness. The second part informs the Base::writer through writer.addFile("MeshKernel.bms", this) that this object wants to write a file with the given name. The method addFile() returns a unique name that then is written in the XML stream. This allows your RestoreDocFile() method to identify and read the file again. Later your SaveDocFile() method is called as many times as you issued the addFile() call:

{
_pcMesh->Write( writer );
}
void SaveDocFile(Base::Writer &writer) const
This method is used to save large amounts of data to a binary file.
Definition: MeshProperties.cpp:615

In this method you can simply stream your content to the file (Base::Writer inheriting from ostream).

Reimplemented from Base::Persistence.

References Base::Writer::Stream().

◆ segments_begin()

const_segment_iterator Mesh::MeshObject::segments_begin ( ) const

◆ segments_end()

const_segment_iterator Mesh::MeshObject::segments_end ( ) const

◆ setFacets() [1/2]

void MeshObject::setFacets ( const std::vector< Data::ComplexGeoData::Facet > &  facets,
const std::vector< Base::Vector3d > &  points 
)

◆ setFacets() [2/2]

void MeshObject::setFacets ( const std::vector< MeshCore::MeshGeomFacet > &  facets)

◆ setKernel()

void MeshObject::setKernel ( const MeshCore::MeshKernel m)

◆ setPoint()

◆ setTransform()

void MeshObject::setTransform ( const Base::Matrix4D rclTrf)
virtual

Override the current transformation with the new one.

This method has to be handled by the child classes. the actual placement and matrix is not part of this class.

Implements Data::ComplexGeoData.

Referenced by clear(), Mesh::Feature::onChanged(), operator=(), and transformToEigenSystem().

◆ smooth()

void MeshObject::smooth ( int  iterations,
float  d_max 
)

◆ snapVertex()

void MeshObject::snapVertex ( unsigned long  facet,
const Base::Vector3f v 
)

◆ splitEdge()

void MeshObject::splitEdge ( unsigned long  facet,
unsigned long  neighbour,
const Base::Vector3f v 
)

◆ splitEdges()

◆ splitFacet()

void MeshObject::splitFacet ( unsigned long  facet,
const Base::Vector3f v1,
const Base::Vector3f v2 
)

◆ subtract()

◆ swap() [1/2]

◆ swap() [2/2]

void MeshObject::swap ( MeshObject mesh)

◆ swapEdge()

void MeshObject::swapEdge ( unsigned long  facet,
unsigned long  neighbour 
)

◆ topologyInfo()

std::string MeshObject::topologyInfo ( ) const

◆ transformGeometry()

void MeshObject::transformGeometry ( const Base::Matrix4D rclMat)
virtual

Applies a transformation on the real geometric data type.

Implements Data::ComplexGeoData.

References swap(), and MeshCore::MeshKernel::Transform().

◆ transformToEigenSystem()

void MeshObject::transformToEigenSystem ( )

◆ trim() [1/2]

void MeshObject::trim ( const Base::Polygon2d polygon,
const Base::ViewProjMethod proj,
MeshObject::CutType  type 
)

◆ trim() [2/2]

void MeshObject::trim ( const Base::Vector3f base,
const Base::Vector3f normal 
)

References deleteFacets(), and trim().

◆ unite()

◆ validateCaps()

void MeshObject::validateCaps ( float  fMaxAngle,
float  fSplitFactor 
)

◆ validateDeformations()

void MeshObject::validateDeformations ( float  fMaxAngle,
float  fEps 
)

◆ validateDegenerations()

void MeshObject::validateDegenerations ( float  fEps)

◆ validateIndices()

Friends And Related Function Documentation

◆ Segment

friend class Segment
friend

The documentation for this class was generated from the following files:
  • Sources/FreeCAD/src/Mod/Mesh/App/Mesh.h
  • Sources/FreeCAD/src/Mod/Mesh/App/Mesh.cpp