This chapter represents documentation about AABB Tree. More...
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< FaceFace > | MR::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< 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 | |
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 | |
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< SignedDistanceToMeshResult > | MR::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 ¢er, float radius, const FoundPointCallback &foundCallback, const AffineXf3f *xf=nullptr) |
MRMESH_API void | MR::findPointsInBall (const Mesh &mesh, const Vector3f ¢er, float radius, const FoundPointCallback &foundCallback, const AffineXf3f *xf=nullptr) |
MRMESH_API void | MR::findPointsInBall (const AABBTreePoints &tree, const Vector3f ¢er, 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< 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 | |
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 | |
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< EdgePointPair > | MR::findSelfCollidingEdgePairs (const Polyline2 &polyline) |
finds all pairs of colliding edges from 2d polyline | |
MRMESH_API std::vector< UndirectedEdgeUndirectedEdge > | MR::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 ¢er, 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 ¢er, 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 ¢er, 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; | |
T | MR::IntersectionPrecomputes< T >::Sx |
precomputed factors | |
T | MR::IntersectionPrecomputes< T >::Sy |
T | MR::IntersectionPrecomputes< T >::Sz |
This chapter represents documentation about AABB Tree.
using MR::AABBTreeNodeVec = Vector<AABBTreeNode<T>, NodeId> |
using MR::FaceTreeTraits3 = AABBTreeTraits<FaceTag, Box3f> |
using MR::FoundEdgeCallback = std::function<void( UndirectedEdgeId, const V& closestPt, float distSq )> |
using MR::FoundEdgeCallback2 = FoundEdgeCallback<Vector2f> |
using MR::FoundEdgeCallback3 = FoundEdgeCallback<Vector3f> |
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
using MR::Line3dMesh = Line3Mesh<double> |
using MR::Line3fMesh = Line3Mesh<float> |
using MR::LineTreeTraits = AABBTreeTraits<UndirectedEdgeTag, Box<V>> |
using MR::LineTreeTraits2 = LineTreeTraits<Vector2f> |
using MR::LineTreeTraits3 = LineTreeTraits<Vector3f> |
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
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
p | closest point on original triangle |
f | triangle id in question |
q | closest point on f-triangle |
distSq | squared distance in between p and q |
|
strong |
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
rigidB2A | rigid transformation from B-polyline space to A polyline space, nullptr considered as identity transformation |
firstIntersectionOnly | if true then the function returns at most one pair of intersecting edges and returns faster |
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
rigidB2A | rigid transformation from B-polyline space to A polyline space, nullptr considered as identity transformation |
firstIntersectionOnly | if true then the function returns at most one pair of intersecting edges and returns faster |
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
rigidB2A | rigid transformation from B-polyline space to A polyline space, nullptr considered as identity transformation |
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
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
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
rigidB2A | rigid transformation from B-mesh space to A mesh space, nullptr considered as identity transformation |
anyIntersection | if true then the function returns as fast as it finds any intersection |
|
nodiscard |
the same as findCollidingTriangles, but returns one bite set per mesh with colliding triangles
|
nodiscard |
finds all pairs of colliding triangles from two meshes or two mesh regions
rigidB2A | rigid transformation from B-mesh space to A mesh space, nullptr considered as identity transformation |
firstIntersectionOnly | if true then the function returns at most one pair of intersecting triangles and returns faster |
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
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
rigidB2A | rigid transformation from B-mesh space to A mesh space, nullptr considered as identity transformation |
upDistLimitSq | upper limit on the distance in question, if the real distance is larger than the function exists returning upDistLimitSq and no valid points |
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::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
res) | to given point |
upDistLimitSq | upper limit on the distance in question, points with larger distance than it will not be returned |
xf | pointcloud-to-point transformation, if not specified then identity transformation is assumed |
loDistLimitSq | low limit on the distance in question, the algorithm can return given number of points within this distance even skipping closer ones |
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)
rigidB2A | rigid transformation from B-mesh space to A mesh space, nullptr considered as identity transformation |
maxDistanceSq | upper limit on the positive distance in question, if the real distance is larger than the function exists returning maxDistanceSq |
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
rigidB2A | rigid transformation from B-mesh space to A mesh space, nullptr considered as identity transformation |
maxDistanceSq | upper limit on the positive distance in question, if the real distance is larger than the function exists returning maxDistanceSq |
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.
[out] | dimX | index of minimum axis |
[out] | dimY | index of maximum axis |
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.
[out] | dimX | are filled by right-hand rule from dimZ |
[out] | dimY | are filled by right-hand rule from dimZ |
[out] | dimZ | index of maximum axis |
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)
|
nodiscard |
finds given number of closest points (excluding itself) to each valid point in the cloud;
numNei | the number of closest points to find for each point |
i
its neighbours are stored at indices [i*numNei; (i+1)*numNei) 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)
xf | points-to-center transformation, if not specified then identity transformation is assumed |
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)
xf | points-to-center transformation, if not specified then identity transformation is assumed |
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)
xf | points-to-center transformation, if not specified then identity transformation is assumed |
|
nodiscard |
computes the closest point on mesh (or its region) to given point
upDistLimitSq | upper limit on the distance in question, if the real distance is larger than the function exits returning upDistLimitSq and no valid point |
xf | mesh-to-point transformation, if not specified then identity transformation is assumed |
loDistLimitSq | low 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 |
validFaces | if provided then only faces from there will be considered as projections |
validProjections | if provided then only projections passed this test can be returned |
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
upDistLimitSq | upper limit on the distance in question, if the real distance is larger than the function exists returning upDistLimitSq and no valid point |
xf | polyline-to-point transformation, if not specified then identity transformation is assumed |
loDistLimitSq | low 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 |
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
upDistLimitSq | upper limit on the distance in question, if the real distance is larger than the function exists returning upDistLimitSq and no valid point |
xf | polyline-to-point transformation, if not specified then identity transformation is assumed |
loDistLimitSq | low 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 |
|
nodiscard |
computes the closest point on point cloud to given point
upDistLimitSq | upper limit on the distance in question, if the real distance is larger than the function exits returning upDistLimitSq and no valid point |
xf | pointcloud-to-point transformation, if not specified then identity transformation is assumed |
loDistLimitSq | low 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 |
skipCb | callback to discard VertId projection candidate |
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
upDistLimitSq | upper limit on the distance in question, if the real distance is larger than the function exists returning upDistLimitSq and no valid point |
xf | polyline-to-point transformation, if not specified then identity transformation is assumed |
loDistLimitSq | low 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 |
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
upDistLimitSq | upper limit on the distance in question, if the real distance is larger than the function exists returning upDistLimitSq and no valid point |
xf | polyline-to-point transformation, if not specified then identity transformation is assumed |
loDistLimitSq | low 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 |
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
upDistLimitSq | upper limit on the distance in question, if the real distance is larger than the function exists returning upDistLimitSq and no valid point |
xf | polyline-to-point transformation, if not specified then identity transformation is assumed |
loDistLimitSq | low 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 |
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
offsetPerEdge | offset for each edge of polyline |
upDistLimit | upper limit on the distance in question, if the real distance is larger than the function exists returning upDistLimit and no valid point |
xf | polyline-to-point transformation, if not specified then identity transformation is assumed |
loDistLimit | low 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 |
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
offsetPerEdge | offset for each edge of polyline |
upDistLimit | upper limit on the distance in question, if the real distance is larger than the function exists returning upDistLimit and no valid point |
xf | polyline-to-point transformation, if not specified then identity transformation is assumed |
loDistLimit | low 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 |
|
nodiscard |
computes the closest point on mesh (or its region) to given point
tree | explicitly given BVH-tree for whole mesh or part of mesh we are searching projection on, |
upDistLimitSq | upper limit on the distance in question, if the real distance is larger than the function exits returning upDistLimitSq and no valid point |
xf | mesh-to-point transformation, if not specified then identity transformation is assumed |
loDistLimitSq | low 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 |
validFaces | if provided then only faces from there will be considered as projections |
validProjections | if provided then only projections passed this test can be returned |
MRMESH_API std::vector< EdgePointPair > MR::findSelfCollidingEdgePairs | ( | const Polyline2 & | polyline | ) |
finds all pairs of colliding edges from 2d polyline
MRMESH_API std::vector< UndirectedEdgeUndirectedEdge > MR::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
|
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
|
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
outCollidingPairs | if nullptr then the algorithm returns with true as soon as first collision is found |
|
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
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
rigidB2A | rigid transformation from B-mesh space to A mesh space, nullptr considered as identity transformation |
upDistLimitSq | upper limit on the positive distance in question, if the real distance is larger than the function exists returning upDistLimitSq and no valid points |
|
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)
upDistLimitSq | upper limit on the distance in question, if the real distance is larger then the function exits returning nullopt |
loDistLimitSq | low limit on the distance in question, if the real distance smaller then the function exits returning nullopt |
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
|
nodiscard |
finds two closest points (first id < second id) in whole point cloud
|
inline |
returns the number of nodes in the binary tree with given number of leaves
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
rigidB2A | rigid transformation from B-mesh space to A mesh space, nullptr considered as identity transformation |
|
default |
|
inline |
|
nodiscard |
checks that arbitrary mesh part A is inside of closed mesh part B
rigidB2A | rigid transformation from B-mesh space to A mesh space, nullptr considered as identity transformation |
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
rigidB2A | rigid transformation from B-polyline space to A polyline space, nullptr considered as identity transformation |
|
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
rigidB2A | rigid transformation from B-mesh space to A mesh space, nullptr considered as identity transformation |
|
nodiscard |
detect if given point is inside polyline, by counting ray intersections
polyline | input polyline |
point | input point |
AABBTreeNodeVec< T > MR::makeAABBTreeNodeVec | ( | Buffer< BoxedLeaf< T > > | boxedLeaves | ) |
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
meshPart | mesh (or its part) to find intersections with |
origins | origin point of every ray |
dirs | direction of every ray |
result | output data for every ray |
closestIntersect | finds the closest to ray origin intersection (or any intersection for better performance if !closestIntersect ) |
validFaces | if given then all faces for which false is returned will be skipped |
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
|
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
).
|
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
).
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::rayMeshIntersectAll | ( | const MeshPart & | meshPart, |
const Line3f & | line, | ||
MeshIntersectionCallback | callback, | ||
float | rayStart = 0.0f, | ||
float | rayEnd = FLT_MAX, | ||
const IntersectionPrecomputes< float > * | prec = nullptr ) |
|
nodiscard |
Same as rayMultiMeshAnyIntersectF, but use double precision.
|
nodiscard |
|
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)
MRMESH_API void MR::xyPlaneMeshIntersect | ( | const MeshPart & | meshPart, |
float | zLevel, | ||
FaceBitSet * | fs, | ||
UndirectedEdgeBitSet * | ues, | ||
VertBitSet * | vs ) |
given mesh part and plane z=zLevel, outputs
fs | triangles crossed or touched by the plane |
ues | edges of these triangles |
vs | vertices of these triangles |
int MR::IntersectionPrecomputes< T >::idxX = 0 |
int MR::IntersectionPrecomputes< T >::idxY = 1 |
Vector3<T> MR::IntersectionPrecomputes< T >::invDir |
int MR::IntersectionPrecomputes< T >::maxDimIdxZ = 2 |
Vector3i MR::IntersectionPrecomputes< T >::sign |
stores signs of direction vector;
T MR::IntersectionPrecomputes< T >::Sx |
precomputed factors
T MR::IntersectionPrecomputes< T >::Sy |
T MR::IntersectionPrecomputes< T >::Sz |