24 #ifndef __UTILS_MATH_TRIANGLE_H_ 25 #define __UTILS_MATH_TRIANGLE_H_ 40 const Eigen::Vector2f &p2)
42 return 1.f/2.f*(-p1[1]*p2[0] + p0[1]*(-p1[0] + p2[0]) + p0[0]*(p1[1] - p2[1]) + p1[0]*p2[1]);
57 const Eigen::Vector2f &p2,
const Eigen::Vector2f &p)
62 1./area_2*(p0[1]*p2[0] - p0[0]*p2[1] + (p2[1] - p0[1])*p[0] + (p0[0] - p2[0])*p[1]);
63 if (s < 0)
return false;
66 1./area_2*(p0[0]*p1[1] - p0[1]*p1[0] + (p0[1] - p1[1])*p[0] + (p1[0] - p0[0])*p[1]);
67 if (t < 0)
return false;
Fawkes library namespace.
double triangle_area(const Eigen::Vector2f &p0, const Eigen::Vector2f &p1, const Eigen::Vector2f &p2)
Calculate triangle area.
bool triangle_contains(const Eigen::Vector2f &p0, const Eigen::Vector2f &p1, const Eigen::Vector2f &p2, const Eigen::Vector2f &p)
Check if a triangle contains a point.