Function swri_geometry_util::LineSegmentIntersection

Function Documentation

bool swri_geometry_util::LineSegmentIntersection(const cv::Vec2d &p1, const cv::Vec2d &p2, const cv::Vec2d &p3, const cv::Vec2d &p4, cv::Vec2d &c)

Calculate the instersection between two line segments defined by 4 points.

In the case of parallel overlapping segments, the intersection point closest to p1 is returned.

Parameters:
  • p1[in] First point of line segment 1.

  • p2[in] Second point of line segment 1.

  • p3[in] First point of line segment 2.

  • p4[in] Second point of line segment 2.

  • c[out] The intersection point.

Returns:

True if the line segments intersect.