ImFusion SDK 4.3
ImFusion::MeshProcessing::Geometry Namespace Reference

Mesh processing algorithms related to geometrical operations. More...

Detailed Description

Mesh processing algorithms related to geometrical operations.

Classes

struct  DominantPlaneOptimizerSettings
 Structure representing the settings for the optimizor used to compute dominant plane of the mesh. More...
 

Functions

std::vector< std::vector< vec3 > > intersection (const Mesh &mesh, const ImFusion::Geometry::Plane &plane)
 Computes an intersection of a mesh and a plane.
 
bool intersects (const Mesh &mesh, const ImFusion::Geometry::Plane &plane, double tolerance=0.0, double *outDistance=nullptr)
 Computes an intersection of a mesh and a plane.
 
std::vector< vec3 > intersection (const Mesh &mesh, const ImFusion::Geometry::Line &line)
 Computes all intersections between the given mesh and a line.
 
std::vector< vec3 > intersection (const Mesh &mesh, const ImFusion::Geometry::LineSegment &line)
 
bool meshDistance (const Mesh &meshSrc, const Mesh &meshDst, std::vector< double > &dist, bool computeSurfaceDistance=true, bool signedDistance=false)
 Compute the nearest neighbor distance to the source mesh for every destination mesh vertex.
 
bool pointToSurfaceDistance (const Mesh &meshSrc, const std::vector< vec3 > &pointsDst, std::vector< double > &dist, bool signedDistance=false, std::vector< int > *closestFaceId=nullptr, Progress *p=nullptr)
 Compute the nearest neighbor distance to the source mesh for every destination point.
 
bool pointToPointDistance (const std::vector< vec3 > &pointsSrc, const std::vector< vec3 > &pointsDst, std::vector< double > &dist, std::vector< int > *srcToDstMapping=nullptr)
 Compute the nearest neighbor distance to the source points for every destination point.
 
bool isPointInsideMesh (const Mesh &mesh, const vec3 &p)
 Estimate location of the point with respect to mesh.
 
ImFusion::Geometry::Line findMajorAxis (const Mesh &mesh)
 Estimate the major axis of the mesh.
 
ImFusion::Geometry::Plane findDominantPlane (const Mesh &mesh, double *inlierRatio=nullptr, const ImFusion::MeshProcessing::Geometry::DominantPlaneOptimizerSettings &settings=ImFusion::MeshProcessing::Geometry::DominantPlaneOptimizerSettings())
 Estimate a dominant plane of the mesh.
 

Function Documentation

◆ intersection() [1/2]

std::vector< std::vector< vec3 > > intersection ( const Mesh & mesh,
const ImFusion::Geometry::Plane & plane )

Computes an intersection of a mesh and a plane.

Parameters
[in]meshmesh
[in]planeplane
Returns
vector of polylines representing connected contours formed from sorted intersection points An individual contour is closed if the returned Polygon has its first point equal to the last one.
Note
If a mesh triangle lies in the same plane as the intersection plane, no intersection points are added for such triangle

◆ intersects()

bool intersects ( const Mesh & mesh,
const ImFusion::Geometry::Plane & plane,
double tolerance = 0.0,
double * outDistance = nullptr )

Computes an intersection of a mesh and a plane.

Parameters
[in]meshmesh
[in]planeplane
[in]toleranceOptional tolerance in world units for the intersection computation
[out]outDistanceOptional output parameter to return unsigned distance from the closest vertex to plane. Will be set to 0 if the plane intersects the mesh within the specified tolerance
Returns
true if the mesh intersects with the plane.
Note
This method is faster than MeshProcessing::Geometry::intersection.

◆ intersection() [2/2]

std::vector< vec3 > intersection ( const Mesh & mesh,
const ImFusion::Geometry::Line & line )

Computes all intersections between the given mesh and a line.

Parameters
[in]meshmesh
[in]lineline
Returns
intersections between the given mesh and a line. The result is ordered by where the points are on the line.

◆ meshDistance()

bool meshDistance ( const Mesh & meshSrc,
const Mesh & meshDst,
std::vector< double > & dist,
bool computeSurfaceDistance = true,
bool signedDistance = false )

Compute the nearest neighbor distance to the source mesh for every destination mesh vertex.

Parameters
[in]meshSrcsource mesh
[in]meshDstdestination mesh
[out]distvector of distances between vertices of meshDst and meshSrc, its size is the number of vertices in meshDst
[in]computeSurfaceDistanceif false, the distance from each vertex of MeshDst to closest vertex of MeshSrc will be computed, otherwise the distance from each vertex of MeshDst to the surface of MeshSrc will be computed
[in]signedDistanceif true, the signed distance will be computed, otherwise an absolute distance will be computed. Note that signed distances only work when computeSurfaceDistance is true
Returns
true upon successful computation

◆ pointToSurfaceDistance()

bool pointToSurfaceDistance ( const Mesh & meshSrc,
const std::vector< vec3 > & pointsDst,
std::vector< double > & dist,
bool signedDistance = false,
std::vector< int > * closestFaceId = nullptr,
Progress * p = nullptr )

Compute the nearest neighbor distance to the source mesh for every destination point.

Parameters
[in]meshSrcsource mesh
[in]pointsDstdestination points
[out]distvector of distances between meshSrc and pointsDst, its size is the size of pointsDst
[in]signedDistanceif true, the signed distance will be computed, otherwise an absolute distance will be computed
[out]closestFaceIdoptional vector containing the ids of the closest faces from meshSrc
Returns
true upon successful computation

◆ pointToPointDistance()

bool pointToPointDistance ( const std::vector< vec3 > & pointsSrc,
const std::vector< vec3 > & pointsDst,
std::vector< double > & dist,
std::vector< int > * srcToDstMapping = nullptr )

Compute the nearest neighbor distance to the source points for every destination point.

Parameters
[in]pointsSrcsource points
[in]pointsDstdestination points
[out]distvector of distances between pointsSrc and pointsDst, its size is the size of pointsDst
[out]srcToDstMappingoptional vector representing the mapping between pointsSrc to pointsDst, has the size of pointsDst
Returns
true upon successful computation

◆ isPointInsideMesh()

bool isPointInsideMesh ( const Mesh & mesh,
const vec3 & p )

Estimate location of the point with respect to mesh.

Points on the mesh will be considered as inside

Parameters
[in]mesh
[in]ppoint
Returns
point location

◆ findMajorAxis()

ImFusion::Geometry::Line findMajorAxis ( const Mesh & mesh)

Estimate the major axis of the mesh.

Parameters
[in]meshmesh
Returns
estimated axis

◆ findDominantPlane()

Estimate a dominant plane of the mesh.

Parameters
[in]meshmesh
[out]inlierRatio(optional) ratio of inlier faces wrt to total number of faces
[in]settings(optional) settings for the optimizor
Returns
estimated plane
Search Tab / S to search, Esc to close