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

Function shortestPathInQuadrangle

source/MRMesh/MRReducePath.cpp:51–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49
50template<typename T>
51T shortestPathInQuadrangle( const Vector3<T>& a, const Vector3<T>& b, const Vector3<T>& c, const Vector3<T>& d )
52{
53 auto vecB = b - a;
54 auto vecC = c - a;
55 auto vecD = d - a;
56 Vector2<T> unfoldB{ vecB.length(), 0 };
57 auto unfoldC = unfoldOnPlane( vecB, vecC, unfoldB, true );
58 auto unfoldD = unfoldOnPlane( vecC, vecD, unfoldC, true );
59 return std::clamp( lineIsect( unfoldC, unfoldB, unfoldD ), T(0), T(1) );
60}
61
62template MRMESH_API float shortestPathInQuadrangle( const Vector3<float>& a, const Vector3<float>& b, const Vector3<float>& c, const Vector3<float>& d );
63template MRMESH_API double shortestPathInQuadrangle( const Vector3<double>& a, const Vector3<double>& b, const Vector3<double>& c, const Vector3<double>& d );

Callers 2

TESTFunction · 0.85
isUnfoldQuadrangleConvexFunction · 0.85

Calls 4

unfoldOnPlaneFunction · 0.85
clampFunction · 0.85
lineIsectFunction · 0.85
lengthMethod · 0.45

Tested by 1

TESTFunction · 0.68