MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / compute_barycentric_coord

Function compute_barycentric_coord

tools/Wires/Inflator/PeriodicInflator.cpp:20–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18
19namespace PeriodicInflatorHelper {
20 Vector3F compute_barycentric_coord(
21 const VectorF& p,
22 const VectorF& a,
23 const VectorF& b,
24 const VectorF& c) {
25 VectorF v0 = b-a;
26 VectorF v1 = c-a;
27 VectorF v2 = p-a;
28 Float d00 = v0.dot(v0);
29 Float d01 = v0.dot(v1);
30 Float d11 = v1.dot(v1);
31 Float d20 = v2.dot(v0);
32 Float d21 = v2.dot(v1);
33 Float denom = d00 * d11 - d01 * d01;
34 Float v = (d11 * d20 - d01 * d21) / denom;
35 Float w = (d00 * d21 - d01 * d20) / denom;
36 Float u = 1.0 - v - w;
37 return Vector3F(u, v, w);
38 }
39}
40using namespace PeriodicInflatorHelper;
41

Callers 2

locateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected