#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 MeshProjectionResult &proj, 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 |
MRMESH_API std::optional< float > | signedDistance (const Vector3f &pt, float maxDistSq, const FaceBitSet *region=nullptr) const |
MRMESH_API float | calcFastWindingNumber (const Vector3f &pt, float beta=2) const |
bool | isOutside (const Vector3f &pt, float windingNumberThreshold=0.5f, float beta=2) const |
MRMESH_API bool | isOutsideByProjNorm (const Vector3f &pt, const MeshProjectionResult &proj, const FaceBitSet *region=nullptr) const |
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 > | 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 UndirectedEdgeBitSet *creases=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 Expected< PackMapping > | packOptimally (bool preserveAABBTree, ProgressCallback cb) |
MRMESH_API void | deleteFaces (const FaceBitSet &fs, const UndirectedEdgeBitSet *keepEdges=nullptr) |
deletes multiple given faces, also deletes adjacent edges and vertices if they were not shared by remaining faces ant not in | |
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 const Dipoles & | getDipoles () const |
returns cached dipoles of aabb-tree nodes for this mesh, creating it if it did not exist in a thread-safe manner | |
const Dipoles * | getDipolesNotCreate () const |
returns cached dipoles of aabb-tree nodes for 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
|
nodiscard |
computes the area of given face-region
|
inlinenodiscard |
computes the area of given face-region (or whole mesh)
|
inlinenodiscard |
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
|
nodiscard |
computes average length of an edge in this mesh
|
nodiscard |
computes generalized winding number in a point (pt), which is
beta | determines the precision of fast approximation: the more the better, recommended value 2 or more |
|
nodiscard |
returns circumcircle diameter of given mesh triangle
|
nodiscard |
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
|
nodiscard |
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
|
nodiscard |
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
|
inlinenodiscard |
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
|
inlinenodiscard |
returns twice the area of given face
|
inlinenodiscard |
computes the length of summed directed double areas of all triangles around given vertex
MRMESH_API void MR::Mesh::deleteFaces | ( | const FaceBitSet & | fs, |
const UndirectedEdgeBitSet * | keepEdges = nullptr ) |
deletes multiple given faces, also deletes adjacent edges and vertices if they were not shared by remaining faces ant not in
keepFaces |
|
inlinenodiscard |
returns coordinates of the edge destination
|
nodiscard |
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)
|
nodiscard |
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
|
nodiscard |
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
|
nodiscard |
computes the sum of directed areas for faces from given region
|
inlinenodiscard |
computes the sum of directed areas for faces from given region (or whole mesh)
|
inlinenodiscard |
computes directed double area for a triangular face from its vertices
|
nodiscard |
computes sum of directed double areas of all triangles around given vertex
|
inlinenodiscard |
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
|
nodiscard |
computes discrete mean curvature in given edge, measures in length^-1; 0 for planar regions, positive for convex surface, negative for concave surface
|
nodiscard |
computes discrete mean curvature in given vertex, measures in length^-1; 0 for planar regions, positive for convex surface, negative for concave surface
|
inlinenodiscard |
computes the center of given edge
|
inlinenodiscard |
returns Euclidean length of the edge
|
inlinenodiscard |
returns squared Euclidean length of the edge (faster to compute than length)
|
inlinenodiscard |
computes coordinates of point given as edge and relative position on it
|
inlinenodiscard |
returns a point on the edge: origin point for f=0 and destination point for f=1
|
inlinenodiscard |
returns line segment of given edge
|
inlinenodiscard |
returns vector equal to edge destination point minus edge origin point
|
nodiscard |
computes bounding box and returns its center
|
nodiscard |
computes center of mass considering that density of all triangles is the same
|
nodiscard |
computes average position of all valid mesh vertices
|
nodiscard |
finds all mesh edges where dihedral angle is distinct from planar PI angle on at least given value
|
nodiscard |
returns vertices where the sum of triangle angles is below given threshold
|
staticnodiscard |
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
|
staticnodiscard |
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 |
|
staticnodiscard |
construct mesh from vertex coordinates and a set of triangles with given ids
|
staticnodiscard |
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
|
staticnodiscard |
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
|
inlinenodiscard |
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
|
inlinenodiscard |
returns cached aabb-tree for points of this mesh, but does not create it if it did not exist
|
nodiscard |
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
|
inlinenodiscard |
returns one of three face edges, closest to given point
|
nodiscard |
returns one of three face edges, closest to given point
|
inlinenodiscard |
returns one of three face vertices, closest to given point
|
nodiscard |
returns one of three face vertices, closest to given point
MRMESH_API const Dipoles & MR::Mesh::getDipoles | ( | ) | const |
returns cached dipoles of aabb-tree nodes for this mesh, creating it if it did not exist in a thread-safe manner
|
inlinenodiscard |
returns cached dipoles of aabb-tree nodes for this mesh, but does not create it if it did not exist
|
inlinenodiscard |
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
|
inline |
returns three points of left face of e
|
inlinenodiscard |
returns three points of given face
|
inline |
returns three points of given face
|
inline |
returns three points of given face
|
nodiscard |
|
nodiscard |
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
|
nodiscard |
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) |
|
inlinenodiscard |
computes whether a point (pt) is located outside the object surrounded by this mesh using generalized winding number
beta | determines the precision of winding number computation: the more the better, recommended value 2 or more |
|
nodiscard |
computes whether a point (pt) is located outside the object surrounded by this mesh using pseudonormal at the closest point to in on mesh (proj); this method works much faster than isOutside but can return wrong sign if the closest point is located on self-intersecting part of the mesh
|
nodiscard |
computes cotangent of the angle in the left( e ) triangle opposite to e, and returns 0 if left face does not exist
|
nodiscard |
computes directed double area of left triangular face of given edge
|
inlinenodiscard |
computes triangular face normal from its vertices
MRMESH_API void MR::Mesh::mirror | ( | const Plane3f & | plane | ) |
reflects the mesh from a given plane
|
nodiscard |
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
|
inlinenodiscard |
computes triangular face normal from its vertices
|
inlinenodiscard |
computes normal in a vertex using sum of directed areas of neighboring triangles
|
nodiscard |
compare that two meshes are exactly the same
|
inlinenodiscard |
returns coordinates of the edge origin
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 Expected< PackMapping > MR::Mesh::packOptimally | ( | bool | preserveAABBTree, |
ProgressCallback | cb ) |
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) |
|
nodiscard |
computes the sum of absolute projected area of faces from given region as visible if look from given direction
|
inlinenodiscard |
computes the sum of absolute projected area of faces from given region (or whole mesh) as visible if look from given direction
|
nodiscard |
this version returns optional without value instead of false
|
nodiscard |
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
|
nodiscard |
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
|
nodiscard |
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
|
nodiscard |
computes normalized half sum of face normals sharing given edge (only (region) faces will be considered);
|
nodiscard |
computes angle-weighted sum of normals of incident faces of given vertex (only (region) faces will be considered); the sum is normalized before returning
|
nodiscard |
computes quadratic form in the vertex as the sum of squared distances from 1) planes of adjacent triangles 2) lines of adjacent boundary and crease edges
MRMESH_API void MR::Mesh::shrinkToFit | ( | ) |
requests the removal of unused capacity
|
nodiscard |
given a point (pt) in 3D, computes the closest point on mesh, and
|
nodiscard |
given a point (pt) in 3D and the closest point to in on mesh (proj),
MRMESH_API float MR::Mesh::signedDistance | ( | const Vector3f & | pt, |
const MeshTriPoint & | proj, | ||
const FaceBitSet * | region = nullptr ) const |
|
nodiscard |
given a point (pt) in 3D, computes the closest point on mesh, and
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 |
|
nodiscard |
computes the sum of triangle angles at given vertex; optionally returns whether the vertex is on boundary
|
nodiscard |
converts edge and 3d point into edge-point representation
|
nodiscard |
converts vertex into edge-point representation
|
nodiscard |
converts face id and 3d point into barycentric representation
|
nodiscard |
converts face id and 3d point into barycentric representation
|
nodiscard |
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
|
nodiscard |
returns aspect ratio of given mesh triangle equal to the ratio of the circum-radius to twice its in-radius
|
nodiscard |
returns the centroid of given triangle
|
nodiscard |
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
|
nodiscard |
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 |