29 (A_start_x - A_end_x) * (B_start_y - B_end_y) - (A_start_y - A_end_y) * (B_start_x - B_end_x);
32 if (coordIs.zero(denom))
return false;
34 double const A = (A_start_x * A_end_y - A_start_y * A_end_x) / denom;
35 double const B = (B_start_x * B_end_y - B_start_y * B_end_x) / denom;
37 x = (B_start_x - B_end_x) * A - (A_start_x - A_end_x) * B;
38 y = (B_start_y - B_end_y) * A - (A_start_y - A_end_y) * B;
56 A_start_x, A_start_y, A_end_x, A_end_y, B_start_x, B_start_y, B_end_x, B_end_y, x, y);
59 mf::LogWarning(
"IntersectSegments") <<
"The segments are parallel!";
64 A_start_x, A_start_y, A_end_x, A_end_y, B_start_x, B_start_y, B_end_x, B_end_y, x, y);
Functions to help with numbers.
Provides simple real number checks.
bool IntersectSegments(double A_start_x, double A_start_y, double A_end_x, double A_end_y, double B_start_x, double B_start_y, double B_end_x, double B_end_y, double &x, double &y)
Computes the intersection between two segments on a plane.
bool PointWithinSegments(double A_start_x, double A_start_y, double A_end_x, double A_end_y, double B_start_x, double B_start_y, double B_end_x, double B_end_y, double x, double y)
Returns whether x and y are within both specified ranges (A and B).
Class for approximate comparisons.
bool IntersectLines(double A_start_x, double A_start_y, double A_end_x, double A_end_y, double B_start_x, double B_start_y, double B_end_x, double B_end_y, double &x, double &y)
Computes the intersection between two lines on a plane.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
Namespace collecting geometry-related classes utilities.