Provides primitive 2d polygon.
Types
Polygon2Obj = object positions*: seq[Vector2Ref]
Polygon2Ref = ref Polygon2Obj
Procs
proc Polygon2(pnts: varargs[Vector2Ref]): Polygon2Ref {...}{.raises: [], tags: [].}
-
Creates a new Polygon2 object.
Arguments:
- pnts is a points for the Polygon. points count should be more than 2.
proc Polygon2(pnts: seq[Vector2Ref]): Polygon2Ref {...}{.raises: [], tags: [].}
-
Creates a new Polygon2 object.
Arguments:
- pnts is a points for the Polygon. points count should be more than 2.
proc contains(self: Polygon2Ref; x, y: float): bool {...}{.raises: [], tags: [].}
- Returns true, if point x, y in the Polygon2.
proc contains(self: Polygon2Ref; vec2: Vector2Ref): bool {...}{.inline, raises: [], tags: [].}
- Returns true, if point vec2 in the Polygon2.
proc intersects(self, other: Polygon2Ref): bool {...}{.raises: [], tags: [].}
- Returns true, if two polygons intersect.
proc intersects(self: Polygon2Ref; r: Rect2Ref): bool {...}{.raises: [], tags: [].}
- Returns true, if rect intersect with polygon.
proc intersects(self: Polygon2Ref; circle: Circle2Ref): bool {...}{.raises: [], tags: [].}
- Returns true, if circle intersect with polygon.
proc move(self: Polygon2Ref; vec2: Vector2Ref) {...}{.raises: [], tags: [].}
- Moves polygon.