MCPcopy Create free account
hub / github.com/RenderKit/embree / ImTriangleBarycentricCoords

Function ImTriangleBarycentricCoords

tutorials/common/imgui/imgui.cpp:1590–1599  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1588}
1589
1590void ImTriangleBarycentricCoords(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p, float& out_u, float& out_v, float& out_w)
1591{
1592 ImVec2 v0 = b - a;
1593 ImVec2 v1 = c - a;
1594 ImVec2 v2 = p - a;
1595 const float denom = v0.x * v1.y - v1.x * v0.y;
1596 out_v = (v2.x * v1.y - v1.x * v2.y) / denom;
1597 out_w = (v0.x * v2.y - v2.x * v0.y) / denom;
1598 out_u = 1.0f - out_v - out_w;
1599}
1600
1601ImVec2 ImTriangleClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p)
1602{

Callers 1

ColorPicker4Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected