MCPcopy Create free account
hub / github.com/Geode-solutions/OpenGeode / point_triangle_signed_distance

Function point_triangle_signed_distance

src/geode/geometry/distance.cpp:1284–1300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 )

Callers 1

Calls 4

pivot_and_normalMethod · 0.80
dotMethod · 0.80

Tested by

no test coverage detected