6 : a_(a), b_(b), c_(c) {
15 const double div = (a_[0] - c_[0]) * (b_[1] - c_[1])
16 - (b_[0] - c_[0]) * (a_[1] - c_[1]);
18 lambdaA = ( (b_[1] - c_[1]) * (p[0] - c_[0])
19 + (c_[0] - b_[0]) * (p[1] - c_[1]))
21 lambdaB = ( (c_[1] - a_[1]) * (p[0] - c_[0])
22 + (a_[0] - c_[0]) * (p[1] - c_[1]))
24 lambdaC = 1.0 - lambdaA - lambdaB;
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
Triangle(const HomgPoint2D &a, const HomgPoint2D &b, const HomgPoint2D &c)
Constructor.
void GetBarycentricCoords(const HomgPoint2D &p, double &lambdaA, double &lambdaB, double &lambdaC)
Returns the barycentric coordinates of the given point with respect to this triangle.