MeshLib Documentation
Loading...
Searching...
No Matches
MRMesh/MRMeshProject.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRPointOnFace.h"
4#include "MRMeshTriPoint.h"
5#include "MRMeshPart.h"
6#include "MREnums.h"
7#include <cfloat>
8#include <optional>
9#include <functional>
10
11namespace MR
12{
13
16
26
35[[nodiscard]] MRMESH_API MeshProjectionResult findProjection( const Vector3f & pt, const MeshPart & mp,
36 float upDistLimitSq = FLT_MAX,
37 const AffineXf3f * xf = nullptr,
38 float loDistLimitSq = 0,
39 const FacePredicate & validFaces = {},
40 const std::function<bool(const MeshProjectionResult&)> & validProjections = {} );
41
51[[nodiscard]] MRMESH_API MeshProjectionResult findProjectionSubtree( const Vector3f & pt,
52 const MeshPart & mp, const AABBTree & tree,
53 float upDistLimitSq = FLT_MAX,
54 const AffineXf3f * xf = nullptr,
55 float loDistLimitSq = 0,
56 const FacePredicate & validFaces = {},
57 const std::function<bool(const MeshProjectionResult&)> & validProjections = {} );
58
59struct Ball
60{
61 Vector3f center;
62 float radiusSq = 0;
63};
64
66using FoundTriCallback = std::function<Processing( const MeshProjectionResult & found, Ball & ball )>;
67
70MRMESH_API void findTrisInBall( const MeshPart & mp, Ball ball, const FoundTriCallback& foundCallback, const FacePredicate & validFaces = {} );
71
81
88[[nodiscard]] MRMESH_API std::optional<SignedDistanceToMeshResult> findSignedDistance( const Vector3f & pt, const MeshPart & mp,
89 float upDistLimitSq = FLT_MAX, float loDistLimitSq = 0 );
90
92
93} // namespace MR
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
Definition MRAABBTree.h:16
MRMESH_API MeshMeshSignedDistanceResult findSignedDistance(const MeshPart &a, const MeshPart &b, const AffineXf3f *rigidB2A=nullptr, float upDistLimitSq=FLT_MAX)
computes minimal distance between two meshes
MRMESH_API MeshProjectionResult 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
std::function< Processing(const MeshProjectionResult &found, Ball &ball)> FoundTriCallback
this callback is invoked on every triangle at least partially in the ball, and allows to change the b...
Definition MRMesh/MRMeshProject.h:66
MRMESH_API void findTrisInBall(const MeshPart &mp, Ball ball, const FoundTriCallback &foundCallback, const FacePredicate &validFaces={})
MRMESH_API MeshProjectionResult 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
Definition MRCameraOrientationPlugin.h:8
std::function< bool(FaceId)> FacePredicate
Definition MRMesh/MRMeshFwd.h:423
Processing
typically returned from callbacks to control the behavior of main algorithm
Definition MREnums.h:24
Definition MRMesh/MRMeshProject.h:60
Vector3f center
Definition MRMesh/MRMeshProject.h:61
float radiusSq
Definition MRMesh/MRMeshProject.h:62
Definition MRMesh/MRMeshProject.h:18
float distSq
squared distance from pt to proj
Definition MRMesh/MRMeshProject.h:24
MeshTriPoint mtp
its barycentric representation
Definition MRMesh/MRMeshProject.h:22
PointOnFace proj
the closest point on mesh, transformed by xf if it is given
Definition MRMesh/MRMeshProject.h:20
Definition MRMesh/MRMeshTriPoint.h:23
Definition MRMesh/MRPointOnFace.h:11
Definition MRMesh/MRMeshProject.h:73
float dist
distance from pt to proj (positive - outside, negative - inside the mesh)
Definition MRMesh/MRMeshProject.h:79
PointOnFace proj
the closest point on mesh
Definition MRMesh/MRMeshProject.h:75
MeshTriPoint mtp
its barycentric representation
Definition MRMesh/MRMeshProject.h:77