Function closestPointRect

Returns the closest point on a rectangle to a given point

  • Parameters

    • rect: Vec2[]

      The top-right, top-left, bottom-left, bottom-right points (in that order) of the rectangle

    • pt: Vec2

      the point

    Returns Vec2

    The closest point on the rectangle