nodesnim/core/polygon2

Provides primitive 2d polygon.

Procs

proc Polygon2(pnts: varargs[Vector2Obj]): Polygon2Obj {...}{.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: var seq[Vector2Obj]): Polygon2Obj {...}{.raises: [], tags: [].}

Creates a new Polygon2 object.

Arguments:

  • pnts is a points for the Polygon. points count should be more than 2.
proc hasPoint(self: Polygon2Obj; x, y: float): bool {...}{.raises: [], tags: [].}
Returns true, if point x, y in the Polygon2.
proc hasPoint(self: Polygon2Obj; vec2: Vector2Obj): bool {...}{.inline, raises: [],
    tags: [].}
Returns true, if point vec2 in the Polygon2.
proc intersects(self, other: Polygon2Obj): bool {...}{.raises: [], tags: [].}
Returns true, if two polygons intersect.
proc intersects(self: Polygon2Obj; r: Rect2Obj): bool {...}{.raises: [], tags: [].}
Returns true, if rect intersect with polygon.
proc intersects(self: Polygon2Obj; circle: CircleObj): bool {...}{.raises: [],
    tags: [].}
Returns true, if circle intersect with polygon.
proc move(self: var Polygon2Obj; vec2: Vector2Obj) {...}{.raises: [], tags: [].}
Moves polygon.