| 119 | } |
| 120 | |
| 121 | auto 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 | |
| 166 | std::function<MeshOrPoints::ProjectionResult( const Vector3f& )> MeshOrPointsXf::projector() const |
| 167 | { |
no test coverage detected