| 1282 | } |
| 1283 | |
| 1284 | std::tuple< double, Point3D > point_triangle_signed_distance( |
| 1285 | const Point3D& point, const Triangle3D& triangle ) |
| 1286 | { |
| 1287 | if( const auto pivot_and_normal = triangle.pivot_and_normal() ) |
| 1288 | { |
| 1289 | const auto output = pivot_point_triangle_distance( |
| 1290 | point, triangle, pivot_and_normal->first ); |
| 1291 | const auto& nearest_point = std::get< 1 >( output ); |
| 1292 | const Vector3D proj2point{ nearest_point, point }; |
| 1293 | if( proj2point.dot( pivot_and_normal->second ) >= 0 ) |
| 1294 | { |
| 1295 | return output; |
| 1296 | } |
| 1297 | return std::make_tuple( -std::get< 0 >( output ), nearest_point ); |
| 1298 | } |
| 1299 | return no_pivot_point_triangle_distance( point, triangle ); |
| 1300 | } |
| 1301 | |
| 1302 | std::tuple< double, Point3D > point_plane_signed_distance( |
| 1303 | const Point3D& point, const Plane& plane ) |
no test coverage detected