distance_point_line_xy

compas.geometry.distance_point_line_xy(point, line)[source]

Compute the distance between a point and a line, assuming they lie in the XY-plane.

Parameters
  • point ([float, float] or [float, float, float] | Point) – XY(Z) coordinates of the point.

  • line ([point, point] | Line) – Line defined by two points.

Returns

float – The distance between the point and the line.

Notes

This implementation computes the orthogonal distance from a point P to a line defined by points A and B as twice the area of the triangle ABP divided by the length of AB 1.

References

1

Wikipedia. Distance from a point to a line. Available at: https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line.