fvr.geom module

class polygon[source]

Bases: object

Properties of a simple polygon.

static str2arr(vertices)[source]
Parameters:

vertices (str)

Return type:

list

__init__(vertices)[source]
Parameters:

vertices (FloatArray | str) – List of points, pair of x and y: [[x1, y1], [x2, y2], ...]

property area: float

Determine the area of a simple polygon.

Example

>>> polygon([[0, 0], [0, 1], [1, 1], [1, 0]]).area
1.0
>>> polygon('[[0, 0], [0, 1], [1, 1], [1, 0]]').area
1.0

Shoelace formula, Gauss’s area formula, surveyor’s formula

https://en.wikipedia.org/wiki/Shoelace_formula