MeshLib C++ Docs
Loading...
Searching...
No Matches
MRClosestWeightedPoint.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRMeshFwd.h"
4#include "MRMeshTriPoint.h"
5#include "MRPch/MRBindingMacros.h"
6#include <cfloat>
7
8namespace MR
9{
12
13
15{
17 VertId vId;
18
20 float dist = 0;
21
23 [[nodiscard]] bool valid() const { return vId.valid(); }
24 [[nodiscard]] explicit operator bool() const { return vId.valid(); }
25};
26
28{
30 Vector3f loc;
31
34
36 float eucledeanDist = 0;
37
39 float w = 0;
40
46
48 [[nodiscard]] float bidirDist() const
49 {
50 return eucledeanDist - w;
51 }
52
56 [[nodiscard]] float dist() const
57 {
59 }
60
63 {
64 if ( bidirectionalOrOutside && other.bidirectionalOrOutside )
65 return eucledeanDist - w <=> other.eucledeanDist - other.w;
66 if ( bidirectionalOrOutside != other.bidirectionalOrOutside )
67 return eucledeanDist <=> other.eucledeanDist;
68 return eucledeanDist + ( bidirectionalOrOutside ? -w : w ) <=>
69 other.eucledeanDist + ( other.bidirectionalOrOutside ? -other.w : other.w );
70 }
71
73 [[nodiscard]] bool valid() const { return mtp.valid(); }
74 [[nodiscard]] explicit operator bool() const { return mtp.valid(); }
75};
76
78{
80 VertMetric pointWeight;
81
84 float minWeight = 0;
85
88 float maxWeight = 0;
89
92 float maxWeightGrad = FLT_MAX;
93
98 bool bidirectionalMode = true;
99
101 MR_BIND_PREFER_UNLOCK_GIL_WHEN_USED_AS_PARAM
102};
103
113
117[[nodiscard]] MRMESH_API PointAndDistance findClosestWeightedPoint( const Vector3f& loc,
118 const AABBTreePoints& tree, const DistanceFromWeightedPointsComputeParams& params );
119
123[[nodiscard]] MRMESH_API MeshPointAndDistance findClosestWeightedMeshPoint( const Vector3f& loc,
124 const Mesh& mesh, const DistanceFromWeightedPointsComputeParams& params );
125
126}
bounding volume hierarchy for point cloud structure
Definition MRAABBTreePoints.h:16
float minWeight
Definition MRClosestWeightedPoint.h:84
MeshTriPoint mtp
the corresponding point on mesh in barycentric representation
Definition MRClosestWeightedPoint.h:33
VertMetric pointWeight
function returning the weight of each point, must be set by the user
Definition MRClosestWeightedPoint.h:80
float maxBidirDist
default 0 here does not work for negative distances
Definition MRClosestWeightedPoint.h:111
float maxWeight
Definition MRClosestWeightedPoint.h:88
bool valid() const
check for validity, otherwise there is no point closer than maxBidirDist
Definition MRClosestWeightedPoint.h:23
float eucledeanDist
euclidean distance from input location to mtp
Definition MRClosestWeightedPoint.h:36
bool bidirectionalMode
Definition MRClosestWeightedPoint.h:98
bool valid() const
consider this valid if the edge ID is valid
Definition MRMeshTriPoint.h:61
float dist() const
Definition MRClosestWeightedPoint.h:56
float w
point's weight
Definition MRClosestWeightedPoint.h:39
MRMESH_API PointAndDistance findClosestWeightedPoint(const Vector3f &loc, const AABBTreePoints &tree, const DistanceFromWeightedPointsComputeParams &params)
bool bidirectionalOrOutside
Definition MRClosestWeightedPoint.h:45
MRMESH_API MeshPointAndDistance findClosestWeightedMeshPoint(const Vector3f &loc, const Mesh &mesh, const DistanceFromWeightedPointsComputeParams &params)
float dist
the distance from input location to point vId considering point's weight
Definition MRClosestWeightedPoint.h:20
Vector3f loc
point location
Definition MRClosestWeightedPoint.h:30
float bidirDist() const
bidirectional distance from input location to mtp considering point's weight
Definition MRClosestWeightedPoint.h:48
auto operator<=>(const MeshPointAndDistance &other) const
comparison telling which point is closer to the location
Definition MRClosestWeightedPoint.h:62
float maxWeightGrad
Definition MRClosestWeightedPoint.h:92
VertId vId
a cloud's point
Definition MRClosestWeightedPoint.h:17
float minBidirDist
Definition MRClosestWeightedPoint.h:108
bool valid() const
check for validity, otherwise there is no point closer than maxBidirDist
Definition MRClosestWeightedPoint.h:73
@ other
Angle, normally float. Measure in radians.
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRClosestWeightedPoint.h:105
Definition MRClosestWeightedPoint.h:78
Definition MRClosestWeightedPoint.h:28
Definition MRMeshTriPoint.h:26
Definition MRMesh.h:23
Definition MRClosestWeightedPoint.h:15