math docs
    Preparing search index...

    Function intersectsSegment

    • Tests whether the segment a-b intersects the polygon, i.e. it has an endpoint inside the polygon or crosses one of its edges. Works for convex and concave polygons.

      Parameters

      • vertices: number[]

        polygon vertices as a flat array [x0, y0, x1, y1, ...]

      • n: number

        number of vertices to read from vertices

      • a: vec2.Vec2

        start of the segment

      • b: vec2.Vec2

        end of the segment

      Returns boolean

      true if the segment intersects the polygon