Subgroup: Ellipse
Class: QgsEllipse¶
-
class
qgis.core.
QgsEllipse
¶ Bases:
sip.wrapper
Ellipse geometry type.
An ellipse is defined by a center point with a semi-major axis, a semi-minor axis and an azimuth. The azimuth is the north angle to the first quadrant (always oriented on the semi-major axis), in degrees. By default, the semi-major axis is oriented to the east (90 degrees). The semi-minor axis is always smaller than the semi-major axis. If it is set larger, it will be swapped and the azimuth will increase by 90 degrees.
New in version 3.0: Methods
area
The area of the ellipse. azimuth
Returns the azimuth. boundingBox
Returns the minimal bounding box for the ellipse. center
Returns the center point. eccentricity
The eccentricity of the ellipse. foci
Two foci of the ellipse. focusDistance
The distance between the center and each foci. fromCenter2Points
Constructs an ellipse by a central point and two other points. fromCenterPoint
Constructs an ellipse by a center point and a another point. fromExtent
Constructs an ellipse by an extent (aka bounding box / QgsRectangle
).fromFoci
Constructs an ellipse by foci ( pt1
andpt2
) and a pointpt3
.isEmpty
An ellipse is empty if axes are equal to 0 orientedBoundingBox
Returns the oriented minimal bounding box for the ellipse. perimeter
The circumference of the ellipse using first approximation of Ramanujan. points
Returns a list of points with segmentation from segments
.quadrant
The four quadrants of the ellipse. semiMajorAxis
Returns the semi-major axis. semiMinorAxis
Returns the semi-minor axis. setAzimuth
Sets the azimuth (orientation). setCenter
Sets the center point. setSemiMajorAxis
Sets the semi-major axis. setSemiMinorAxis
Sets the semi-minor axis. toLineString
Returns a segmented linestring. toPolygon
Returns a segmented polygon. toString
returns a string representation of the ellipse. Attributes
-
area
(self) → float¶ The area of the ellipse.
-
azimuth
(self) → float¶ Returns the azimuth.
See also
-
boundingBox
(self) → QgsRectangle¶ Returns the minimal bounding box for the ellipse.
-
center
(self) → QgsPoint¶ Returns the center point.
See also
See also
rcenter()
-
eccentricity
(self) → float¶ The eccentricity of the ellipse. nan is returned if the ellipse is empty.
-
foci
(self) → List[QgsPoint]¶ Two foci of the ellipse. The axes are oriented by the azimuth and are on the semi-major axis.
See also
See also
Returns: the two foci.
-
focusDistance
(self) → float¶ The distance between the center and each foci.
See also
See also
Returns: The distance between the center and each foci.
-
fromCenter2Points
(ptc: QgsPoint, pt1: QgsPoint, pt2: QgsPoint) → QgsEllipse¶ Constructs an ellipse by a central point and two other points. The center point keeps z and m values from
ptc
. Axes are calculated from the 2D distance betweenptc
andpt1
andpt2
. The azimuth is the angle betweenptc
andpt1
.Parameters: - ptc – Center point.
- pt1 – First point.
- pt2 – Second point.
-
fromCenterPoint
(ptc: QgsPoint, pt1: QgsPoint) → QgsEllipse¶ Constructs an ellipse by a center point and a another point. The center point keeps z and m values from
ptc
. Axes are calculated from the 2D distance betweenptc
andpt1
. The azimuth always takes the default value.Parameters: - ptc – Center point.
- pt1 – First point.
-
fromExtent
(pt1: QgsPoint, pt2: QgsPoint) → QgsEllipse¶ Constructs an ellipse by an extent (aka bounding box /
QgsRectangle
). The center point can have z and m values which are the result from the midpoint operation betweenpt1
andpt2
. Axes are calculated from the 2D distance betweenpt1
andpt2
. The azimuth always takes the default value.Parameters: - pt1 – First corner.
- pt2 – Second corner.
-
fromFoci
(pt1: QgsPoint, pt2: QgsPoint, pt3: QgsPoint) → QgsEllipse¶ Constructs an ellipse by foci (
pt1
andpt2
) and a pointpt3
. The center point can have z and m values which are the result from the midpoint operation betweenpt1
andpt2
. Axes are calculated from the 2D distance with the third pointpt3
. The azimuth is the angle betweenpt1
andpt2
.Parameters: - pt1 – First focus.
- pt2 – Second focus.
- pt3 – A point to calculate the axes.
-
isEmpty
(self) → bool¶ An ellipse is empty if axes are equal to 0
-
orientedBoundingBox
(self) → QgsPolygon¶ Returns the oriented minimal bounding box for the ellipse.
-
perimeter
(self) → float¶ The circumference of the ellipse using first approximation of Ramanujan.
-
points
(self, segments: int = 36) → object¶ Returns a list of points with segmentation from
segments
.Parameters: segments – Number of segments used to segment geometry.
-
quadrant
(self) → List[QgsPoint]¶ The four quadrants of the ellipse. They are oriented and started always from semi-major axis.
Returns: quadrants defined by four points.
-
semiMajorAxis
(self) → float¶ Returns the semi-major axis.
See also
-
semiMinorAxis
(self) → float¶ Returns the semi-minor axis.
See also
-
setSemiMajorAxis
(self, semiMajorAxis: float)¶ Sets the semi-major axis.
See also
-
setSemiMinorAxis
(self, semiMinorAxis: float)¶ Sets the semi-minor axis.
See also
-
toLineString
(self, segments: int = 36) → QgsLineString¶ Returns a segmented linestring.
Parameters: segments – Number of segments used to segment geometry.
-
toPolygon
(self, segments: int = 36) → QgsPolygon¶ Returns a segmented polygon.
Parameters: segments – Number of segments used to segment geometry.
-
toString
(self, pointPrecision: int = 17, axisPrecision: int = 17, azimuthPrecision: int = 2) → str¶ returns a string representation of the ellipse. Members will be truncated to the specified precision.
-