Polygon

class nrv.utils.geom.Polygon(vertices: tuple[float, float] = [[0, 0], [0, 1], [1, 0]])[source]

Polygon class that inherits from Cshape. Represents an polygon eiher from its vertices positions.

Attributes

Polygon.area

Area of the polygon.

Polygon.bbox

Coordinates of the polygon bounding box.

Polygon.bbox_size

Size of the polygon bounding box.

Polygon.c

Center of the polygon as an array.

Polygon.n_gon

Number of polygon vertices.

Polygon.perimeter

Perimeter of the polygon.

Polygon.shp_poly

Polygon representation as a shapely object.

Polygon.x

X-coordinate placeholder for 2D shapes.

Polygon.y

Y-coordinate of the shape center.

Polygon.z

Z-coordinate of the shape center.

Methods

Polygon.__init__([vertices])

Polygon.get_parameters()

Generic method returning all the atributes of an NRV_class instance

Polygon.get_point_inside([n_pts, delta, ...])

Draw random points inside the polygon by rejection sampling.

Polygon.get_trace([n_theta])

Get the trace of the ellipse.

Polygon.is_inside(point[, for_all])

Check whether one or several points lie inside the polygon.

Polygon.load(data[, blacklist])

Generic loading method for NRV_class instance

Polygon.plot(axes[, n_tetha, add_center])

plot the border of the shape

Polygon.plot_bbox(axes, *args, **kwgs)

plot the border of the shape

Polygon.rotate(angle[, degree])

Rotate the polygon around its center.

Polygon.save([save, fname, blacklist])

Generic saving method for NRV_class instance.

Polygon.set_parameters(**kawrgs)

Generic method to set any attribute of NRV_class instance

Polygon.translate([y, z])

Translate the polygon.