/** * Packs the closest edge to the given point. */ public static boolean getClosestEdge(Point2d point, ConvexPolygon2d polygon, LineSegment2d edgeToPack) { int edgeIndex = getClosestEdgeIndex(point, polygon); if (edgeIndex == -1) return false; edgeToPack.set(polygon.getVertex(edgeIndex), polygon.getNextVertex(edgeIndex)); return true; }