Instances represent a solid polygon.
The polygon is a triangle fan from the attribute centroid to the points in the attribute points (inherited from GLine). If you wish to construct a convex polygon, simply store the outside border in point, and assign centroid any point inside the polygon. If you do not assign a centroid, one will be computed by averaging all of the points on the boundary.
We use this approach to define polygons as it allows us to avoid complex tesselation algorithms.
Constructor: creates a new solid polyon
param keywords: dictionary of keyword arguments Precondition: See below.
To use the constructor for this class, you should provide it with a list of keyword arguments that initialize various attributes. For example, to create a hexagon, use the constructor call
GPolygon(points=[0.87,0.5,0,1,-0.87,0.5,-0.87,-0.5,0,-1,0.87,-0.5])
As with GLine the position and size attributes of this class are all immutable. They are computed from the list of points. If the shape is not convex, you must specify a centroid to act as the anchor for the triangle fan. Otherwise, the centroid is computed automatically.
This class is a subclass of GObject, and inherits all of its attributes and methods.
These attributes are in addition to those from GObject.
The sequence of points that make up this line.
Invariant: Must be a sequence (list or tuple) of int or float. The length of this sequence must be even with length at least 4.
This attribute is computed automatically from the attribute points
This attribute is computed automatically from the attribute points
This attribute is computed automatically from the attribute points
This attribute is computed automatically from the attribute points