math docs
    Preparing search index...

    Function closestPoint

    • Finds the point on the polygon's boundary closest to point and writes it to out. point may lie inside, outside, or on the polygon; the result is always on an edge.

      Parameters

      • out: vec2.Vec2

        the vector to store the closest point

      • vertices: number[]

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

      • n: number

        number of vertices to read from vertices

      • point: vec2.Vec2

        the query point

      Returns vec2.Vec2

      out