MeshLib
|
This chapter represents documentation about hole triangulations or stitching two holes. More...
Classes | |
struct | MR::FillHoleParams |
Parameters structure for MR::fillHole Structure has some options to control MR::fillHole. More... | |
struct | MR::StitchHolesParams |
Parameters structure for MR::buildCylinderBetweenTwoHoles Structure has some options to control MR::buildCylinderBetweenTwoHoles. More... | |
struct | MR::FillHoleItem |
struct | MR::HoleFillPlan |
concise representation of proposed hole triangulation More... | |
struct | MR::FillHoleMetric |
Holds metrics for fillHole and buildCylinderBetweenTwoHoles triangulation . More... | |
Typedefs | |
using | MR::FillTriangleMetric = std::function<double( VertId a, VertId b, VertId c )> |
using | MR::FillEdgeMetric = std::function<double( VertId a, VertId b, VertId l, VertId r )> |
using | MR::FillCombineMetric = std::function<double( double, double )> |
Functions | |
MRMESH_API void | MR::buildCylinderBetweenTwoHoles (Mesh &mesh, EdgeId a, EdgeId b, const StitchHolesParams ¶ms={}) |
Stitches two holes in Mesh . | |
MRMESH_API bool | MR::buildCylinderBetweenTwoHoles (Mesh &mesh, const StitchHolesParams ¶ms={}) |
this version finds holes in the mesh by itself and returns false if they are not found | |
MRMESH_API void | MR::fillHole (Mesh &mesh, EdgeId a, const FillHoleParams ¶ms={}) |
Fills hole in mesh . | |
MRMESH_API void | MR::fillHoles (Mesh &mesh, const std::vector< EdgeId > &as, const FillHoleParams ¶ms={}) |
fill all holes given by their representative edges in | |
MRMESH_API bool | MR::isHoleBd (const MeshTopology &topology, const EdgeLoop &loop) |
MRMESH_API HoleFillPlan | MR::getHoleFillPlan (const Mesh &mesh, EdgeId e, const FillHoleParams ¶ms={}) |
MRMESH_API HoleFillPlan | MR::getPlanarHoleFillPlan (const Mesh &mesh, EdgeId e) |
MRMESH_API void | MR::executeHoleFillPlan (Mesh &mesh, EdgeId a0, HoleFillPlan &plan, FaceBitSet *outNewFaces=nullptr) |
quickly triangulates the face or hole to the left of (e) given the plan (quickly compared to fillHole function) | |
MRMESH_API VertId | MR::fillHoleTrivially (Mesh &mesh, EdgeId a, FaceBitSet *outNewFaces=nullptr) |
Triangulates face of hole in mesh trivially . | |
MRMESH_API EdgeId | MR::extendHole (Mesh &mesh, EdgeId a, const Plane3f &plane, FaceBitSet *outNewFaces=nullptr) |
MRMESH_API std::vector< EdgeId > | MR::extendAllHoles (Mesh &mesh, const Plane3f &plane, FaceBitSet *outNewFaces=nullptr) |
MRMESH_API EdgeId | MR::extendHole (Mesh &mesh, EdgeId a, std::function< Vector3f(const Vector3f &)> getVertPos, FaceBitSet *outNewFaces=nullptr) |
MRMESH_API EdgeId | MR::buildBottom (Mesh &mesh, EdgeId a, Vector3f dir, float holeExtension, FaceBitSet *outNewFaces=nullptr) |
MRMESH_API EdgeId | MR::makeDegenerateBandAroundHole (Mesh &mesh, EdgeId a, FaceBitSet *outNewFaces=nullptr) |
MRMESH_API bool | MR::makeBridge (MeshTopology &topology, EdgeId a, EdgeId b, FaceBitSet *outNewFaces=nullptr) |
MRMESH_API EdgeId | MR::makeBridgeEdge (MeshTopology &topology, EdgeId a, EdgeId b) |
MRMESH_API double | MR::calcCombinedFillMetric (const Mesh &mesh, const FaceBitSet &filledRegion, const FillHoleMetric &metric) |
Computes combined metric after filling a hole. | |
MRMESH_API FillHoleMetric | MR::getCircumscribedMetric (const Mesh &mesh) |
MRMESH_API FillHoleMetric | MR::getPlaneFillMetric (const Mesh &mesh, EdgeId e) |
MRMESH_API FillHoleMetric | MR::getPlaneNormalizedFillMetric (const Mesh &mesh, EdgeId e) |
MRMESH_API FillHoleMetric | MR::getComplexStitchMetric (const Mesh &mesh) |
MRMESH_API FillHoleMetric | MR::getEdgeLengthFillMetric (const Mesh &mesh) |
Simple metric minimizing the sum of all edge lengths. | |
MRMESH_API FillHoleMetric | MR::getEdgeLengthStitchMetric (const Mesh &mesh) |
MRMESH_API FillHoleMetric | MR::getVerticalStitchMetric (const Mesh &mesh, const Vector3f &upDir) |
MRMESH_API FillHoleMetric | MR::getComplexFillMetric (const Mesh &mesh, EdgeId e) |
MRMESH_API FillHoleMetric | MR::getParallelPlaneFillMetric (const Mesh &mesh, EdgeId e, const Plane3f *plane=nullptr) |
This metric minimizes summary projection of new edges to plane normal, (try do produce edges parallel to plane) | |
MRMESH_API FillHoleMetric | MR::getMaxDihedralAngleMetric (const Mesh &mesh) |
MRMESH_API FillHoleMetric | MR::getUniversalMetric (const Mesh &mesh) |
MRMESH_API FillHoleMetric | MR::getMinTriAngleMetric (const Mesh &mesh) |
This metric maximizes the minimal angle among all faces in the triangulation. | |
MRMESH_API FillHoleMetric | MR::getMinAreaMetric (const Mesh &mesh) |
Variables | |
MRMESH_API const double | MR::BadTriangulationMetric |
This chapter represents documentation about hole triangulations or stitching two holes.
using MR::FillCombineMetric = std::function<double( double, double )> |
using MR::FillEdgeMetric = std::function<double( VertId a, VertId b, VertId l, VertId r )> |
using MR::FillTriangleMetric = std::function<double( VertId a, VertId b, VertId c )> |
MRMESH_API EdgeId MR::buildBottom | ( | Mesh & | mesh, |
EdgeId | a, | ||
Vector3f | dir, | ||
float | holeExtension, | ||
FaceBitSet * | outNewFaces = nullptr ) |
adds cylindrical extension of given hole represented by one of its edges (having no valid left face) by adding new vertices located in lowest point of the hole -dir*holeExtension and 2 * number_of_hole_edge triangles;
MRMESH_API bool MR::buildCylinderBetweenTwoHoles | ( | Mesh & | mesh, |
const StitchHolesParams & | params = {} ) |
this version finds holes in the mesh by itself and returns false if they are not found
MRMESH_API void MR::buildCylinderBetweenTwoHoles | ( | Mesh & | mesh, |
EdgeId | a, | ||
EdgeId | b, | ||
const StitchHolesParams & | params = {} ) |
Stitches two holes in Mesh
.
Build cylindrical patch to fill space between two holes represented by one of their edges each,
default metric: ComplexStitchMetric
Next picture show, how newly generated faces can be smoothed MR::positionVertsSmoothly MR::subdivideMesh
mesh | mesh with hole |
a | EdgeId which represents 1st hole (should not have valid left FaceId) |
b | EdgeId which represents 2nd hole (should not have valid left FaceId) |
params | parameters of holes stitching |
MRMESH_API double MR::calcCombinedFillMetric | ( | const Mesh & | mesh, |
const FaceBitSet & | filledRegion, | ||
const FillHoleMetric & | metric ) |
Computes combined metric after filling a hole.
MRMESH_API void MR::executeHoleFillPlan | ( | Mesh & | mesh, |
EdgeId | a0, | ||
HoleFillPlan & | plan, | ||
FaceBitSet * | outNewFaces = nullptr ) |
quickly triangulates the face or hole to the left of (e) given the plan (quickly compared to fillHole function)
MRMESH_API std::vector< EdgeId > MR::extendAllHoles | ( | Mesh & | mesh, |
const Plane3f & | plane, | ||
FaceBitSet * | outNewFaces = nullptr ) |
adds cylindrical extension of too all holes of the mesh by calling extendHole(...);
MRMESH_API EdgeId MR::extendHole | ( | Mesh & | mesh, |
EdgeId | a, | ||
const Plane3f & | plane, | ||
FaceBitSet * | outNewFaces = nullptr ) |
adds cylindrical extension of given hole represented by one of its edges (having no valid left face) by adding new vertices located in given plane and 2 * number_of_hole_edge triangles;
MRMESH_API EdgeId MR::extendHole | ( | Mesh & | mesh, |
EdgeId | a, | ||
std::function< Vector3f(const Vector3f &)> | getVertPos, | ||
FaceBitSet * | outNewFaces = nullptr ) |
adds extension of given hole represented by one of its edges (having no valid left face) by adding new vertices located at getVertPos( existing vertex position );
MRMESH_API void MR::fillHole | ( | Mesh & | mesh, |
EdgeId | a, | ||
const FillHoleParams & | params = {} ) |
Fills hole in mesh
.
Fills given hole represented by one of its edges (having no valid left face),
uses fillHoleTrivially if cannot fill hole without multiple edges,
default metric: CircumscribedFillMetric
Next picture show, how newly generated faces can be smoothed MR::positionVertsSmoothly MR::subdivideMesh
mesh | mesh with hole |
a | EdgeId which represents hole (should not have valid left FaceId) |
params | parameters of hole filling |
MRMESH_API void MR::fillHoles | ( | Mesh & | mesh, |
const std::vector< EdgeId > & | as, | ||
const FillHoleParams & | params = {} ) |
fill all holes given by their representative edges in
as |
MRMESH_API VertId MR::fillHoleTrivially | ( | Mesh & | mesh, |
EdgeId | a, | ||
FaceBitSet * | outNewFaces = nullptr ) |
Triangulates face of hole in mesh trivially
.
Fills given hole represented by one of its edges (having no valid left face)
by creating one new vertex in the centroid of boundary vertices and connecting new vertex with all boundary vertices.
Next picture show, how newly generated faces can be smoothed MR::positionVertsSmoothly MR::subdivideMesh
mesh | mesh with hole |
a | EdgeId points on the face or hole to the left that will be triangulated |
outNewFaces | optional output newly generated faces |
MRMESH_API FillHoleMetric MR::getCircumscribedMetric | ( | const Mesh & | mesh | ) |
This metric minimizes the sum of circumcircle radii for all triangles in the triangulation. It is rather fast to calculate, and it results in typically good triangulations.
MRMESH_API FillHoleMetric MR::getComplexFillMetric | ( | const Mesh & | mesh, |
EdgeId | e ) |
This metric minimizes the sum of triangleMetric for all triangles in the triangulation plus the sum edgeMetric for all edges inside and on the boundary of the triangulation.
Where
triangleMetric is proportional to weighted triangle area and triangle aspect ratio
edgeMetric grows with angle between triangles as ( ( 1 - cos( x ) ) / ( 1 + cos( x ) ) ) ^ 4.
MRMESH_API FillHoleMetric MR::getComplexStitchMetric | ( | const Mesh & | mesh | ) |
This metric minimizes the sum of triangleMetric for all triangles in the triangulation plus the sum edgeMetric for all edges inside and on the boundary of the triangulation.
Where
triangleMetric is proportional to triangle aspect ratio
edgeMetric is proportional to ( 1 - dihedralAngleCos )
MRMESH_API FillHoleMetric MR::getEdgeLengthFillMetric | ( | const Mesh & | mesh | ) |
Simple metric minimizing the sum of all edge lengths.
MRMESH_API FillHoleMetric MR::getEdgeLengthStitchMetric | ( | const Mesh & | mesh | ) |
Forbids connecting vertices from the same hole
Simple metric minimizing edge length
MRMESH_API HoleFillPlan MR::getHoleFillPlan | ( | const Mesh & | mesh, |
EdgeId | e, | ||
const FillHoleParams & | params = {} ) |
prepares the plan how to triangulate the face or hole to the left of (e) (not filling it immediately), several getHoleFillPlan can work in parallel
MRMESH_API FillHoleMetric MR::getMaxDihedralAngleMetric | ( | const Mesh & | mesh | ) |
This metric minimizes the maximal dihedral angle between the faces in the triangulation and on its boundary
MRMESH_API FillHoleMetric MR::getMinAreaMetric | ( | const Mesh & | mesh | ) |
This metric is for triangulation construction with minimal summed area of triangles. Warning: this metric can produce degenerated triangles
MRMESH_API FillHoleMetric MR::getMinTriAngleMetric | ( | const Mesh & | mesh | ) |
This metric maximizes the minimal angle among all faces in the triangulation.
MRMESH_API FillHoleMetric MR::getParallelPlaneFillMetric | ( | const Mesh & | mesh, |
EdgeId | e, | ||
const Plane3f * | plane = nullptr ) |
This metric minimizes summary projection of new edges to plane normal, (try do produce edges parallel to plane)
MRMESH_API HoleFillPlan MR::getPlanarHoleFillPlan | ( | const Mesh & | mesh, |
EdgeId | e ) |
prepares the plan how to triangulate the planar face or planar hole to the left of (e) (not filling it immediately), several getPlanarHoleFillPlan can work in parallel
MRMESH_API FillHoleMetric MR::getPlaneFillMetric | ( | const Mesh & | mesh, |
EdgeId | e ) |
Same as getCircumscribedFillMetric, but with extra penalty for the triangles having normals looking in the opposite side of plane containing left of (e).
MRMESH_API FillHoleMetric MR::getPlaneNormalizedFillMetric | ( | const Mesh & | mesh, |
EdgeId | e ) |
Similar to getPlaneFillMetric with extra penalty for the triangles having normals looking in the opposite side of plane containing left of (e), but the metric minimizes the sum of circumcircle radius times aspect ratio for all triangles in the triangulation.
MRMESH_API FillHoleMetric MR::getUniversalMetric | ( | const Mesh & | mesh | ) |
This metric minimizes the maximal dihedral angle between the faces in the triangulation and on its boundary, and it avoids creating too degenerate triangles; for planar holes it is the same as getCircumscribedMetric
MRMESH_API FillHoleMetric MR::getVerticalStitchMetric | ( | const Mesh & | mesh, |
const Vector3f & | upDir ) |
Forbids connecting vertices from the same hole
All new faces should be parallel to given direction
|
nodiscard |
returns true if given loop is a boundary of one hole in given mesh topology:
MRMESH_API bool MR::makeBridge | ( | MeshTopology & | topology, |
EdgeId | a, | ||
EdgeId | b, | ||
FaceBitSet * | outNewFaces = nullptr ) |
creates a bridge between two boundary edges a and b (both having no valid left face); bridge consists of two triangles in general or of one triangle if a and b are neighboring edges on the boundary;
MRMESH_API EdgeId MR::makeBridgeEdge | ( | MeshTopology & | topology, |
EdgeId | a, | ||
EdgeId | b ) |
creates a new bridge edge between origins of two boundary edges a and b (both having no valid left face);
MRMESH_API EdgeId MR::makeDegenerateBandAroundHole | ( | Mesh & | mesh, |
EdgeId | a, | ||
FaceBitSet * | outNewFaces = nullptr ) |
creates a band of degenerate triangles around given hole;
|
extern |
Big value, but less then DBL_MAX, to be able to pass some bad triangulations instead of breaking it e10 - real metrics to have weight in triangulation, if it would be more than e15+ some metrics will be less than double precision