Line-line intersection🔗

Calculates the points where lines, half-lines or line segments intersect. The inputs may contain multiple lines, in which case all intersections will be calculated. If lines are parallel, they are deemed to have no intersection even if they overlapped. Note that the number of intersections grows rapidly with the number of lines.

Each line is parameterized by two points on the line, stored in a 2×2 matrix so that the start point is on the first row and the end point on the second. The line1Type and line2Type input parameters can be used to determine whether the end points are significant or not.

The JoinMatricesTool can be used to convert points to lines.

Inputs🔗

  • line1: The first set of lines.

  • line2: The second set of lines.

  • line1Type: The type of lines in the line1 input.

  • line2Type: The type of lines in the line2 input.

Outputs🔗

  • intersections: A possibly empty set of line intersection points as an N×2 matrix.

enum LineType🔗

Supported line types.

Values:

enumerator Line🔗

The line extends beyond both end points to infinity.

enumerator HalfLine🔗

The line extends beyond the end point but not beyond the start point.

enumerator LineSegment🔗

Neither end of the line extends beyond the extrema.