Shapes should implement this interface if they support intersection calculation.

interface Intersectable {
    lineIntersectionTangents(line, inVectorBoundsOnly?): Vector[];
    lineIntersections(line, inVectorBoundsOnly?): Vertex[];
}

Implemented by

Methods

  • Get all line intersections of this polygon and their tangents along the shape.

    This method returns all intersection tangents (as vectors) with this shape. The returned array of vectors is in no specific order.

    Parameters

    • line: VertTuple<any>

      The line to find intersections with.

    • Optional inVectorBoundsOnly: boolean

      (default=false) If set to true only intersecion points on the passed vector are returned (located strictly between start and end vertex).

    Returns Vector[]

    • An array of all intersection tangents within this shape's bounds.
  • Get all line intersections with this polygon.

    This method returns all intersections (as vertices) with this shape. The returned array of vertices is in no specific order.

    See demo 47-closest-vector-projection-on-polygon for how it works.

    Parameters

    • line: VertTuple<any>

      The line to find intersections with.

    • Optional inVectorBoundsOnly: boolean

      (default=false) If set to true only intersecion points on the passed vector are returned (located strictly between start and end vertex).

    Returns Vertex[]

    • An array of all intersections within this shape's bounds.