Class: QgsEllipse¶
- class qgis.core.QgsEllipse¶
Bases:
sip.wrapper
Constructor for QgsEllipse.
QgsEllipse(center:
QgsPoint
, semiMajorAxis: float, semiMinorAxis: float, azimuth: float = 90) Constructs an ellipse by defining all the members.- Parameters
center – The center of the ellipse.
semiMajorAxis – Semi-major axis of the ellipse.
semiMinorAxis – Semi-minor axis of the ellipse.
azimuth – Angle in degrees started from the North to the first quadrant.
QgsEllipse(
QgsEllipse
)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
The area of the ellipse.
Returns the azimuth.
Returns the minimal bounding box for the ellipse.
Returns the center point.
The eccentricity of the ellipse.
Two foci of the ellipse.
The distance between the center and each foci.
Constructs an ellipse by a central point and two other points.
Constructs an ellipse by a center point and a another point.
Constructs an ellipse by an extent (aka bounding box /
QgsRectangle
).Constructs an ellipse by foci (
pt1
andpt2
) and a pointpt3
.An ellipse is empty if axes are equal to 0
Returns the oriented minimal bounding box for the ellipse.
The circumference of the ellipse using first approximation of Ramanujan.
Returns a list of points with segmentation from
segments
.The four quadrants of the ellipse.
Returns the semi-major axis.
Returns the semi-minor axis.
Sets the azimuth (orientation).
Sets the center point.
Sets the semi-major axis.
Sets the semi-minor axis.
Returns a segmented linestring.
Returns a segmented polygon.
returns a string representation of the ellipse.
- area(self) float ¶
The area of the ellipse.
- Return type
float
- azimuth(self) float ¶
Returns the azimuth.
See also
- Return type
float
- boundingBox(self) QgsRectangle ¶
Returns the minimal bounding box for the ellipse.
- Return type
- eccentricity(self) float ¶
The eccentricity of the ellipse. nan is returned if the ellipse is empty.
- Return type
float
- 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
- Return type
List[QgsPoint]
- Returns
the two foci.
- focusDistance(self) float ¶
The distance between the center and each foci.
See also
See also
- Return type
float
- 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 m value from
ptc
. Z dimension is also supported and is retrieved from the first 3D point amongstptc
,pt1
andpt2
. Axes are calculated from the 2D distance betweenptc
andpt1
andpt2
. The azimuth is the angle betweenptc
andpt1
.- Parameters
- Return type
- fromCenterPoint(ptc: QgsPoint, pt1: QgsPoint) QgsEllipse ¶
Constructs an ellipse by a center point and a another point. The center point keeps m value from
ptc
. Z dimension is also supported and is retrieved from the first 3D point amongstptc
andpt1
. Axes are calculated from the 2D distance betweenptc
andpt1
. The azimuth always takes the default value.- Parameters
- Return type
- fromExtent(pt1: QgsPoint, pt2: QgsPoint) QgsEllipse ¶
Constructs an ellipse by an extent (aka bounding box /
QgsRectangle
). The center point can have m value which is the result from the midpoint operation betweenpt1
andpt2
. Z dimension is also supported and is retrieved from the first 3D point amongstpt1
andpt2
. Axes are calculated from the 2D distance betweenpt1
andpt2
. The azimuth always takes the default value.- Parameters
- Return type
- fromFoci(pt1: QgsPoint, pt2: QgsPoint, pt3: QgsPoint) QgsEllipse ¶
Constructs an ellipse by foci (
pt1
andpt2
) and a pointpt3
. The center point can have m value which is the result from the midpoint operation betweenpt1
andpt2
. Z dimension is also supported and is retrieved from the first 3D point amongstpt1
andpt2
. Axes are calculated from the 2D distance with the third pointpt3
. The azimuth is the angle betweenpt1
andpt2
.- Parameters
- Return type
- isEmpty(self) bool ¶
An ellipse is empty if axes are equal to 0
- Return type
bool
- orientedBoundingBox(self) QgsPolygon ¶
Returns the oriented minimal bounding box for the ellipse.
- Return type
- perimeter(self) float ¶
The circumference of the ellipse using first approximation of Ramanujan.
- Return type
float
- points(self, segments: int = 36) List[QgsPoint] ¶
Returns a list of points with segmentation from
segments
.- Parameters
segments (int = 36) – Number of segments used to segment geometry.
- Return type
List[QgsPoint]
- quadrant(self) List[QgsPoint] ¶
The four quadrants of the ellipse. They are oriented and started always from semi-major axis.
- Return type
List[QgsPoint]
- Returns
quadrants defined by four points.
- semiMajorAxis(self) float ¶
Returns the semi-major axis.
See also
- Return type
float
- semiMinorAxis(self) float ¶
Returns the semi-minor axis.
See also
- Return type
float
- setAzimuth(self, azimuth: float)¶
Sets the azimuth (orientation).
See also
- Parameters
azimuth (float) –
- setCenter(self, center: QgsPoint)¶
Sets the center point.
See also
See also
rcenter()
- Parameters
center (QgsPoint) –
- setSemiMajorAxis(self, semiMajorAxis: float)¶
Sets the semi-major axis.
See also
- Parameters
semiMajorAxis (float) –
- setSemiMinorAxis(self, semiMinorAxis: float)¶
Sets the semi-minor axis.
See also
- Parameters
semiMinorAxis (float) –
- toLineString(self, segments: int = 36) QgsLineString ¶
Returns a segmented linestring.
- Parameters
segments (int = 36) – Number of segments used to segment geometry.
- Return type
- toPolygon(self, segments: int = 36) QgsPolygon ¶
Returns a segmented polygon.
- Parameters
segments (int = 36) – Number of segments used to segment geometry.
- Return type
- 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.
- Parameters
pointPrecision (int = 17) –
axisPrecision (int = 17) –
azimuthPrecision (int = 2) –
- Return type
str