#include <MRMesh.h>
Public Member Functions | |
MRMESH_API bool | operator== (const Mesh &b) const |
compare that two meshes are exactly the same | |
Vector3f | orgPnt (EdgeId e) const |
returns coordinates of the edge origin | |
Vector3f | destPnt (EdgeId e) const |
returns coordinates of the edge destination | |
Vector3f | edgeVector (EdgeId e) const |
returns vector equal to edge destination point minus edge origin point | |
LineSegm3f | edgeSegment (EdgeId e) const |
returns line segment of given edge | |
Vector3f | edgePoint (EdgeId e, float f) const |
returns a point on the edge: origin point for f=0 and destination point for f=1 | |
Vector3f | edgePoint (const MeshEdgePoint &ep) const |
computes coordinates of point given as edge and relative position on it | |
Vector3f | edgeCenter (UndirectedEdgeId e) const |
computes the center of given edge | |
MRMESH_API void | getLeftTriPoints (EdgeId e, Vector3f &v0, Vector3f &v1, Vector3f &v2) const |
returns three points of left face of e | |
void | getLeftTriPoints (EdgeId e, Vector3f(&v)[3]) const |
returns three points of left face of e | |
Triangle3f | getLeftTriPoints (EdgeId e) const |
returns three points of left face of e | |
void | getTriPoints (FaceId f, Vector3f &v0, Vector3f &v1, Vector3f &v2) const |
returns three points of given face | |
void | getTriPoints (FaceId f, Vector3f(&v)[3]) const |
returns three points of given face | |
Triangle3f | getTriPoints (FaceId f) const |
returns three points of given face | |
MRMESH_API Vector3f | triPoint (const MeshTriPoint &p) const |
computes coordinates of point given as face and barycentric representation | |
MRMESH_API Vector3f | triCenter (FaceId f) const |
returns the centroid of given triangle | |
MRMESH_API float | triangleAspectRatio (FaceId f) const |
returns aspect ratio of given mesh triangle equal to the ratio of the circum-radius to twice its in-radius | |
MRMESH_API float | circumcircleDiameterSq (FaceId f) const |
returns squared circumcircle diameter of given mesh triangle | |
MRMESH_API float | circumcircleDiameter (FaceId f) const |
returns circumcircle diameter of given mesh triangle | |
MRMESH_API MeshTriPoint | toTriPoint (VertId v) const |
converts vertex into barycentric representation | |
MRMESH_API MeshTriPoint | toTriPoint (FaceId f, const Vector3f &p) const |
converts face id and 3d point into barycentric representation | |
MRMESH_API MeshTriPoint | toTriPoint (const PointOnFace &p) const |
converts face id and 3d point into barycentric representation | |
MRMESH_API MeshEdgePoint | toEdgePoint (VertId v) const |
converts vertex into edge-point representation | |
MRMESH_API MeshEdgePoint | toEdgePoint (EdgeId e, const Vector3f &p) const |
converts edge and 3d point into edge-point representation | |
MRMESH_API VertId | getClosestVertex (const PointOnFace &p) const |
returns one of three face vertices, closest to given point | |
VertId | getClosestVertex (const MeshTriPoint &p) const |
returns one of three face vertices, closest to given point | |
MRMESH_API UndirectedEdgeId | getClosestEdge (const PointOnFace &p) const |
returns one of three face edges, closest to given point | |
UndirectedEdgeId | getClosestEdge (const MeshTriPoint &p) const |
returns one of three face edges, closest to given point | |
float | edgeLength (UndirectedEdgeId e) const |
returns Euclidean length of the edge | |
float | edgeLengthSq (UndirectedEdgeId e) const |
returns squared Euclidean length of the edge (faster to compute than length) | |
MRMESH_API Vector3f | leftDirDblArea (EdgeId e) const |
computes directed double area of left triangular face of given edge | |
Vector3f | dirDblArea (FaceId f) const |
computes directed double area for a triangular face from its vertices | |
float | dblArea (FaceId f) const |
returns twice the area of given face | |
float | area (FaceId f) const |
returns the area of given face | |
MRMESH_API double | area (const FaceBitSet &fs) const |
computes the area of given face-region | |
double | area (const FaceBitSet *fs=nullptr) const |
computes the area of given face-region (or whole mesh) | |
MRMESH_API Vector3d | dirArea (const FaceBitSet &fs) const |
computes the sum of directed areas for faces from given region | |
Vector3d | dirArea (const FaceBitSet *fs=nullptr) const |
computes the sum of directed areas for faces from given region (or whole mesh) | |
MRMESH_API double | projArea (const Vector3f &dir, const FaceBitSet &fs) const |
computes the sum of absolute projected area of faces from given region as visible if look from given direction | |
double | projArea (const Vector3f &dir, const FaceBitSet *fs=nullptr) const |
computes the sum of absolute projected area of faces from given region (or whole mesh) as visible if look from given direction | |
MRMESH_API double | volume (const FaceBitSet *region=nullptr) const |
MRMESH_API double | holePerimiter (EdgeId e) const |
computes the perimeter of the hole specified by one of its edges with no valid left face (left is hole) | |
MRMESH_API Vector3d | holeDirArea (EdgeId e) const |
Vector3f | leftNormal (EdgeId e) const |
computes triangular face normal from its vertices | |
Vector3f | normal (FaceId f) const |
computes triangular face normal from its vertices | |
MRMESH_API Vector3f | dirDblArea (VertId v) const |
computes sum of directed double areas of all triangles around given vertex | |
float | dblArea (VertId v) const |
computes the length of summed directed double areas of all triangles around given vertex | |
Vector3f | normal (VertId v) const |
computes normal in a vertex using sum of directed areas of neighboring triangles | |
MRMESH_API Vector3f | normal (const MeshTriPoint &p) const |
MRMESH_API Vector3f | pseudonormal (VertId v, const FaceBitSet *region=nullptr) const |
MRMESH_API Vector3f | pseudonormal (UndirectedEdgeId e, const FaceBitSet *region=nullptr) const |
computes normalized half sum of face normals sharing given edge (only (region) faces will be considered); | |
MRMESH_API Vector3f | pseudonormal (const MeshTriPoint &p, const FaceBitSet *region=nullptr) const |
MRMESH_API float | signedDistance (const Vector3f &pt, const MeshTriPoint &proj, const FaceBitSet *region=nullptr) const |
MRMESH_API float | signedDistance (const Vector3f &pt) const |
this version finds projection by itself in order to return signed distance from given point | |
MRMESH_API std::optional< float > | signedDistance (const Vector3f &pt, float maxDistSq, const FaceBitSet *region=nullptr) const |
this version returns optional without value if the projection point is not within maxDist | |
MRMESH_API float | sumAngles (VertId v, bool *outBoundaryVert=nullptr) const |
computes the sum of triangle angles at given vertex; optionally returns whether the vertex is on boundary | |
MRMESH_API Expected< VertBitSet, std::string > | findSpikeVertices (float minSumAngle, const VertBitSet *region=nullptr, ProgressCallback cb={}) const |
returns vertices where the sum of triangle angles is below given threshold | |
MRMESH_API float | dihedralAngleSin (UndirectedEdgeId e) const |
MRMESH_API float | dihedralAngleCos (UndirectedEdgeId e) const |
MRMESH_API float | dihedralAngle (UndirectedEdgeId e) const |
MRMESH_API float | discreteMeanCurvature (VertId v) const |
MRMESH_API float | discreteMeanCurvature (UndirectedEdgeId e) const |
float | discreteGaussianCurvature (VertId v, bool *outBoundaryVert=nullptr) const |
MRMESH_API UndirectedEdgeBitSet | findCreaseEdges (float angleFromPlanar) const |
finds all mesh edges where dihedral angle is distinct from planar PI angle on at least given value | |
MRMESH_API float | leftCotan (EdgeId e) const |
float | cotan (UndirectedEdgeId ue) const |
MRMESH_API QuadraticForm3f | quadraticForm (VertId v, const FaceBitSet *region=nullptr) const |
MRMESH_API Box3f | computeBoundingBox (const AffineXf3f *toWorld=nullptr) const |
MRMESH_API Box3f | getBoundingBox () const |
MRMESH_API Box3f | computeBoundingBox (const FaceBitSet *region, const AffineXf3f *toWorld=nullptr) const |
MRMESH_API float | averageEdgeLength () const |
computes average length of an edge in this mesh | |
MRMESH_API Vector3f | findCenterFromPoints () const |
computes average position of all valid mesh vertices | |
MRMESH_API Vector3f | findCenterFromFaces () const |
computes center of mass considering that density of all triangles is the same | |
MRMESH_API Vector3f | findCenterFromBBox () const |
computes bounding box and returns its center | |
MRMESH_API void | zeroUnusedPoints () |
for all points not in topology.getValidVerts() sets coordinates to (0,0,0) | |
MRMESH_API void | transform (const AffineXf3f &xf, const VertBitSet *region=nullptr) |
MRMESH_API VertId | addPoint (const Vector3f &pos) |
creates new point and assigns given position to it | |
MRMESH_API EdgeId | addSeparateEdgeLoop (const std::vector< Vector3f > &contourPoints) |
MRMESH_API EdgeId | addSeparateContours (const Contours3f &contours, const AffineXf3f *xf=nullptr) |
MRMESH_API void | attachEdgeLoopPart (EdgeId first, EdgeId last, const std::vector< Vector3f > &contourPoints) |
MRMESH_API EdgeId | splitEdge (EdgeId e, const Vector3f &newVertPos, FaceBitSet *region=nullptr, FaceHashMap *new2Old=nullptr) |
EdgeId | splitEdge (EdgeId e, FaceBitSet *region=nullptr, FaceHashMap *new2Old=nullptr) |
MRMESH_API VertId | splitFace (FaceId f, const Vector3f &newVertPos, FaceBitSet *region=nullptr, FaceHashMap *new2Old=nullptr) |
VertId | splitFace (FaceId f, FaceBitSet *region=nullptr, FaceHashMap *new2Old=nullptr) |
MRMESH_API void | addPart (const Mesh &from, FaceMap *outFmap=nullptr, VertMap *outVmap=nullptr, WholeEdgeMap *outEmap=nullptr, bool rearrangeTriangles=false) |
appends mesh (from) in addition to this mesh: creates new edges, faces, verts and points | |
MRMESH_API void | addPartByMask (const Mesh &from, const FaceBitSet &fromFaces, const PartMapping &map) |
the same but copies only portion of (from) specified by fromFaces | |
MRMESH_API void | addPartByMask (const Mesh &from, const FaceBitSet &fromFaces, bool flipOrientation=false, const std::vector< EdgePath > &thisContours={}, const std::vector< EdgePath > &fromContours={}, const PartMapping &map={}) |
MRMESH_API void | addPartByFaceMap (const Mesh &from, const FaceMap &fromFaces, bool flipOrientation=false, const std::vector< EdgePath > &thisContours={}, const std::vector< EdgePath > &fromContours={}, const PartMapping &map={}) |
fromFaces contains mapping from this-mesh (considering it is empty) to from-mesh | |
template<typename I > | |
MRMESH_API void | addPartBy (const Mesh &from, I fbegin, I fend, size_t fcount, bool flipOrientation=false, const std::vector< EdgePath > &thisContours={}, const std::vector< EdgePath > &fromContours={}, PartMapping map={}) |
both addPartByMask and addPartByFaceMap call this general implementation | |
MRMESH_API Mesh | cloneRegion (const FaceBitSet ®ion, bool flipOrientation=false, const PartMapping &map={}) const |
creates new mesh from given triangles of this mesh | |
MRMESH_API void | pack (FaceMap *outFmap=nullptr, VertMap *outVmap=nullptr, WholeEdgeMap *outEmap=nullptr, bool rearrangeTriangles=false) |
MRMESH_API PackMapping | packOptimally (bool preserveAABBTree=true) |
MRMESH_API void | deleteFaces (const FaceBitSet &fs) |
deletes multiple given faces | |
MRMESH_API bool | projectPoint (const Vector3f &point, PointOnFace &res, float maxDistSq=FLT_MAX, const FaceBitSet *region=nullptr, const AffineXf3f *xf=nullptr) const |
MRMESH_API bool | projectPoint (const Vector3f &point, MeshProjectionResult &res, float maxDistSq=FLT_MAX, const FaceBitSet *region=nullptr, const AffineXf3f *xf=nullptr) const |
MRMESH_API std::optional< MeshProjectionResult > | projectPoint (const Vector3f &point, float maxDistSq=FLT_MAX, const FaceBitSet *region=nullptr, const AffineXf3f *xf=nullptr) const |
this version returns optional without value instead of false | |
MRMESH_API const AABBTree & | getAABBTree () const |
returns cached aabb-tree for this mesh, creating it if it did not exist in a thread-safe manner | |
const AABBTree * | getAABBTreeNotCreate () const |
returns cached aabb-tree for this mesh, but does not create it if it did not exist | |
MRMESH_API const AABBTreePoints & | getAABBTreePoints () const |
returns cached aabb-tree for points of this mesh, creating it if it did not exist in a thread-safe manner | |
const AABBTreePoints * | getAABBTreePointsNotCreate () const |
returns cached aabb-tree for points of this mesh, but does not create it if it did not exist | |
MRMESH_API void | invalidateCaches (bool pointsChanged=true) |
MRMESH_API void | updateCaches (const VertBitSet &changedVerts) |
MRMESH_API size_t | heapBytes () const |
MRMESH_API void | shrinkToFit () |
requests the removal of unused capacity | |
MRMESH_API void | mirror (const Plane3f &plane) |
reflects the mesh from a given plane | |
Static Public Member Functions | |
static MRMESH_API Mesh | fromTriangles (VertCoords vertexCoordinates, const Triangulation &t, const MeshBuilder::BuildSettings &settings={}, ProgressCallback cb={}) |
construct mesh from vertex coordinates and a set of triangles with given ids | |
static MRMESH_API Mesh | fromTriMesh (TriMesh &&triMesh, const MeshBuilder::BuildSettings &settings={}, ProgressCallback cb={}) |
construct mesh from TriMesh representation | |
static MRMESH_API Mesh | fromTrianglesDuplicatingNonManifoldVertices (VertCoords vertexCoordinates, Triangulation &t, std::vector< MeshBuilder::VertDuplication > *dups=nullptr, const MeshBuilder::BuildSettings &settings={}) |
static MRMESH_API Mesh | fromFaceSoup (VertCoords vertexCoordinates, const std::vector< VertId > &verts, const Vector< MeshBuilder::VertSpan, FaceId > &faces, const MeshBuilder::BuildSettings &settings={}, ProgressCallback cb={}) |
static MRMESH_API Mesh | fromPointTriples (const std::vector< Triangle3f > &posTriples, bool duplicateNonManifoldVertices) |
Public Attributes | |
MeshTopology | topology |
VertCoords | points |
This class represents a mesh, including topology (connectivity) information and point coordinates, as well as some caches to accelerate search algorithms
MRMESH_API void MR::Mesh::addPart | ( | const Mesh & | from, |
FaceMap * | outFmap = nullptr, | ||
VertMap * | outVmap = nullptr, | ||
WholeEdgeMap * | outEmap = nullptr, | ||
bool | rearrangeTriangles = false ) |
appends mesh (from) in addition to this mesh: creates new edges, faces, verts and points
MRMESH_API void MR::Mesh::addPartBy | ( | const Mesh & | from, |
I | fbegin, | ||
I | fend, | ||
size_t | fcount, | ||
bool | flipOrientation = false, | ||
const std::vector< EdgePath > & | thisContours = {}, | ||
const std::vector< EdgePath > & | fromContours = {}, | ||
PartMapping | map = {} ) |
both addPartByMask and addPartByFaceMap call this general implementation
MRMESH_API void MR::Mesh::addPartByFaceMap | ( | const Mesh & | from, |
const FaceMap & | fromFaces, | ||
bool | flipOrientation = false, | ||
const std::vector< EdgePath > & | thisContours = {}, | ||
const std::vector< EdgePath > & | fromContours = {}, | ||
const PartMapping & | map = {} ) |
fromFaces contains mapping from this-mesh (considering it is empty) to from-mesh
MRMESH_API void MR::Mesh::addPartByMask | ( | const Mesh & | from, |
const FaceBitSet & | fromFaces, | ||
bool | flipOrientation = false, | ||
const std::vector< EdgePath > & | thisContours = {}, | ||
const std::vector< EdgePath > & | fromContours = {}, | ||
const PartMapping & | map = {} ) |
this version has more parameters: if flipOrientation then every from triangle is inverted before adding
MRMESH_API void MR::Mesh::addPartByMask | ( | const Mesh & | from, |
const FaceBitSet & | fromFaces, | ||
const PartMapping & | map ) |
the same but copies only portion of (from) specified by fromFaces
MRMESH_API VertId MR::Mesh::addPoint | ( | const Vector3f & | pos | ) |
creates new point and assigns given position to it
MRMESH_API EdgeId MR::Mesh::addSeparateContours | ( | const Contours3f & | contours, |
const AffineXf3f * | xf = nullptr ) |
append points to mesh and connect them returns first EdgeId of new edges
MRMESH_API EdgeId MR::Mesh::addSeparateEdgeLoop | ( | const std::vector< Vector3f > & | contourPoints | ) |
append points to mesh and connect them as closed edge loop returns first EdgeId of new edges
MRMESH_API double MR::Mesh::area | ( | const FaceBitSet & | fs | ) | const |
computes the area of given face-region
|
inline |
computes the area of given face-region (or whole mesh)
|
inline |
returns the area of given face
MRMESH_API void MR::Mesh::attachEdgeLoopPart | ( | EdgeId | first, |
EdgeId | last, | ||
const std::vector< Vector3f > & | contourPoints ) |
append points to mesh and connect them to given edges making edge loop first point connects with first edge dest last point connects with last edge org note that first and last edge should have no left face
MRMESH_API float MR::Mesh::averageEdgeLength | ( | ) | const |
computes average length of an edge in this mesh
MRMESH_API float MR::Mesh::circumcircleDiameter | ( | FaceId | f | ) | const |
returns circumcircle diameter of given mesh triangle
MRMESH_API float MR::Mesh::circumcircleDiameterSq | ( | FaceId | f | ) | const |
returns squared circumcircle diameter of given mesh triangle
MRMESH_API Mesh MR::Mesh::cloneRegion | ( | const FaceBitSet & | region, |
bool | flipOrientation = false, | ||
const PartMapping & | map = {} ) const |
creates new mesh from given triangles of this mesh
MRMESH_API Box3f MR::Mesh::computeBoundingBox | ( | const AffineXf3f * | toWorld = nullptr | ) | const |
passes through all valid vertices and finds the minimal bounding box containing all of them; if toWorld transformation is given then returns minimal bounding box in world space
MRMESH_API Box3f MR::Mesh::computeBoundingBox | ( | const FaceBitSet * | region, |
const AffineXf3f * | toWorld = nullptr ) const |
passes through all given faces (or whole mesh if region == null) and finds the minimal bounding box containing all of them if toWorld transformation is given then returns minimal bounding box in world space
|
inline |
computes sum of cotangents of the angle in the left and right triangles opposite to given edge, and returns 0 if left face does not exist
|
inline |
returns twice the area of given face
|
inline |
computes the length of summed directed double areas of all triangles around given vertex
MRMESH_API void MR::Mesh::deleteFaces | ( | const FaceBitSet & | fs | ) |
deletes multiple given faces
MRMESH_API float MR::Mesh::dihedralAngle | ( | UndirectedEdgeId | e | ) | const |
given an edge between two triangular faces, computes the dihedral angle between them: 0 if both faces are in the same plane, positive if the faces form convex surface, negative if the faces form concave surface; please consider the usage of faster dihedralAngleSin(e) and dihedralAngleCos(e)
MRMESH_API float MR::Mesh::dihedralAngleCos | ( | UndirectedEdgeId | e | ) | const |
given an edge between two triangular faces, computes cosine of dihedral angle between them: 1 if both faces are in the same plane, 0 if the surface makes right angle turn at the edge, -1 if the faces overlap one another
MRMESH_API float MR::Mesh::dihedralAngleSin | ( | UndirectedEdgeId | e | ) | const |
given an edge between two triangular faces, computes sine of dihedral angle between them: 0 if both faces are in the same plane, positive if the faces form convex surface, negative if the faces form concave surface
MRMESH_API Vector3d MR::Mesh::dirArea | ( | const FaceBitSet & | fs | ) | const |
computes the sum of directed areas for faces from given region
|
inline |
computes the sum of directed areas for faces from given region (or whole mesh)
computes directed double area for a triangular face from its vertices
MRMESH_API Vector3f MR::Mesh::dirDblArea | ( | VertId | v | ) | const |
computes sum of directed double areas of all triangles around given vertex
|
inline |
computes discrete Gaussian curvature (or angle defect) at given vertex, which 0 in inner vertices on planar mesh parts and reaches 2*pi on needle's tip, see http://math.uchicago.edu/~may/REU2015/REUPapers/Upadhyay.pdf optionally returns whether the vertex is on boundary
MRMESH_API float MR::Mesh::discreteMeanCurvature | ( | UndirectedEdgeId | e | ) | const |
computes discrete mean curvature in given edge, measures in length^-1; 0 for planar regions, positive for convex surface, negative for concave surface
MRMESH_API float MR::Mesh::discreteMeanCurvature | ( | VertId | v | ) | const |
computes discrete mean curvature in given vertex, measures in length^-1; 0 for planar regions, positive for convex surface, negative for concave surface
|
inline |
computes the center of given edge
|
inline |
returns Euclidean length of the edge
|
inline |
returns squared Euclidean length of the edge (faster to compute than length)
|
inline |
computes coordinates of point given as edge and relative position on it
returns a point on the edge: origin point for f=0 and destination point for f=1
|
inline |
returns line segment of given edge
returns vector equal to edge destination point minus edge origin point
MRMESH_API Vector3f MR::Mesh::findCenterFromBBox | ( | ) | const |
computes bounding box and returns its center
MRMESH_API Vector3f MR::Mesh::findCenterFromFaces | ( | ) | const |
computes center of mass considering that density of all triangles is the same
MRMESH_API Vector3f MR::Mesh::findCenterFromPoints | ( | ) | const |
computes average position of all valid mesh vertices
MRMESH_API UndirectedEdgeBitSet MR::Mesh::findCreaseEdges | ( | float | angleFromPlanar | ) | const |
finds all mesh edges where dihedral angle is distinct from planar PI angle on at least given value
MRMESH_API Expected< VertBitSet, std::string > MR::Mesh::findSpikeVertices | ( | float | minSumAngle, |
const VertBitSet * | region = nullptr, | ||
ProgressCallback | cb = {} ) const |
returns vertices where the sum of triangle angles is below given threshold
|
static |
construct mesh from vertex coordinates and construct mesh topology from face soup, where each face can have arbitrary degree (not only triangles); all non-triangular faces will be automatically subdivided on triangles
|
static |
construct mesh from point triples;
duplicateNonManifoldVertices | = false, all coinciding points are given the same VertId in the result; |
duplicateNonManifoldVertices | = true, it tries to avoid non-manifold vertices by creating duplicate vertices with same coordinates |
|
static |
construct mesh from vertex coordinates and a set of triangles with given ids
|
static |
construct mesh from vertex coordinates and a set of triangles with given ids; unlike simple fromTriangles() it tries to resolve non-manifold vertices by creating duplicate vertices
|
static |
construct mesh from TriMesh representation
triMesh | points of triMesh will be moves in the result |
MRMESH_API const AABBTree & MR::Mesh::getAABBTree | ( | ) | const |
returns cached aabb-tree for this mesh, creating it if it did not exist in a thread-safe manner
|
inline |
returns cached aabb-tree for this mesh, but does not create it if it did not exist
MRMESH_API const AABBTreePoints & MR::Mesh::getAABBTreePoints | ( | ) | const |
returns cached aabb-tree for points of this mesh, creating it if it did not exist in a thread-safe manner
|
inline |
returns cached aabb-tree for points of this mesh, but does not create it if it did not exist
MRMESH_API Box3f MR::Mesh::getBoundingBox | ( | ) | const |
returns the bounding box containing all valid vertices (implemented via getAABBTree()) this bounding box is insignificantly bigger that minimal box due to AABB algorithms precision
|
inline |
returns one of three face edges, closest to given point
MRMESH_API UndirectedEdgeId MR::Mesh::getClosestEdge | ( | const PointOnFace & | p | ) | const |
returns one of three face edges, closest to given point
|
inline |
returns one of three face vertices, closest to given point
MRMESH_API VertId MR::Mesh::getClosestVertex | ( | const PointOnFace & | p | ) | const |
returns one of three face vertices, closest to given point
|
inline |
returns three points of left face of e
MRMESH_API void MR::Mesh::getLeftTriPoints | ( | EdgeId | e, |
Vector3f & | v0, | ||
Vector3f & | v1, | ||
Vector3f & | v2 ) const |
returns three points of left face of e
returns three points of left face of e
|
inline |
returns three points of given face
returns three points of given face
returns three points of given face
MRMESH_API size_t MR::Mesh::heapBytes | ( | ) | const |
MRMESH_API Vector3d MR::Mesh::holeDirArea | ( | EdgeId | e | ) | const |
computes directed area of the hole specified by one of its edges with no valid left face (left is hole); if the hole is planar then returned vector is orthogonal to the plane pointing outside and its magnitude is equal to hole area
MRMESH_API double MR::Mesh::holePerimiter | ( | EdgeId | e | ) | const |
computes the perimeter of the hole specified by one of its edges with no valid left face (left is hole)
MRMESH_API void MR::Mesh::invalidateCaches | ( | bool | pointsChanged = true | ) |
invalidates caches (aabb-trees) after any change in mesh geometry or topology
pointsChanged | specifies whether points have changed (otherwise only topology has changed) |
MRMESH_API float MR::Mesh::leftCotan | ( | EdgeId | e | ) | const |
computes cotangent of the angle in the left( e ) triangle opposite to e, and returns 0 if left face does not exist
MRMESH_API Vector3f MR::Mesh::leftDirDblArea | ( | EdgeId | e | ) | const |
computes directed double area of left triangular face of given edge
computes triangular face normal from its vertices
MRMESH_API void MR::Mesh::mirror | ( | const Plane3f & | plane | ) |
reflects the mesh from a given plane
MRMESH_API Vector3f MR::Mesh::normal | ( | const MeshTriPoint & | p | ) | const |
computes normal in three vertices of p's triangle, then interpolates them using barycentric coordinates and normalizes again; this is the same normal as in rendering with smooth shading
computes triangular face normal from its vertices
computes normal in a vertex using sum of directed areas of neighboring triangles
MRMESH_API bool MR::Mesh::operator== | ( | const Mesh & | b | ) | const |
compare that two meshes are exactly the same
MRMESH_API void MR::Mesh::pack | ( | FaceMap * | outFmap = nullptr, |
VertMap * | outVmap = nullptr, | ||
WholeEdgeMap * | outEmap = nullptr, | ||
bool | rearrangeTriangles = false ) |
tightly packs all arrays eliminating lone edges and invalid face, verts and points, optionally returns mappings: old.id -> new.id
MRMESH_API PackMapping MR::Mesh::packOptimally | ( | bool | preserveAABBTree = true | ) |
packs tightly and rearranges vertices, triangles and edges to put close in space elements in close indices
preserveAABBTree | whether to keep valid mesh's AABB tree after return (it will take longer to compute and it will occupy more memory) |
MRMESH_API double MR::Mesh::projArea | ( | const Vector3f & | dir, |
const FaceBitSet & | fs ) const |
computes the sum of absolute projected area of faces from given region as visible if look from given direction
|
inline |
computes the sum of absolute projected area of faces from given region (or whole mesh) as visible if look from given direction
MRMESH_API std::optional< MeshProjectionResult > MR::Mesh::projectPoint | ( | const Vector3f & | point, |
float | maxDistSq = FLT_MAX, | ||
const FaceBitSet * | region = nullptr, | ||
const AffineXf3f * | xf = nullptr ) const |
this version returns optional without value instead of false
MRMESH_API bool MR::Mesh::projectPoint | ( | const Vector3f & | point, |
MeshProjectionResult & | res, | ||
float | maxDistSq = FLT_MAX, | ||
const FaceBitSet * | region = nullptr, | ||
const AffineXf3f * | xf = nullptr ) const |
finds closest point on this mesh (or its region) to given point; xf is mesh-to-point transformation, if not specified then identity transformation is assumed
MRMESH_API bool MR::Mesh::projectPoint | ( | const Vector3f & | point, |
PointOnFace & | res, | ||
float | maxDistSq = FLT_MAX, | ||
const FaceBitSet * | region = nullptr, | ||
const AffineXf3f * | xf = nullptr ) const |
finds closest point on this mesh (or its region) to given point; xf is mesh-to-point transformation, if not specified then identity transformation is assumed
MRMESH_API Vector3f MR::Mesh::pseudonormal | ( | const MeshTriPoint & | p, |
const FaceBitSet * | region = nullptr ) const |
returns pseudonormal in corresponding face/edge/vertex for signed distance calculation; http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.107.9173&rep=rep1&type=pdf unlike normal( const MeshTriPoint & p ), this is not a smooth function
MRMESH_API Vector3f MR::Mesh::pseudonormal | ( | UndirectedEdgeId | e, |
const FaceBitSet * | region = nullptr ) const |
computes normalized half sum of face normals sharing given edge (only (region) faces will be considered);
MRMESH_API Vector3f MR::Mesh::pseudonormal | ( | VertId | v, |
const FaceBitSet * | region = nullptr ) const |
computes angle-weighted sum of normals of incident faces of given vertex (only (region) faces will be considered); the sum is normalized before returning
MRMESH_API QuadraticForm3f MR::Mesh::quadraticForm | ( | VertId | v, |
const FaceBitSet * | region = nullptr ) const |
computes quadratic form in the vertex as the sum of squared distances from 1) planes of adjacent triangles 2) lines of adjacent boundary edges
MRMESH_API void MR::Mesh::shrinkToFit | ( | ) |
requests the removal of unused capacity
MRMESH_API float MR::Mesh::signedDistance | ( | const Vector3f & | pt | ) | const |
this version finds projection by itself in order to return signed distance from given point
MRMESH_API float MR::Mesh::signedDistance | ( | const Vector3f & | pt, |
const MeshTriPoint & | proj, | ||
const FaceBitSet * | region = nullptr ) const |
given a point (p) in 3D and the closest point to in on mesh (proj), computes the signed distance from pt to mesh: positive value - outside mesh, negative - inside mesh
MRMESH_API std::optional< float > MR::Mesh::signedDistance | ( | const Vector3f & | pt, |
float | maxDistSq, | ||
const FaceBitSet * | region = nullptr ) const |
this version returns optional without value if the projection point is not within maxDist
MRMESH_API EdgeId MR::Mesh::splitEdge | ( | EdgeId | e, |
const Vector3f & | newVertPos, | ||
FaceBitSet * | region = nullptr, | ||
FaceHashMap * | new2Old = nullptr ) |
split given edge on two parts: dest(returned-edge) = org(e) - newly created vertex, org(returned-edge) = org(e-before-split), dest(e) = dest(e-before-split)
left and right faces of given edge if valid are also subdivided on two parts each; if left or right faces of the original edge were in the region, then include new parts of these faces in the region
new2Old | receive mapping from newly appeared triangle to its original triangle (part to full) |
|
inline |
MRMESH_API VertId MR::Mesh::splitFace | ( | FaceId | f, |
const Vector3f & | newVertPos, | ||
FaceBitSet * | region = nullptr, | ||
FaceHashMap * | new2Old = nullptr ) |
split given triangle on three triangles, introducing new vertex with given coordinates and connecting it to original triangle vertices; if region is given, then it must include (f) and new faces will be added there as well
new2Old | receive mapping from newly appeared triangle to its original triangle (part to full) |
|
inline |
MRMESH_API float MR::Mesh::sumAngles | ( | VertId | v, |
bool * | outBoundaryVert = nullptr ) const |
computes the sum of triangle angles at given vertex; optionally returns whether the vertex is on boundary
MRMESH_API MeshEdgePoint MR::Mesh::toEdgePoint | ( | EdgeId | e, |
const Vector3f & | p ) const |
converts edge and 3d point into edge-point representation
MRMESH_API MeshEdgePoint MR::Mesh::toEdgePoint | ( | VertId | v | ) | const |
converts vertex into edge-point representation
MRMESH_API MeshTriPoint MR::Mesh::toTriPoint | ( | const PointOnFace & | p | ) | const |
converts face id and 3d point into barycentric representation
MRMESH_API MeshTriPoint MR::Mesh::toTriPoint | ( | FaceId | f, |
const Vector3f & | p ) const |
converts face id and 3d point into barycentric representation
MRMESH_API MeshTriPoint MR::Mesh::toTriPoint | ( | VertId | v | ) | const |
converts vertex into barycentric representation
MRMESH_API void MR::Mesh::transform | ( | const AffineXf3f & | xf, |
const VertBitSet * | region = nullptr ) |
applies given transformation to specified vertices if region is nullptr, all valid mesh vertices are used
MRMESH_API float MR::Mesh::triangleAspectRatio | ( | FaceId | f | ) | const |
returns aspect ratio of given mesh triangle equal to the ratio of the circum-radius to twice its in-radius
MRMESH_API Vector3f MR::Mesh::triCenter | ( | FaceId | f | ) | const |
returns the centroid of given triangle
MRMESH_API Vector3f MR::Mesh::triPoint | ( | const MeshTriPoint & | p | ) | const |
computes coordinates of point given as face and barycentric representation
MRMESH_API void MR::Mesh::updateCaches | ( | const VertBitSet & | changedVerts | ) |
updates existing caches in case of few vertices were changed insignificantly, and topology remained unchanged; it shall be considered as a faster alternative to invalidateCaches() and following rebuild of trees
MRMESH_API double MR::Mesh::volume | ( | const FaceBitSet * | region = nullptr | ) | const |
returns volume of closed mesh region, if region is not closed DBL_MAX is returned if region is nullptr - whole mesh is region
MRMESH_API void MR::Mesh::zeroUnusedPoints | ( | ) |
for all points not in topology.getValidVerts() sets coordinates to (0,0,0)
VertCoords MR::Mesh::points |
MeshTopology MR::Mesh::topology |