- class compas.geometry.Polygon(points, **kwargs)
A polygon is defined by a sequence of points forming a closed loop.
points (list[[float, float, float] |
compas.geometry.Point]) – An ordered list of points.
points (list of
compas.geometry.Point) – The points of the polygon.
lines (list of
compas.geometry.Line, read-only) – The lines of the polygon.
length (float, read-only) – The length of the boundary.
compas.geometry.Point, read-only) – The centroid of the polygon.
compas.geometry.Vector, read-only) – The (average) normal of the polygon.
area (float, read-only) – The area of the polygon.
A polygon is defined by a sequence of points connected by line segments forming a closed boundary that separates its interior from the exterior.
In the sequence of points, the first and last element are not the same. The existence of the closing edge is implied. The boundary should not intersect itself.
Polygons are not necessarily planar by construction; they can be warped.
>>> polygon = Polygon([[0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]]) >>> polygon.centroid Point(0.500, 0.500, 0.000) >>> polygon.area 1.0
Construct a polygon from its data representation.
Construct a polygon from a number of sides and a radius.
Determine if the polygon is convex.
Determine if the polygon is planar.
Transform this polygon.
Make an independent copy of the data object.
Construct an object from serialized data contained in a JSON file.
Construct an object from serialized data contained in a JSON string.
Convert an object to its native data representation.
Serialize the data representation of an object to a JSON file.
Serialize the data representation of an object to a JSON string.
Returns a transformed copy of this geometry.
Validate the object's data against its data schema.
Validate the object's data against its json schema.