barycentricWeights method
void
barycentricWeights()
Implementation
void barycentricWeights(
double x,
double y,
double ax,
double ay,
double bx,
double by,
double cx,
double cy,
Vec3 result
) {
result.x = ((by - cy) * (x - cx) + (cx - bx) * (y - cy)) / ((by - cy) * (ax - cx) + (cx - bx) * (ay - cy));
result.y = ((cy - ay) * (x - cx) + (ax - cx) * (y - cy)) / ((by - cy) * (ax - cx) + (cx - bx) * (ay - cy));
result.z = 1 - result.x - result.y;
}