MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / limitedProjector

Method limitedProjector

source/MRMesh/MRMeshOrPoints.cpp:121–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119}
120
121auto MeshOrPoints::limitedProjector() const -> LimitedProjectorFunc
122{
123 return std::visit( overloaded{
124 []( const MeshPart & mp ) -> LimitedProjectorFunc
125 {
126 return [&mp]( const Vector3f & p, ProjectionResult & res )
127 {
128 MeshProjectionResult mpr = findProjection( p, mp, res.distSq );
129 if ( mpr.distSq < res.distSq )
130 {
131 res = ProjectionResult
132 {
133 .point = mpr.proj.point,
134 .normal = mp.mesh.pseudonormal( mpr.mtp, mp.region ),
135 .isBd = mpr.mtp.isBd( mp.mesh.topology, mp.region ),
136 .distSq = mpr.distSq,
137 .closestVert = mp.mesh.getClosestVertex( mpr.proj )
138 };
139 return true;
140 }
141 return false;
142 };
143 },
144 []( const PointCloudPart & pcp ) -> LimitedProjectorFunc
145 {
146 return [&pcp]( const Vector3f & p, ProjectionResult & res )
147 {
148 PointsProjectionResult ppr = findProjectionOnPoints( p, pcp, res.distSq );
149 if ( ppr.distSq < res.distSq )
150 {
151 res = ProjectionResult
152 {
153 .point = pcp.cloud.points[ppr.vId],
154 .normal = ppr.vId < pcp.cloud.normals.size() ? pcp.cloud.normals[ppr.vId] : std::optional<Vector3f>{},
155 .distSq = ppr.distSq,
156 .closestVert = ppr.vId
157 };
158 return true;
159 }
160 return false;
161 };
162 }
163 }, var_ );
164}
165
166std::function<MeshOrPoints::ProjectionResult( const Vector3f& )> MeshOrPointsXf::projector() const
167{

Callers 4

updatePointPairsFunction · 0.80
projectOnAllFunction · 0.80
updateLayerPairs_Method · 0.80

Calls 8

findProjectionFunction · 0.85
pseudonormalMethod · 0.80
findProjectionOnPointsFunction · 0.70
isBdMethod · 0.45
getClosestVertexMethod · 0.45
sizeMethod · 0.45
inverseMethod · 0.45
transposedMethod · 0.45

Tested by

no test coverage detected