MeshLib Documentation
Loading...
Searching...
No Matches
MRPolylineProject.h
Go to the documentation of this file.
1#pragma once
2#include "MRId.h"
3#include "MRVector3.h"
4#include <cfloat>
5#include <functional>
6
7namespace MR
8{
9
12
13template<typename V>
15{
17 UndirectedEdgeId line;
21 float distSq = 0;
22};
23
30MRMESH_API PolylineProjectionResult2 findProjectionOnPolyline2( const Vector2f& pt, const Polyline2& polyline,
31 float upDistLimitSq = FLT_MAX, AffineXf2f* xf = nullptr, float loDistLimitSq = 0 );
32
39MRMESH_API PolylineProjectionResult3 findProjectionOnPolyline( const Vector3f& pt, const Polyline3& polyline,
40 float upDistLimitSq = FLT_MAX, AffineXf3f* xf = nullptr, float loDistLimitSq = 0 );
41
48MRMESH_API PolylineProjectionResult3 findProjectionOnPolyline( const Line3f& ln, const Polyline3& polyline,
49 float upDistLimitSq = FLT_MAX, AffineXf3f* xf = nullptr, float loDistLimitSq = 0 );
50
51template<typename V>
53{
55 UndirectedEdgeId line;
59 float dist = 0;
60};
61
70 const Vector<float, UndirectedEdgeId>& offsetPerEdge, float upDistLimit = FLT_MAX, AffineXf2f* xf = nullptr, float loDistLimit = 0 );
71
79MRMESH_API PolylineProjectionWithOffsetResult3 findProjectionOnPolylineWithOffset( const Vector3f& pt, const Polyline3& polyline,
80 const Vector<float, UndirectedEdgeId>& offsetPerEdge, float upDistLimit = FLT_MAX, AffineXf3f* xf = nullptr, float loDistLimit = 0 );
81
82template<typename V>
83using FoundEdgeCallback = std::function<void( UndirectedEdgeId, const V& closestPt, float distSq )>;
86
88MRMESH_API void findEdgesInBall( const Polyline2& polyline, const Vector2f& center, float radius, const FoundEdgeCallback2& foundCallback, AffineXf2f* xf = nullptr );
89
91MRMESH_API void findEdgesInBall( const Polyline3& polyline, const Vector3f& center, float radius, const FoundEdgeCallback3& foundCallback, AffineXf3f* xf = nullptr );
92
94MRMESH_API void findMeshEdgesInBall( const Mesh& mesh, const AABBTreePolyline3& tree, const Vector3f& center, float radius, const FoundEdgeCallback3& foundCallback, AffineXf3f* xf = nullptr );
95
102MRMESH_API PolylineProjectionResult3 findProjectionOnMeshEdges( const Vector3f& pt, const Mesh& mesh, const AABBTreePolyline3& tree,
103 float upDistLimitSq = FLT_MAX, AffineXf3f* xf = nullptr, float loDistLimitSq = 0 );
104
111MRMESH_API PolylineProjectionResult3 findProjectionOnMeshEdges( const Line3f& ln, const Mesh& mesh, const AABBTreePolyline3& tree,
112 float upDistLimitSq = FLT_MAX, AffineXf3f* xf = nullptr, float loDistLimitSq = 0 );
113
115
116} // namespace MR
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
std::vector<T>-like container that requires specific indexing type,
Definition MRMesh/MRVector.h:20
MRMESH_API void 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,...
MRMESH_API void 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)
FoundEdgeCallback< Vector2f > FoundEdgeCallback2
Definition MRPolylineProject.h:84
MRMESH_API PolylineProjectionResult3 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 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 PolylineProjectionResult2 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 PolylineProjectionWithOffsetResult3 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
FoundEdgeCallback< Vector3f > FoundEdgeCallback3
Definition MRPolylineProject.h:85
std::function< void(UndirectedEdgeId, const V &closestPt, float distSq)> FoundEdgeCallback
Definition MRPolylineProject.h:83
MRMESH_API Polyline2ProjectionWithOffsetResult 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
Definition MRCameraOrientationPlugin.h:8
MRMESH_CLASS Vector3< double > Matrix2< double > Matrix4< double > SymMatrix3< double > AffineXf2f
Definition MRMesh/MRMeshFwd.h:202
Polyline2ProjectionWithOffsetResult
Definition MRMesh/MRMeshFwd.h:516
Definition MRMesh/MRMesh.h:23
Definition MRPolylineProject.h:15
UndirectedEdgeId line
closest line id on polyline
Definition MRPolylineProject.h:17
float distSq
squared distance from pt to proj
Definition MRPolylineProject.h:21
V point
closest point on polyline, transformed by xf if it is given
Definition MRPolylineProject.h:19
Definition MRPolylineProject.h:53
UndirectedEdgeId line
closest line id on polyline
Definition MRPolylineProject.h:55
V point
closest point on polyline, transformed by xf if it is given
Definition MRPolylineProject.h:57
float dist
distance from offset point to proj
Definition MRPolylineProject.h:59