MeshLib Documentation
Loading...
Searching...
No Matches
AABB Tree overview

This chapter represents documentation about AABB Tree. More...

Classes

class  MR::Cuda::FastWindingNumber
 
class  MR::AABBTree
 
struct  MR::BoxedLeaf< T >
 
struct  MR::AABBTreeTraits< L, B >
 
struct  MR::AABBTreeNode< T >
 
class  MR::AABBTreeObjects
 
class  MR::AABBTreePoints
 bounding volume hierarchy for point cloud structure More...
 
struct  MR::PolylineTraits< V >
 
struct  MR::PolylineTraits< Vector2f >
 
struct  MR::PolylineTraits< Vector3f >
 
class  MR::AABBTreePolyline< V >
 bounding volume hierarchy for line segments More...
 
struct  MR::FaceFace
 
struct  MR::UndirectedEdgeUndirectedEdge
 
class  MR::FastWindingNumber
 
struct  MR::IntersectionPrecomputes< T >
 
struct  MR::IntersectionPrecomputes2< T >
 
struct  MR::EdgeTri
 edge from one mesh and triangle from another mesh More...
 
struct  MR::PreciseCollisionResult
 
struct  MR::DistanceToMeshOptions
 
struct  MR::MeshIntersectionResult
 
struct  MR::MultiRayMeshIntersectResult
 
struct  MR::MultiMeshIntersectionResult
 
struct  MR::Line3Mesh< T >
 
struct  MR::MeshMeshDistanceResult
 
struct  MR::MeshMeshSignedDistanceResult
 
struct  MR::MeshProjectionResult
 
struct  MR::Ball
 
struct  MR::SignedDistanceToMeshResult
 
struct  MR::PointsProjectionResult
 
struct  MR::PolylineProjectionResult< V >
 
struct  MR::PolylineProjectionWithOffsetResult< V >
 
class  MR::UniqueThreadSafeOwner< T >
 

Typedefs

using MR::FaceTreeTraits3 = AABBTreeTraits<FaceTag, Box3f>
 
template<typename V >
using MR::LineTreeTraits = AABBTreeTraits<UndirectedEdgeTag, Box<V>>
 
using MR::LineTreeTraits2 = LineTreeTraits<Vector2f>
 
using MR::LineTreeTraits3 = LineTreeTraits<Vector3f>
 
template<typename T >
using MR::AABBTreeNodeVec = Vector<AABBTreeNode<T>, NodeId>
 
using MR::TriangleCallback = std::function<ProcessOneResult( const Vector3f & p, FaceId f, const Vector3f & q, float distSq )>
 
using MR::Line3fMesh = Line3Mesh<float>
 
using MR::Line3dMesh = Line3Mesh<double>
 
using MR::MeshIntersectionCallback = std::function<bool(const MeshIntersectionResult &)>
 
using MR::FoundTriCallback = std::function<Processing( const MeshProjectionResult & found, Ball & ball )>
 this callback is invoked on every triangle at least partially in the ball, and allows to change the ball
 
template<typename V >
using MR::FoundEdgeCallback = std::function<void( UndirectedEdgeId, const V& closestPt, float distSq )>
 
using MR::FoundEdgeCallback2 = FoundEdgeCallback<Vector2f>
 
using MR::FoundEdgeCallback3 = FoundEdgeCallback<Vector3f>
 

Enumerations

enum class  MR::ProcessOneResult : bool { MR::ProcessOneResult::StopProcessing = false , MR::ProcessOneResult::ContinueProcessing = true }
 

Functions

int MR::getNumNodes (int numLeaves)
 returns the number of nodes in the binary tree with given number of leaves
 
template<typename T >
AABBTreeNodeVec< T > MR::makeAABBTreeNodeVec (Buffer< BoxedLeaf< T > > boxedLeaves)
 
template<typename T >
void MR::findMaxVectorDim (int &dimX, int &dimY, int &dimZ, const Vector3< T > &dir)
 finds index of maximum axis and stores it into dimZ
 
 MR::IntersectionPrecomputes< T >::IntersectionPrecomputes ()=default
 
 MR::IntersectionPrecomputes< T >::IntersectionPrecomputes (const Vector3< T > &dir)
 
template<typename T >
void MR::findMaxVectorDim (int &dimX, int &dimY, const Vector2< T > &dir)
 finds index of maximum axis and stores it into dimY
 
MRMESH_API std::vector< FaceFaceMR::findCollidingTriangles (const MeshPart &a, const MeshPart &b, const AffineXf3f *rigidB2A=nullptr, bool firstIntersectionOnly=false)
 finds all pairs of colliding triangles from two meshes or two mesh regions
 
MRMESH_API std::pair< FaceBitSet, FaceBitSet > MR::findCollidingTriangleBitsets (const MeshPart &a, const MeshPart &b, const AffineXf3f *rigidB2A=nullptr)
 the same as findCollidingTriangles, but returns one bite set per mesh with colliding triangles
 
MRMESH_API Expected< bool > MR::findSelfCollidingTriangles (const MeshPart &mp, std::vector< FaceFace > *outCollidingPairs, ProgressCallback cb={}, const Face2RegionMap *regionMap=nullptr)
 finds all pairs (or the fact of any self-collision) of colliding triangles from one mesh or a region
 
MRMESH_API Expected< std::vector< FaceFace > > MR::findSelfCollidingTriangles (const MeshPart &mp, ProgressCallback cb={}, const Face2RegionMap *regionMap=nullptr)
 finds all pairs of colliding triangles from one mesh or a region
 
MRMESH_API Expected< FaceBitSet > MR::findSelfCollidingTrianglesBS (const MeshPart &mp, ProgressCallback cb={}, const Face2RegionMap *regionMap=nullptr)
 the same findSelfCollidingTriangles but returns the union of all self-intersecting faces
 
MRMESH_API bool MR::isInside (const MeshPart &a, const MeshPart &b, const AffineXf3f *rigidB2A=nullptr)
 checks that arbitrary mesh part A is inside of closed mesh part B
 
MRMESH_API bool MR::isNonIntersectingInside (const MeshPart &a, const MeshPart &b, const AffineXf3f *rigidB2A=nullptr)
 checks that arbitrary mesh part A is inside of closed mesh part B The version of isInside without collision check; it is user's responsibility to guarantee that the meshes don't collide
 
bool MR::operator== (const EdgeTri &a, const EdgeTri &b)
 
MRMESH_API PreciseCollisionResult MR::findCollidingEdgeTrisPrecise (const MeshPart &a, const MeshPart &b, ConvertToIntVector conv, const AffineXf3f *rigidB2A=nullptr, bool anyIntersection=false)
 finds all pairs of colliding edges from one mesh and triangle from another mesh
 
MRMESH_API std::vector< EdgeTriMR::findCollidingEdgeTrisPrecise (const Mesh &a, const std::vector< EdgeId > &edgesA, const Mesh &b, const std::vector< FaceId > &facesB, ConvertToIntVector conv, const AffineXf3f *rigidB2A=nullptr)
 finds all intersections between every given edge from A and given triangles from B
 
MRMESH_API std::vector< EdgeTriMR::findCollidingEdgeTrisPrecise (const Mesh &a, const std::vector< FaceId > &facesA, const Mesh &b, const std::vector< EdgeId > &edgesB, ConvertToIntVector conv, const AffineXf3f *rigidB2A=nullptr)
 finds all intersections between every given triangle from A and given edge from B
 
MRMESH_API CoordinateConverters MR::getVectorConverters (const MeshPart &a, const MeshPart &b, const AffineXf3f *rigidB2A=nullptr)
 creates simple converters from Vector3f to Vector3i and back in mesh parts area range
 
MRMESH_API VertId MR::findDirMax (const Vector3f &dir, const MeshPart &mp, UseAABBTree u=UseAABBTree::Yes)
 
MRMESH_API void MR::processCloseTriangles (const MeshPart &mp, const Triangle3f &t, float rangeSq, const TriangleCallback &call)
 
MRMESH_API std::optional< float > MR::signedDistanceToMesh (const MeshPart &mp, const Vector3f &p, const DistanceToMeshOptions &op)
 
MRMESH_API MeshIntersectionResult MR::rayMeshIntersect (const MeshPart &meshPart, const Line3f &line, float rayStart=0.0f, float rayEnd=FLT_MAX, const IntersectionPrecomputes< float > *prec=nullptr, bool closestIntersect=true, const FacePredicate &validFaces={})
 
MRMESH_API MeshIntersectionResult MR::rayMeshIntersect (const MeshPart &meshPart, const Line3d &line, double rayStart=0.0, double rayEnd=DBL_MAX, const IntersectionPrecomputes< double > *prec=nullptr, bool closestIntersect=true, const FacePredicate &validFaces={})
 
MRMESH_API void MR::multiRayMeshIntersect (const MeshPart &meshPart, const std::vector< Vector3f > &origins, const std::vector< Vector3f > &dirs, const MultiRayMeshIntersectResult &result, float rayStart=0.0f, float rayEnd=FLT_MAX, bool closestIntersect=true, const FacePredicate &validFaces={})
 
MRMESH_API MultiMeshIntersectionResult MR::rayMultiMeshAnyIntersect (const std::vector< Line3fMesh > &lineMeshes, float rayStart=0.0f, float rayEnd=FLT_MAX)
 
MRMESH_API MultiMeshIntersectionResult MR::rayMultiMeshAnyIntersect (const std::vector< Line3dMesh > &lineMeshes, double rayStart=0.0, double rayEnd=DBL_MAX)
 Same as rayMultiMeshAnyIntersectF, but use double precision.
 
MRMESH_API void MR::rayMeshIntersectAll (const MeshPart &meshPart, const Line3f &line, MeshIntersectionCallback callback, float rayStart=0.0f, float rayEnd=FLT_MAX, const IntersectionPrecomputes< float > *prec=nullptr)
 
MRMESH_API void MR::rayMeshIntersectAll (const MeshPart &meshPart, const Line3d &line, MeshIntersectionCallback callback, double rayStart=0.0, double rayEnd=DBL_MAX, const IntersectionPrecomputes< double > *prec=nullptr)
 Same as rayMeshIntersectAllF, but use double precision.
 
MRMESH_API void MR::xyPlaneMeshIntersect (const MeshPart &meshPart, float zLevel, FaceBitSet *fs, UndirectedEdgeBitSet *ues, VertBitSet *vs)
 
MRMESH_API MeshMeshDistanceResult MR::findDistance (const MeshPart &a, const MeshPart &b, const AffineXf3f *rigidB2A=nullptr, float upDistLimitSq=FLT_MAX)
 computes minimal distance between two meshes or two mesh regions
 
MRMESH_API MeshMeshSignedDistanceResult MR::findSignedDistance (const MeshPart &a, const MeshPart &b, const AffineXf3f *rigidB2A=nullptr, float upDistLimitSq=FLT_MAX)
 computes minimal distance between two meshes
 
MRMESH_API float MR::findMaxDistanceSqOneWay (const MeshPart &a, const MeshPart &b, const AffineXf3f *rigidB2A=nullptr, float maxDistanceSq=FLT_MAX)
 returns the maximum of the squared distances from each B-mesh vertex to A-mesh
 
MRMESH_API float MR::findMaxDistanceSq (const MeshPart &a, const MeshPart &b, const AffineXf3f *rigidB2A=nullptr, float maxDistanceSq=FLT_MAX)
 returns the squared Hausdorff distance between two meshes, that is the maximum of squared distances from each mesh vertex to the other mesh (in both directions)
 
MRMESH_API MeshProjectionResult MR::findProjection (const Vector3f &pt, const MeshPart &mp, float upDistLimitSq=FLT_MAX, const AffineXf3f *xf=nullptr, float loDistLimitSq=0, const FacePredicate &validFaces={}, const std::function< bool(const MeshProjectionResult &)> &validProjections={})
 computes the closest point on mesh (or its region) to given point
 
MRMESH_API MeshProjectionResult MR::findProjectionSubtree (const Vector3f &pt, const MeshPart &mp, const AABBTree &tree, float upDistLimitSq=FLT_MAX, const AffineXf3f *xf=nullptr, float loDistLimitSq=0, const FacePredicate &validFaces={}, const std::function< bool(const MeshProjectionResult &)> &validProjections={})
 computes the closest point on mesh (or its region) to given point
 
MRMESH_API void MR::findTrisInBall (const MeshPart &mp, Ball ball, const FoundTriCallback &foundCallback, const FacePredicate &validFaces={})
 
MRMESH_API std::optional< SignedDistanceToMeshResultMR::findSignedDistance (const Vector3f &pt, const MeshPart &mp, float upDistLimitSq=FLT_MAX, float loDistLimitSq=0)
 computes the closest point on mesh (or its region) to given point, and finds the distance with sign to it (positive - outside, negative - inside the mesh)
 
MRMESH_API void MR::findPointsInBall (const PointCloud &pointCloud, const Vector3f &center, float radius, const FoundPointCallback &foundCallback, const AffineXf3f *xf=nullptr)
 
MRMESH_API void MR::findPointsInBall (const Mesh &mesh, const Vector3f &center, float radius, const FoundPointCallback &foundCallback, const AffineXf3f *xf=nullptr)
 
MRMESH_API void MR::findPointsInBall (const AABBTreePoints &tree, const Vector3f &center, float radius, const FoundPointCallback &foundCallback, const AffineXf3f *xf=nullptr)
 
MRMESH_API PointsProjectionResult MR::findProjectionOnPoints (const Vector3f &pt, const PointCloud &pc, float upDistLimitSq=FLT_MAX, const AffineXf3f *xf=nullptr, float loDistLimitSq=0, VertPredicate skipCb={})
 computes the closest point on point cloud to given point
 
MRMESH_API void MR::findFewClosestPoints (const Vector3f &pt, const PointCloud &pc, FewSmallest< PointsProjectionResult > &res, float upDistLimitSq=FLT_MAX, const AffineXf3f *xf=nullptr, float loDistLimitSq=0)
 finds a number of the closest points in the cloud (as configured in
 
MRMESH_API Buffer< VertId > MR::findNClosestPointsPerPoint (const PointCloud &pc, int numNei, const ProgressCallback &progress={})
 finds given number of closest points (excluding itself) to each valid point in the cloud;
 
MRMESH_API VertPair MR::findTwoClosestPoints (const PointCloud &pc, const ProgressCallback &progress={})
 finds two closest points (first id < second id) in whole point cloud
 
MRMESH_API std::vector< EdgePointPairMR::findCollidingEdgePairs (const Polyline2 &a, const Polyline2 &b, const AffineXf2f *rigidB2A=nullptr, bool firstIntersectionOnly=false)
 finds all pairs of colliding edges from two 2d polylines
 
MRMESH_API std::vector< UndirectedEdgeUndirectedEdgeMR::findCollidingEdges (const Polyline2 &a, const Polyline2 &b, const AffineXf2f *rigidB2A=nullptr, bool firstIntersectionOnly=false)
 finds all pairs of colliding edges from two 2d polylines
 
MRMESH_API std::pair< UndirectedEdgeBitSet, UndirectedEdgeBitSet > MR::findCollidingEdgesBitsets (const Polyline2 &a, const Polyline2 &b, const AffineXf2f *rigidB2A=nullptr)
 finds bitset per polyline with colliding edges
 
MRMESH_API std::vector< EdgePointPairMR::findSelfCollidingEdgePairs (const Polyline2 &polyline)
 finds all pairs of colliding edges from 2d polyline
 
MRMESH_API std::vector< UndirectedEdgeUndirectedEdgeMR::findSelfCollidingEdges (const Polyline2 &polyline)
 finds all pairs of colliding edges from 2d polyline
 
MRMESH_API UndirectedEdgeBitSet MR::findSelfCollidingEdgesBS (const Polyline2 &polyline)
 finds the union of all self-intersecting edges
 
MRMESH_API bool MR::isInside (const Polyline2 &a, const Polyline2 &b, const AffineXf2f *rigidB2A=nullptr)
 checks that arbitrary 2d polyline A is inside of closed 2d polyline B
 
MRMESH_API bool MR::isPointInsidePolyline (const Polyline2 &polyline, const Vector2f &point)
 detect if given point is inside polyline, by counting ray intersections
 
MRMESH_API PolylineProjectionResult2 MR::findProjectionOnPolyline2 (const Vector2f &pt, const Polyline2 &polyline, float upDistLimitSq=FLT_MAX, AffineXf2f *xf=nullptr, float loDistLimitSq=0)
 computes the closest point on polyline to given point
 
MRMESH_API PolylineProjectionResult3 MR::findProjectionOnPolyline (const Vector3f &pt, const Polyline3 &polyline, float upDistLimitSq=FLT_MAX, AffineXf3f *xf=nullptr, float loDistLimitSq=0)
 computes the closest point on polyline to given point
 
MRMESH_API PolylineProjectionResult3 MR::findProjectionOnPolyline (const Line3f &ln, const Polyline3 &polyline, float upDistLimitSq=FLT_MAX, AffineXf3f *xf=nullptr, float loDistLimitSq=0)
 computes the closest point on polyline to given straight line
 
MRMESH_API Polyline2ProjectionWithOffsetResult MR::findProjectionOnPolyline2WithOffset (const Vector2f &pt, const Polyline2 &polyline, const Vector< float, UndirectedEdgeId > &offsetPerEdge, float upDistLimit=FLT_MAX, AffineXf2f *xf=nullptr, float loDistLimit=0)
 computes the closest point on polyline to given point, respecting each edge offset
 
MRMESH_API PolylineProjectionWithOffsetResult3 MR::findProjectionOnPolylineWithOffset (const Vector3f &pt, const Polyline3 &polyline, const Vector< float, UndirectedEdgeId > &offsetPerEdge, float upDistLimit=FLT_MAX, AffineXf3f *xf=nullptr, float loDistLimit=0)
 computes the closest point on polyline to given point, respecting each edge offset
 
MRMESH_API void MR::findEdgesInBall (const Polyline2 &polyline, const Vector2f &center, float radius, const FoundEdgeCallback2 &foundCallback, AffineXf2f *xf=nullptr)
 Finds all edges of given polyline that cross or touch given ball (center, radius)
 
MRMESH_API void MR::findEdgesInBall (const Polyline3 &polyline, const Vector3f &center, float radius, const FoundEdgeCallback3 &foundCallback, AffineXf3f *xf=nullptr)
 Finds all edges of given polyline that cross or touch given ball (center, radius)
 
MRMESH_API void MR::findMeshEdgesInBall (const Mesh &mesh, const AABBTreePolyline3 &tree, const Vector3f &center, float radius, const FoundEdgeCallback3 &foundCallback, AffineXf3f *xf=nullptr)
 Finds all edges of given mesh edges (specified by the tree) that cross or touch given ball (center, radius)
 
MRMESH_API PolylineProjectionResult3 MR::findProjectionOnMeshEdges (const Vector3f &pt, const Mesh &mesh, const AABBTreePolyline3 &tree, float upDistLimitSq=FLT_MAX, AffineXf3f *xf=nullptr, float loDistLimitSq=0)
 computes the closest point on the mesh edges (specified by the tree) to given point
 
MRMESH_API PolylineProjectionResult3 MR::findProjectionOnMeshEdges (const Line3f &ln, const Mesh &mesh, const AABBTreePolyline3 &tree, float upDistLimitSq=FLT_MAX, AffineXf3f *xf=nullptr, float loDistLimitSq=0)
 computes the closest point on the mesh edges (specified by the tree) to given straight line
 

Variables

Vector3< T > MR::IntersectionPrecomputes< T >::invDir
 
int MR::IntersectionPrecomputes< T >::maxDimIdxZ = 2
 
int MR::IntersectionPrecomputes< T >::idxX = 0
 
int MR::IntersectionPrecomputes< T >::idxY = 1
 
Vector3i MR::IntersectionPrecomputes< T >::sign
 stores signs of direction vector;
 
MR::IntersectionPrecomputes< T >::Sx
 precomputed factors
 
MR::IntersectionPrecomputes< T >::Sy
 
MR::IntersectionPrecomputes< T >::Sz
 

Detailed Description

This chapter represents documentation about AABB Tree.

Typedef Documentation

◆ AABBTreeNodeVec

template<typename T >
using MR::AABBTreeNodeVec = Vector<AABBTreeNode<T>, NodeId>

◆ FaceTreeTraits3

◆ FoundEdgeCallback

template<typename V >
using MR::FoundEdgeCallback = std::function<void( UndirectedEdgeId, const V& closestPt, float distSq )>

◆ FoundEdgeCallback2

◆ FoundEdgeCallback3

◆ FoundTriCallback

using MR::FoundTriCallback = std::function<Processing( const MeshProjectionResult & found, Ball & ball )>

this callback is invoked on every triangle at least partially in the ball, and allows to change the ball

◆ Line3dMesh

using MR::Line3dMesh = Line3Mesh<double>

◆ Line3fMesh

using MR::Line3fMesh = Line3Mesh<float>

◆ LineTreeTraits

template<typename V >
using MR::LineTreeTraits = AABBTreeTraits<UndirectedEdgeTag, Box<V>>

◆ LineTreeTraits2

◆ LineTreeTraits3

◆ MeshIntersectionCallback

using MR::MeshIntersectionCallback = std::function<bool(const MeshIntersectionResult &)>

this callback is envoked for each encountered ray-mesh intersection; if it returns false, then the search immediately terminates

◆ TriangleCallback

using MR::TriangleCallback = std::function<ProcessOneResult( const Vector3f & p, FaceId f, const Vector3f & q, float distSq )>

this callback is invoked for every triangle in range, where

Parameters
pclosest point on original triangle
ftriangle id in question
qclosest point on f-triangle
distSqsquared distance in between p and q
Returns
whether to continue or to stop processing other triangles

Enumeration Type Documentation

◆ ProcessOneResult

enum class MR::ProcessOneResult : bool
strong
Enumerator
StopProcessing 
ContinueProcessing 

Function Documentation

◆ findCollidingEdgePairs()

MRMESH_API std::vector< EdgePointPair > MR::findCollidingEdgePairs ( const Polyline2 & a,
const Polyline2 & b,
const AffineXf2f * rigidB2A = nullptr,
bool firstIntersectionOnly = false )

finds all pairs of colliding edges from two 2d polylines

Parameters
rigidB2Arigid transformation from B-polyline space to A polyline space, nullptr considered as identity transformation
firstIntersectionOnlyif true then the function returns at most one pair of intersecting edges and returns faster

◆ findCollidingEdges()

MRMESH_API std::vector< UndirectedEdgeUndirectedEdge > MR::findCollidingEdges ( const Polyline2 & a,
const Polyline2 & b,
const AffineXf2f * rigidB2A = nullptr,
bool firstIntersectionOnly = false )

finds all pairs of colliding edges from two 2d polylines

Parameters
rigidB2Arigid transformation from B-polyline space to A polyline space, nullptr considered as identity transformation
firstIntersectionOnlyif true then the function returns at most one pair of intersecting edges and returns faster

◆ findCollidingEdgesBitsets()

MRMESH_API std::pair< UndirectedEdgeBitSet, UndirectedEdgeBitSet > MR::findCollidingEdgesBitsets ( const Polyline2 & a,
const Polyline2 & b,
const AffineXf2f * rigidB2A = nullptr )

finds bitset per polyline with colliding edges

Parameters
rigidB2Arigid transformation from B-polyline space to A polyline space, nullptr considered as identity transformation

◆ findCollidingEdgeTrisPrecise() [1/3]

MRMESH_API std::vector< EdgeTri > MR::findCollidingEdgeTrisPrecise ( const Mesh & a,
const std::vector< EdgeId > & edgesA,
const Mesh & b,
const std::vector< FaceId > & facesB,
ConvertToIntVector conv,
const AffineXf3f * rigidB2A = nullptr )

finds all intersections between every given edge from A and given triangles from B

◆ findCollidingEdgeTrisPrecise() [2/3]

MRMESH_API std::vector< EdgeTri > MR::findCollidingEdgeTrisPrecise ( const Mesh & a,
const std::vector< FaceId > & facesA,
const Mesh & b,
const std::vector< EdgeId > & edgesB,
ConvertToIntVector conv,
const AffineXf3f * rigidB2A = nullptr )

finds all intersections between every given triangle from A and given edge from B

◆ findCollidingEdgeTrisPrecise() [3/3]

MRMESH_API PreciseCollisionResult MR::findCollidingEdgeTrisPrecise ( const MeshPart & a,
const MeshPart & b,
ConvertToIntVector conv,
const AffineXf3f * rigidB2A = nullptr,
bool anyIntersection = false )

finds all pairs of colliding edges from one mesh and triangle from another mesh

Parameters
rigidB2Arigid transformation from B-mesh space to A mesh space, nullptr considered as identity transformation
anyIntersectionif true then the function returns as fast as it finds any intersection

◆ findCollidingTriangleBitsets()

MRMESH_API std::pair< FaceBitSet, FaceBitSet > MR::findCollidingTriangleBitsets ( const MeshPart & a,
const MeshPart & b,
const AffineXf3f * rigidB2A = nullptr )
nodiscard

the same as findCollidingTriangles, but returns one bite set per mesh with colliding triangles

◆ findCollidingTriangles()

MRMESH_API std::vector< FaceFace > MR::findCollidingTriangles ( const MeshPart & a,
const MeshPart & b,
const AffineXf3f * rigidB2A = nullptr,
bool firstIntersectionOnly = false )
nodiscard

finds all pairs of colliding triangles from two meshes or two mesh regions

Parameters
rigidB2Arigid transformation from B-mesh space to A mesh space, nullptr considered as identity transformation
firstIntersectionOnlyif true then the function returns at most one pair of intersecting triangles and returns faster

◆ findDirMax()

MRMESH_API VertId MR::findDirMax ( const Vector3f & dir,
const MeshPart & mp,
UseAABBTree u = UseAABBTree::Yes )

finds the vertex in the mesh part having the largest projection on given direction, uses aabb-tree inside for faster computation

◆ findDistance()

MRMESH_API MeshMeshDistanceResult MR::findDistance ( const MeshPart & a,
const MeshPart & b,
const AffineXf3f * rigidB2A = nullptr,
float upDistLimitSq = FLT_MAX )

computes minimal distance between two meshes or two mesh regions

Parameters
rigidB2Arigid transformation from B-mesh space to A mesh space, nullptr considered as identity transformation
upDistLimitSqupper limit on the distance in question, if the real distance is larger than the function exists returning upDistLimitSq and no valid points

◆ findEdgesInBall() [1/2]

MRMESH_API void MR::findEdgesInBall ( const Polyline2 & polyline,
const Vector2f & center,
float radius,
const FoundEdgeCallback2 & foundCallback,
AffineXf2f * xf = nullptr )

Finds all edges of given polyline that cross or touch given ball (center, radius)

◆ findEdgesInBall() [2/2]

MRMESH_API void MR::findEdgesInBall ( const Polyline3 & polyline,
const Vector3f & center,
float radius,
const FoundEdgeCallback3 & foundCallback,
AffineXf3f * xf = nullptr )

Finds all edges of given polyline that cross or touch given ball (center, radius)

◆ findFewClosestPoints()

MRMESH_API void MR::findFewClosestPoints ( const Vector3f & pt,
const PointCloud & pc,
FewSmallest< PointsProjectionResult > & res,
float upDistLimitSq = FLT_MAX,
const AffineXf3f * xf = nullptr,
float loDistLimitSq = 0 )

finds a number of the closest points in the cloud (as configured in

Parameters
res)to given point
upDistLimitSqupper limit on the distance in question, points with larger distance than it will not be returned
xfpointcloud-to-point transformation, if not specified then identity transformation is assumed
loDistLimitSqlow limit on the distance in question, the algorithm can return given number of points within this distance even skipping closer ones

◆ findMaxDistanceSq()

MRMESH_API float MR::findMaxDistanceSq ( const MeshPart & a,
const MeshPart & b,
const AffineXf3f * rigidB2A = nullptr,
float maxDistanceSq = FLT_MAX )

returns the squared Hausdorff distance between two meshes, that is the maximum of squared distances from each mesh vertex to the other mesh (in both directions)

Parameters
rigidB2Arigid transformation from B-mesh space to A mesh space, nullptr considered as identity transformation
maxDistanceSqupper limit on the positive distance in question, if the real distance is larger than the function exists returning maxDistanceSq

◆ findMaxDistanceSqOneWay()

MRMESH_API float MR::findMaxDistanceSqOneWay ( const MeshPart & a,
const MeshPart & b,
const AffineXf3f * rigidB2A = nullptr,
float maxDistanceSq = FLT_MAX )

returns the maximum of the squared distances from each B-mesh vertex to A-mesh

Parameters
rigidB2Arigid transformation from B-mesh space to A mesh space, nullptr considered as identity transformation
maxDistanceSqupper limit on the positive distance in question, if the real distance is larger than the function exists returning maxDistanceSq

◆ findMaxVectorDim() [1/2]

template<typename T >
void MR::findMaxVectorDim ( int & dimX,
int & dimY,
const Vector2< T > & dir )

finds index of maximum axis and stores it into dimY

http://jcgt.org/published/0002/01/05/paper.pdf Example input: dir = (1,-2). Result: dimY = 1, dimX = 0.

Parameters
[out]dimXindex of minimum axis
[out]dimYindex of maximum axis

◆ findMaxVectorDim() [2/2]

template<typename T >
void MR::findMaxVectorDim ( int & dimX,
int & dimY,
int & dimZ,
const Vector3< T > & dir )

finds index of maximum axis and stores it into dimZ

http://jcgt.org/published/0002/01/05/paper.pdf Example input: dir = (1,1,-2). Result: dimZ = 2, dimX = 1, dimY = 0.

Parameters
[out]dimXare filled by right-hand rule from dimZ
[out]dimYare filled by right-hand rule from dimZ
[out]dimZindex of maximum axis

◆ findMeshEdgesInBall()

MRMESH_API void MR::findMeshEdgesInBall ( const Mesh & mesh,
const AABBTreePolyline3 & tree,
const Vector3f & center,
float radius,
const FoundEdgeCallback3 & foundCallback,
AffineXf3f * xf = nullptr )

Finds all edges of given mesh edges (specified by the tree) that cross or touch given ball (center, radius)

◆ findNClosestPointsPerPoint()

MRMESH_API Buffer< VertId > MR::findNClosestPointsPerPoint ( const PointCloud & pc,
int numNei,
const ProgressCallback & progress = {} )
nodiscard

finds given number of closest points (excluding itself) to each valid point in the cloud;

Parameters
numNeithe number of closest points to find for each point
Returns
a buffer where for every valid point with index i its neighbours are stored at indices [i*numNei; (i+1)*numNei)

◆ findPointsInBall() [1/3]

MRMESH_API void MR::findPointsInBall ( const AABBTreePoints & tree,
const Vector3f & center,
float radius,
const FoundPointCallback & foundCallback,
const AffineXf3f * xf = nullptr )

Finds all points in tree that are inside or on the surface of given ball (center, radius)

Parameters
xfpoints-to-center transformation, if not specified then identity transformation is assumed

◆ findPointsInBall() [2/3]

MRMESH_API void MR::findPointsInBall ( const Mesh & mesh,
const Vector3f & center,
float radius,
const FoundPointCallback & foundCallback,
const AffineXf3f * xf = nullptr )

Finds all valid vertices of the mesh that are inside or on the surface of given ball (center, radius)

Parameters
xfpoints-to-center transformation, if not specified then identity transformation is assumed

◆ findPointsInBall() [3/3]

MRMESH_API void MR::findPointsInBall ( const PointCloud & pointCloud,
const Vector3f & center,
float radius,
const FoundPointCallback & foundCallback,
const AffineXf3f * xf = nullptr )

Finds all valid points of pointCloud that are inside or on the surface of given ball (center, radius)

Parameters
xfpoints-to-center transformation, if not specified then identity transformation is assumed

◆ findProjection()

MRMESH_API MeshProjectionResult MR::findProjection ( const Vector3f & pt,
const MeshPart & mp,
float upDistLimitSq = FLT_MAX,
const AffineXf3f * xf = nullptr,
float loDistLimitSq = 0,
const FacePredicate & validFaces = {},
const std::function< bool(const MeshProjectionResult &)> & validProjections = {} )
nodiscard

computes the closest point on mesh (or its region) to given point

Parameters
upDistLimitSqupper limit on the distance in question, if the real distance is larger than the function exits returning upDistLimitSq and no valid point
xfmesh-to-point transformation, if not specified then identity transformation is assumed
loDistLimitSqlow limit on the distance in question, if a point is found within this distance then it is immediately returned without searching for a closer one
validFacesif provided then only faces from there will be considered as projections
validProjectionsif provided then only projections passed this test can be returned

◆ findProjectionOnMeshEdges() [1/2]

MRMESH_API PolylineProjectionResult3 MR::findProjectionOnMeshEdges ( const Line3f & ln,
const Mesh & mesh,
const AABBTreePolyline3 & tree,
float upDistLimitSq = FLT_MAX,
AffineXf3f * xf = nullptr,
float loDistLimitSq = 0 )

computes the closest point on the mesh edges (specified by the tree) to given straight line

Parameters
upDistLimitSqupper limit on the distance in question, if the real distance is larger than the function exists returning upDistLimitSq and no valid point
xfpolyline-to-point transformation, if not specified then identity transformation is assumed
loDistLimitSqlow limit on the distance in question, if a point is found within this distance then it is immediately returned without searching for a closer one

◆ findProjectionOnMeshEdges() [2/2]

MRMESH_API PolylineProjectionResult3 MR::findProjectionOnMeshEdges ( const Vector3f & pt,
const Mesh & mesh,
const AABBTreePolyline3 & tree,
float upDistLimitSq = FLT_MAX,
AffineXf3f * xf = nullptr,
float loDistLimitSq = 0 )

computes the closest point on the mesh edges (specified by the tree) to given point

Parameters
upDistLimitSqupper limit on the distance in question, if the real distance is larger than the function exists returning upDistLimitSq and no valid point
xfpolyline-to-point transformation, if not specified then identity transformation is assumed
loDistLimitSqlow limit on the distance in question, if a point is found within this distance then it is immediately returned without searching for a closer one

◆ findProjectionOnPoints()

MRMESH_API PointsProjectionResult MR::findProjectionOnPoints ( const Vector3f & pt,
const PointCloud & pc,
float upDistLimitSq = FLT_MAX,
const AffineXf3f * xf = nullptr,
float loDistLimitSq = 0,
VertPredicate skipCb = {} )
nodiscard

computes the closest point on point cloud to given point

Parameters
upDistLimitSqupper limit on the distance in question, if the real distance is larger than the function exits returning upDistLimitSq and no valid point
xfpointcloud-to-point transformation, if not specified then identity transformation is assumed
loDistLimitSqlow limit on the distance in question, if a point is found within this distance then it is immediately returned without searching for a closer one
skipCbcallback to discard VertId projection candidate

◆ findProjectionOnPolyline() [1/2]

MRMESH_API PolylineProjectionResult3 MR::findProjectionOnPolyline ( const Line3f & ln,
const Polyline3 & polyline,
float upDistLimitSq = FLT_MAX,
AffineXf3f * xf = nullptr,
float loDistLimitSq = 0 )

computes the closest point on polyline to given straight line

Parameters
upDistLimitSqupper limit on the distance in question, if the real distance is larger than the function exists returning upDistLimitSq and no valid point
xfpolyline-to-point transformation, if not specified then identity transformation is assumed
loDistLimitSqlow limit on the distance in question, if a point is found within this distance then it is immediately returned without searching for a closer one

◆ findProjectionOnPolyline() [2/2]

MRMESH_API PolylineProjectionResult3 MR::findProjectionOnPolyline ( const Vector3f & pt,
const Polyline3 & polyline,
float upDistLimitSq = FLT_MAX,
AffineXf3f * xf = nullptr,
float loDistLimitSq = 0 )

computes the closest point on polyline to given point

Parameters
upDistLimitSqupper limit on the distance in question, if the real distance is larger than the function exists returning upDistLimitSq and no valid point
xfpolyline-to-point transformation, if not specified then identity transformation is assumed
loDistLimitSqlow limit on the distance in question, if a point is found within this distance then it is immediately returned without searching for a closer one

◆ findProjectionOnPolyline2()

MRMESH_API PolylineProjectionResult2 MR::findProjectionOnPolyline2 ( const Vector2f & pt,
const Polyline2 & polyline,
float upDistLimitSq = FLT_MAX,
AffineXf2f * xf = nullptr,
float loDistLimitSq = 0 )

computes the closest point on polyline to given point

Parameters
upDistLimitSqupper limit on the distance in question, if the real distance is larger than the function exists returning upDistLimitSq and no valid point
xfpolyline-to-point transformation, if not specified then identity transformation is assumed
loDistLimitSqlow limit on the distance in question, if a point is found within this distance then it is immediately returned without searching for a closer one

◆ findProjectionOnPolyline2WithOffset()

MRMESH_API Polyline2ProjectionWithOffsetResult MR::findProjectionOnPolyline2WithOffset ( const Vector2f & pt,
const Polyline2 & polyline,
const Vector< float, UndirectedEdgeId > & offsetPerEdge,
float upDistLimit = FLT_MAX,
AffineXf2f * xf = nullptr,
float loDistLimit = 0 )

computes the closest point on polyline to given point, respecting each edge offset

Parameters
offsetPerEdgeoffset for each edge of polyline
upDistLimitupper limit on the distance in question, if the real distance is larger than the function exists returning upDistLimit and no valid point
xfpolyline-to-point transformation, if not specified then identity transformation is assumed
loDistLimitlow limit on the distance in question, if a point is found within this distance then it is immediately returned without searching for a closer one

◆ findProjectionOnPolylineWithOffset()

MRMESH_API PolylineProjectionWithOffsetResult3 MR::findProjectionOnPolylineWithOffset ( const Vector3f & pt,
const Polyline3 & polyline,
const Vector< float, UndirectedEdgeId > & offsetPerEdge,
float upDistLimit = FLT_MAX,
AffineXf3f * xf = nullptr,
float loDistLimit = 0 )

computes the closest point on polyline to given point, respecting each edge offset

Parameters
offsetPerEdgeoffset for each edge of polyline
upDistLimitupper limit on the distance in question, if the real distance is larger than the function exists returning upDistLimit and no valid point
xfpolyline-to-point transformation, if not specified then identity transformation is assumed
loDistLimitlow limit on the distance in question, if a point is found within this distance then it is immediately returned without searching for a closer one

◆ findProjectionSubtree()

MRMESH_API MeshProjectionResult MR::findProjectionSubtree ( const Vector3f & pt,
const MeshPart & mp,
const AABBTree & tree,
float upDistLimitSq = FLT_MAX,
const AffineXf3f * xf = nullptr,
float loDistLimitSq = 0,
const FacePredicate & validFaces = {},
const std::function< bool(const MeshProjectionResult &)> & validProjections = {} )
nodiscard

computes the closest point on mesh (or its region) to given point

Parameters
treeexplicitly given BVH-tree for whole mesh or part of mesh we are searching projection on,
upDistLimitSqupper limit on the distance in question, if the real distance is larger than the function exits returning upDistLimitSq and no valid point
xfmesh-to-point transformation, if not specified then identity transformation is assumed
loDistLimitSqlow limit on the distance in question, if a point is found within this distance then it is immediately returned without searching for a closer one
validFacesif provided then only faces from there will be considered as projections
validProjectionsif provided then only projections passed this test can be returned

◆ findSelfCollidingEdgePairs()

MRMESH_API std::vector< EdgePointPair > MR::findSelfCollidingEdgePairs ( const Polyline2 & polyline)

finds all pairs of colliding edges from 2d polyline

◆ findSelfCollidingEdges()

MRMESH_API std::vector< UndirectedEdgeUndirectedEdge > MR::findSelfCollidingEdges ( const Polyline2 & polyline)

finds all pairs of colliding edges from 2d polyline

◆ findSelfCollidingEdgesBS()

MRMESH_API UndirectedEdgeBitSet MR::findSelfCollidingEdgesBS ( const Polyline2 & polyline)

finds the union of all self-intersecting edges

◆ findSelfCollidingTriangles() [1/2]

MRMESH_API Expected< std::vector< FaceFace > > MR::findSelfCollidingTriangles ( const MeshPart & mp,
ProgressCallback cb = {},
const Face2RegionMap * regionMap = nullptr )
nodiscard

finds all pairs of colliding triangles from one mesh or a region

if regionMap is provided then only self-intersections within a region are returned

◆ findSelfCollidingTriangles() [2/2]

MRMESH_API Expected< bool > MR::findSelfCollidingTriangles ( const MeshPart & mp,
std::vector< FaceFace > * outCollidingPairs,
ProgressCallback cb = {},
const Face2RegionMap * regionMap = nullptr )
nodiscard

finds all pairs (or the fact of any self-collision) of colliding triangles from one mesh or a region

if regionMap is provided then only self-intersections within a region are returned

Parameters
outCollidingPairsif nullptr then the algorithm returns with true as soon as first collision is found

◆ findSelfCollidingTrianglesBS()

MRMESH_API Expected< FaceBitSet > MR::findSelfCollidingTrianglesBS ( const MeshPart & mp,
ProgressCallback cb = {},
const Face2RegionMap * regionMap = nullptr )
nodiscard

the same findSelfCollidingTriangles but returns the union of all self-intersecting faces

if regionMap is provided then only self-intersections within a region are returned

◆ findSignedDistance() [1/2]

MRMESH_API MeshMeshSignedDistanceResult MR::findSignedDistance ( const MeshPart & a,
const MeshPart & b,
const AffineXf3f * rigidB2A = nullptr,
float upDistLimitSq = FLT_MAX )

computes minimal distance between two meshes

Parameters
rigidB2Arigid transformation from B-mesh space to A mesh space, nullptr considered as identity transformation
upDistLimitSqupper limit on the positive distance in question, if the real distance is larger than the function exists returning upDistLimitSq and no valid points

◆ findSignedDistance() [2/2]

MRMESH_API std::optional< SignedDistanceToMeshResult > MR::findSignedDistance ( const Vector3f & pt,
const MeshPart & mp,
float upDistLimitSq = FLT_MAX,
float loDistLimitSq = 0 )
nodiscard

computes the closest point on mesh (or its region) to given point, and finds the distance with sign to it (positive - outside, negative - inside the mesh)

Parameters
upDistLimitSqupper limit on the distance in question, if the real distance is larger then the function exits returning nullopt
loDistLimitSqlow limit on the distance in question, if the real distance smaller then the function exits returning nullopt

◆ findTrisInBall()

MRMESH_API void MR::findTrisInBall ( const MeshPart & mp,
Ball ball,
const FoundTriCallback & foundCallback,
const FacePredicate & validFaces = {} )

enumerates all triangles within the ball until callback returns Stop; the ball during enumeration can shrink (new ball is always within the previous one) but never expand

◆ findTwoClosestPoints()

MRMESH_API VertPair MR::findTwoClosestPoints ( const PointCloud & pc,
const ProgressCallback & progress = {} )
nodiscard

finds two closest points (first id < second id) in whole point cloud

◆ getNumNodes()

int MR::getNumNodes ( int numLeaves)
inline

returns the number of nodes in the binary tree with given number of leaves

◆ getVectorConverters()

MRMESH_API CoordinateConverters MR::getVectorConverters ( const MeshPart & a,
const MeshPart & b,
const AffineXf3f * rigidB2A = nullptr )

creates simple converters from Vector3f to Vector3i and back in mesh parts area range

Parameters
rigidB2Arigid transformation from B-mesh space to A mesh space, nullptr considered as identity transformation

◆ IntersectionPrecomputes() [1/2]

template<typename T >
MR::IntersectionPrecomputes< T >::IntersectionPrecomputes ( )
default

◆ IntersectionPrecomputes() [2/2]

template<typename T >
MR::IntersectionPrecomputes< T >::IntersectionPrecomputes ( const Vector3< T > & dir)
inline

◆ isInside() [1/2]

MRMESH_API bool MR::isInside ( const MeshPart & a,
const MeshPart & b,
const AffineXf3f * rigidB2A = nullptr )
nodiscard

checks that arbitrary mesh part A is inside of closed mesh part B

Parameters
rigidB2Arigid transformation from B-mesh space to A mesh space, nullptr considered as identity transformation

◆ isInside() [2/2]

MRMESH_API bool MR::isInside ( const Polyline2 & a,
const Polyline2 & b,
const AffineXf2f * rigidB2A = nullptr )

checks that arbitrary 2d polyline A is inside of closed 2d polyline B

Parameters
rigidB2Arigid transformation from B-polyline space to A polyline space, nullptr considered as identity transformation

◆ isNonIntersectingInside()

MRMESH_API bool MR::isNonIntersectingInside ( const MeshPart & a,
const MeshPart & b,
const AffineXf3f * rigidB2A = nullptr )
nodiscard

checks that arbitrary mesh part A is inside of closed mesh part B The version of isInside without collision check; it is user's responsibility to guarantee that the meshes don't collide

Parameters
rigidB2Arigid transformation from B-mesh space to A mesh space, nullptr considered as identity transformation

◆ isPointInsidePolyline()

MRMESH_API bool MR::isPointInsidePolyline ( const Polyline2 & polyline,
const Vector2f & point )
nodiscard

detect if given point is inside polyline, by counting ray intersections

Parameters
polylineinput polyline
pointinput point

◆ makeAABBTreeNodeVec()

template<typename T >
AABBTreeNodeVec< T > MR::makeAABBTreeNodeVec ( Buffer< BoxedLeaf< T > > boxedLeaves)

◆ multiRayMeshIntersect()

MRMESH_API void MR::multiRayMeshIntersect ( const MeshPart & meshPart,
const std::vector< Vector3f > & origins,
const std::vector< Vector3f > & dirs,
const MultiRayMeshIntersectResult & result,
float rayStart = 0.0f,
float rayEnd = FLT_MAX,
bool closestIntersect = true,
const FacePredicate & validFaces = {} )

Finds intersections between a mesh and multiple rays in parallel (in float-precision). rayStart and rayEnd define the interval on all rays to detect an intersection. vadidFaces if given then all faces for which false is returned will be skipped

Parameters
meshPartmesh (or its part) to find intersections with
originsorigin point of every ray
dirsdirection of every ray
resultoutput data for every ray
closestIntersectfinds the closest to ray origin intersection (or any intersection for better performance if !closestIntersect)
validFacesif given then all faces for which false is returned will be skipped

◆ operator==()

bool MR::operator== ( const EdgeTri & a,
const EdgeTri & b )
inline

◆ processCloseTriangles()

MRMESH_API void MR::processCloseTriangles ( const MeshPart & mp,
const Triangle3f & t,
float rangeSq,
const TriangleCallback & call )

invokes given callback for all triangles from given mesh part located not further than given squared distance from t-triangle

◆ rayMeshIntersect() [1/2]

MRMESH_API MeshIntersectionResult MR::rayMeshIntersect ( const MeshPart & meshPart,
const Line3d & line,
double rayStart = 0.0,
double rayEnd = DBL_MAX,
const IntersectionPrecomputes< double > * prec = nullptr,
bool closestIntersect = true,
const FacePredicate & validFaces = {} )
nodiscard

Finds ray and mesh intersection in double-precision. rayStart and rayEnd define the interval on the ray to detect an intersection. prec can be specified to reuse some precomputations (e.g. for checking many parallel rays). vadidFaces if given then all faces for which false is returned will be skipped Finds the closest to ray origin intersection (or any intersection for better performance if !closestIntersect).

◆ rayMeshIntersect() [2/2]

MRMESH_API MeshIntersectionResult MR::rayMeshIntersect ( const MeshPart & meshPart,
const Line3f & line,
float rayStart = 0.0f,
float rayEnd = FLT_MAX,
const IntersectionPrecomputes< float > * prec = nullptr,
bool closestIntersect = true,
const FacePredicate & validFaces = {} )
nodiscard

Finds ray and mesh intersection in float-precision. rayStart and rayEnd define the interval on the ray to detect an intersection. prec can be specified to reuse some precomputations (e.g. for checking many parallel rays). vadidFaces if given then all faces for which false is returned will be skipped Finds the closest to ray origin intersection (or any intersection for better performance if !closestIntersect).

◆ rayMeshIntersectAll() [1/2]

MRMESH_API void MR::rayMeshIntersectAll ( const MeshPart & meshPart,
const Line3d & line,
MeshIntersectionCallback callback,
double rayStart = 0.0,
double rayEnd = DBL_MAX,
const IntersectionPrecomputes< double > * prec = nullptr )

Same as rayMeshIntersectAllF, but use double precision.

◆ rayMeshIntersectAll() [2/2]

MRMESH_API void MR::rayMeshIntersectAll ( const MeshPart & meshPart,
const Line3f & line,
MeshIntersectionCallback callback,
float rayStart = 0.0f,
float rayEnd = FLT_MAX,
const IntersectionPrecomputes< float > * prec = nullptr )

Intersects ray with mesh. Finds all intersections

◆ rayMultiMeshAnyIntersect() [1/2]

MRMESH_API MultiMeshIntersectionResult MR::rayMultiMeshAnyIntersect ( const std::vector< Line3dMesh > & lineMeshes,
double rayStart = 0.0,
double rayEnd = DBL_MAX )
nodiscard

Same as rayMultiMeshAnyIntersectF, but use double precision.

◆ rayMultiMeshAnyIntersect() [2/2]

MRMESH_API MultiMeshIntersectionResult MR::rayMultiMeshAnyIntersect ( const std::vector< Line3fMesh > & lineMeshes,
float rayStart = 0.0f,
float rayEnd = FLT_MAX )
nodiscard

Intersects ray with many meshes. Finds any intersection (not the closest)

◆ signedDistanceToMesh()

MRMESH_API std::optional< float > MR::signedDistanceToMesh ( const MeshPart & mp,
const Vector3f & p,
const DistanceToMeshOptions & op )
nodiscard

computes signed distance from point (p) to mesh part (mp) following options (op); returns std::nullopt if distance is smaller than op.minDist or larger than op.maxDist (except for op.signMode == HoleWindingRule)

◆ xyPlaneMeshIntersect()

MRMESH_API void MR::xyPlaneMeshIntersect ( const MeshPart & meshPart,
float zLevel,
FaceBitSet * fs,
UndirectedEdgeBitSet * ues,
VertBitSet * vs )

given mesh part and plane z=zLevel, outputs

Parameters
fstriangles crossed or touched by the plane
uesedges of these triangles
vsvertices of these triangles

Variable Documentation

◆ idxX

template<typename T >
int MR::IntersectionPrecomputes< T >::idxX = 0

◆ idxY

template<typename T >
int MR::IntersectionPrecomputes< T >::idxY = 1

◆ invDir

template<typename T >
Vector3<T> MR::IntersectionPrecomputes< T >::invDir

◆ maxDimIdxZ

template<typename T >
int MR::IntersectionPrecomputes< T >::maxDimIdxZ = 2

◆ sign

template<typename T >
Vector3i MR::IntersectionPrecomputes< T >::sign

stores signs of direction vector;

◆ Sx

template<typename T >
T MR::IntersectionPrecomputes< T >::Sx

precomputed factors

◆ Sy

template<typename T >
T MR::IntersectionPrecomputes< T >::Sy

◆ Sz

template<typename T >
T MR::IntersectionPrecomputes< T >::Sz