Subgroup: other
Class: QgsRegularPolygon¶
-
class
qgis.core.
QgsRegularPolygon
¶ Bases:
sip.wrapper
Regular Polygon geometry type.
A regular polygon is a polygon that is equiangular (all angles are equal in measure) and equilateral (all sides have the same length). The regular polygon is defined by a center point with a number of sides/vertices, a radius and the first vertex.
New in version 3.0: Methods
apothem
Returns the apothem of the regular polygon. area
Returns the area. center
Returns the center point of the regular polygon. centralAngle
Returns the measure of the central angle (the angle subtended at the center of the polygon by one of its sides) in degrees. circumscribedCircle
Returns the circumscribed circle firstVertex
Returns the first vertex (corner) of the regular polygon. inscribedCircle
Returns the inscribed circle interiorAngle
Returns the measure of the interior angles in degrees. isEmpty
A regular polygon is empty if radius equal to 0 or number of sides < 3 length
Returns the length of a side. numberSides
Returns the number of sides of the regular polygon. perimeter
Returns the perimeter. points
Returns a list including the vertices of the regular polygon. radius
Returns the radius. setCenter
Sets the center point. setFirstVertex
Sets the first vertex. setNumberSides
Sets the number of sides. setRadius
Sets the radius. toLineString
Returns as a linestring. toPolygon
Returns as a polygon. toString
Returns a string representation of the regular polygon. toTriangle
Returns as a triangle. triangulate
Returns a triangulation (vertices from sides to the center) of the regular polygon. Attributes
CircumscribedCircle
InscribedCircle
-
CircumscribedCircle
= 1¶
-
class
ConstructionOption
¶ Bases:
int
-
InscribedCircle
= 0¶
-
apothem
(self) → float¶ Returns the apothem of the regular polygon. The apothem is the radius of the inscribed circle.
See also
-
area
(self) → float¶ Returns the area. Returns 0 if the regular polygon is empty.
-
center
(self) → QgsPoint¶ Returns the center point of the regular polygon.
See also
-
centralAngle
(self) → float¶ Returns the measure of the central angle (the angle subtended at the center of the polygon by one of its sides) in degrees.
-
circumscribedCircle
(self) → QgsCircle¶ Returns the circumscribed circle
-
firstVertex
(self) → QgsPoint¶ Returns the first vertex (corner) of the regular polygon.
See also
-
inscribedCircle
(self) → QgsCircle¶ Returns the inscribed circle
-
interiorAngle
(self) → float¶ Returns the measure of the interior angles in degrees.
-
isEmpty
(self) → bool¶ A regular polygon is empty if radius equal to 0 or number of sides < 3
-
length
(self) → float¶ Returns the length of a side. Returns 0 if the regular polygon is empty.
-
numberSides
(self) → int¶ Returns the number of sides of the regular polygon.
See also
-
perimeter
(self) → float¶ Returns the perimeter. Returns 0 if the regular polygon is empty.
-
points
(self) → object¶ Returns a list including the vertices of the regular polygon.
-
radius
(self) → float¶ Returns the radius. This is also the radius of the circumscribing circle.
See also
See also
-
setCenter
(self, center: QgsPoint)¶ Sets the center point. Radius is unchanged. The first vertex is reprojected from the new center.
See also
-
setFirstVertex
(self, firstVertex: QgsPoint)¶ Sets the first vertex. Radius is unchanged. The center is reprojected from the new first vertex.
See also
-
setNumberSides
(self, numberSides: int)¶ Sets the number of sides. If numberSides < 3, the number of sides is unchanged.
See also
-
setRadius
(self, radius: float)¶ Sets the radius. Center is unchanged. The first vertex is reprojected from the center with the new radius.
See also
-
toLineString
(self) → QgsLineString¶ Returns as a linestring.
-
toPolygon
(self) → QgsPolygon¶ Returns as a polygon.
-
toString
(self, pointPrecision: int = 17, radiusPrecision: int = 17, anglePrecision: int = 2) → str¶ Returns a string representation of the regular polygon. Members will be truncated to the specified precision.
-
toTriangle
(self) → QgsTriangle¶ Returns as a triangle. An empty triangle is returned if the regular polygon is empty or if the number of sides is different from 3.
-
triangulate
(self) → object¶ Returns a triangulation (vertices from sides to the center) of the regular polygon. An empty list is returned if the regular polygon is empty.
-