MeshLib C++ Docs
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
28{
29 const AffineXf3f* rigidXfPoint{ nullptr };
30 const AffineXf3f* nonRigidXfTree{ nullptr };
31};
32
40MRMESH_API MeshProjectionTransforms createProjectionTransforms( AffineXf3f& storageXf, const AffineXf3f* pointXf, const AffineXf3f* treeXf );
41
50[[nodiscard]] MRMESH_API MeshProjectionResult findProjection( const Vector3f & pt, const MeshPart & mp,
51 float upDistLimitSq = FLT_MAX,
52 const AffineXf3f * xf = nullptr,
53 float loDistLimitSq = 0,
54 const FacePredicate & validFaces = {},
55 const std::function<bool(const MeshProjectionResult&)> & validProjections = {} );
56
66[[nodiscard]] MRMESH_API MeshProjectionResult findProjectionSubtree( const Vector3f & pt,
67 const MeshPart & mp, const AABBTree & tree,
68 float upDistLimitSq = FLT_MAX,
69 const AffineXf3f * xf = nullptr,
70 float loDistLimitSq = 0,
71 const FacePredicate & validFaces = {},
72 const std::function<bool(const MeshProjectionResult&)> & validProjections = {} );
73
75using FoundTriCallback = std::function<Processing( const MeshProjectionResult & found, Ball3f & ball )>;
76
79MRMESH_API void findTrisInBall( const MeshPart & mp, Ball3f ball, const FoundTriCallback& foundCallback, const FacePredicate & validFaces = {} );
80
90
97[[nodiscard]] MRMESH_API std::optional<SignedDistanceToMeshResult> findSignedDistance( const Vector3f & pt, const MeshPart & mp,
98 float upDistLimitSq = FLT_MAX, float loDistLimitSq = 0 );
99
101
102} // namespace MR
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:79
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 MeshProjectionTransforms createProjectionTransforms(AffineXf3f &storageXf, const AffineXf3f *pointXf, const AffineXf3f *treeXf)
Creates structure with simplified transforms for projection functions, with rigidXfPoint applied to p...
std::function< Processing(const MeshProjectionResult &found, Ball3f &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:75
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
MRMESH_API void findTrisInBall(const MeshPart &mp, Ball3f 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
std::function< bool(FaceId)> FacePredicate
Definition MRMesh/MRMeshFwd.h:468
Processing
typically returned from callbacks to control the behavior of main algorithm
Definition MREnums.h:24
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/MRMeshProject.h:28
const AffineXf3f * rigidXfPoint
this xf is applied to point to move it into projection space
Definition MRMesh/MRMeshProject.h:29
const AffineXf3f * nonRigidXfTree
this xf is applied to AABB tree to move it into projection space
Definition MRMesh/MRMeshProject.h:30
Definition MRMesh/MRMeshTriPoint.h:23
Definition MRMesh/MRPointOnFace.h:11
Definition MRMesh/MRMeshProject.h:82
float dist
distance from pt to proj (positive - outside, negative - inside the mesh)
Definition MRMesh/MRMeshProject.h:88
PointOnFace proj
the closest point on mesh
Definition MRMesh/MRMeshProject.h:84
MeshTriPoint mtp
its barycentric representation
Definition MRMesh/MRMeshProject.h:86