21bool point_on_segment_2d(Eigen::Vector2d p, Eigen::Vector2d a, Eigen::Vector2d b);
24bool point_on_segment_3d(Eigen::Vector3d p, Eigen::Vector3d a, Eigen::Vector3d b);
41template <
typename Po
intType>
43 const Eigen::MatrixBase<PointType>& p,
44 const Eigen::MatrixBase<PointType>& a,
45 const Eigen::MatrixBase<PointType>& b)
47 if (p.size() == 2 && a.size() == 2 && b.size() == 2) {
48 Eigen::Vector2d p2d(
static_cast<double>(p.x()),
static_cast<double>(p.y()));
49 Eigen::Vector2d a2d(
static_cast<double>(a.x()),
static_cast<double>(a.y()));
50 Eigen::Vector2d b2d(
static_cast<double>(b.x()),
static_cast<double>(b.y()));
51 return internal::point_on_segment_2d(p2d, a2d, b2d);
52 }
else if (p.size() == 3 && a.size() == 3 && b.size() == 3) {
54 static_cast<double>(p[0]),
55 static_cast<double>(p[1]),
56 static_cast<double>(p[2]));
58 static_cast<double>(a[0]),
59 static_cast<double>(a[1]),
60 static_cast<double>(a[2]));
62 static_cast<double>(b[0]),
63 static_cast<double>(b[1]),
64 static_cast<double>(b[2]));
65 return internal::point_on_segment_3d(p3d, a3d, b3d);
67 throw std::runtime_error(
"Incompatible types");
Main namespace for Lagrange.
Definition: AABBIGL.h:30
bool point_on_segment(const Eigen::MatrixBase< PointType > &p, const Eigen::MatrixBase< PointType > &a, const Eigen::MatrixBase< PointType > &b)
Test if a point lies exactly on a segment [a,b] using exact predicates.
Definition: point_on_segment.h:42