Subgroup: other
Class: QgsCircle¶
-
class
qgis.core.
QgsCircle
¶ Bases:
qgis._core.QgsEllipse
Circle geometry type.
A circle is defined by a center point with a radius and an azimuth. The azimuth is the north angle to the semi-major axis, in degrees. By default, the semi-major axis is oriented to the north (0 degrees).
New in version 3.0: Methods
area
azimuth
Returns the azimuth. boundingBox
center
Returns the center point. contains
Returns true if the circle contains the point
.eccentricity
The eccentricity of the ellipse. foci
Two foci of the ellipse. focusDistance
The distance between the center and each foci. from2Points
Constructs a circle by 2 points on the circle. from3Points
Constructs a circle by 3 points on the circle. from3Tangents
Constructs a circle by 3 tangents on the circle (aka inscribed circle of a triangle). fromCenter2Points
Constructs an ellipse by a central point and two other points. fromCenterDiameter
Constructs a circle by a center point and a diameter. fromCenterPoint
Constructs a circle by a center point and another point. fromExtent
Constructs a circle 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 minimalCircleFrom3Points
Constructs the smallest circle from 3 points. northQuadrant
The four quadrants of the ellipse. orientedBoundingBox
Returns the oriented minimal bounding box for the ellipse. perimeter
points
Returns a list of points with segmentation from segments
.quadrant
The four quadrants of the ellipse. radius
Returns the radius of the circle semiMajorAxis
Returns the semi-major axis. semiMinorAxis
Returns the semi-minor axis. setAzimuth
Sets the azimuth (orientation). setCenter
Sets the center point. setRadius
Set the radius of the circle setSemiMajorAxis
Inherited method. setSemiMinorAxis
Inherited method. toCircularString
Returns a circular string from the circle. toLineString
Returns a segmented linestring. toPolygon
Returns a segmented polygon. toString
Attributes
-
area
(self) → float¶
-
boundingBox
(self) → QgsRectangle¶
-
contains
(self, point: QgsPoint, epsilon: float = 1e-08) → bool¶ Returns true if the circle contains the
point
.
-
from2Points
(pt1: QgsPoint, pt2: QgsPoint) → QgsCircle¶ Constructs a circle by 2 points on the circle. The center point can have z and m values which are the result from the midpoint operation between
pt1
andpt2
. The radius is calculated from the 2D distance betweenpt1
andpt2
. The azimuth is the angle betweenpt1
andpt2
.Parameters: - pt1 – First point.
- pt2 – Second point.
-
from3Points
(pt1: QgsPoint, pt2: QgsPoint, pt3: QgsPoint, epsilon: float = 1e-08) → QgsCircle¶ Constructs a circle by 3 points on the circle. Z and m values are dropped for the center point. The azimuth always takes the default value. If the points are colinear an empty circle is returned.
Parameters: - pt1 – First point.
- pt2 – Second point.
- pt3 – Third point.
- epsilon – Value used to compare point.
-
from3Tangents
(pt1_tg1: QgsPoint, pt2_tg1: QgsPoint, pt1_tg2: QgsPoint, pt2_tg2: QgsPoint, pt1_tg3: QgsPoint, pt2_tg3: QgsPoint, epsilon: float = 1e-08) → QgsCircle¶ Constructs a circle by 3 tangents on the circle (aka inscribed circle of a triangle). Z and m values are dropped for the center point. The azimuth always takes the default value.
Parameters: - pt1_tg1 – First point of the first tangent.
- pt2_tg1 – Second point of the first tangent.
- pt1_tg2 – First point of the second tangent.
- pt2_tg2 – Second point of the second tangent.
- pt1_tg3 – First point of the third tangent.
- pt2_tg3 – Second point of the third tangent.
- epsilon – Value used to compare point.
-
fromCenterDiameter
(center: QgsPoint, diameter: float, azimuth: float = 0) → QgsCircle¶ Constructs a circle by a center point and a diameter. The center point keeps z and m values from
center
.Parameters: - center – Center point.
- diameter – Diameter of the circle.
- azimuth – Azimuth of the circle.
-
fromCenterPoint
(center: QgsPoint, pt1: QgsPoint) → QgsCircle¶ Constructs a circle by a center point and another point. The center point keeps z and m values from
center
. Axes are calculated from the 2D distance betweencenter
andpt1
. The azimuth is the angle betweencenter
andpt1
.Parameters: - center – Center point.
- pt1 – A point on the circle.
-
fromExtent
(pt1: QgsPoint, pt2: QgsPoint) → QgsCircle¶ Constructs a circle 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.
-
minimalCircleFrom3Points
(pt1: QgsPoint, pt2: QgsPoint, pt3: QgsPoint, epsilon: float = 1e-08) → QgsCircle¶ Constructs the smallest circle from 3 points. Z and m values are dropped for the center point. The azimuth always takes the default value. If the points are colinear an empty circle is returned.
Parameters: - pt1 – First point.
- pt2 – Second point.
- pt3 – Third point.
- epsilon – Value used to compare point.
-
northQuadrant
(self) → List[QgsPoint]¶ The four quadrants of the ellipse. They are oriented and started from North.
Returns: quadrants defined by four points. See also
quadrant()
-
perimeter
(self) → float¶
-
radius
(self) → float¶ Returns the radius of the circle
-
setRadius
(self, radius: float)¶ Set the radius of the circle
-
setSemiMajorAxis
(self, semiMajorAxis: float)¶ Inherited method. Use setRadius instead.
See also
See also
-
setSemiMinorAxis
(self, semiMinorAxis: float)¶ Inherited method. Use setRadius instead.
See also
See also
-
toCircularString
(self, oriented: bool = False) → QgsCircularString¶ Returns a circular string from the circle.
Parameters: oriented – If oriented is true the start point is from azimuth instead from north.
-
toString
(self, pointPrecision: int = 17, radiusPrecision: int = 17, azimuthPrecision: int = 2) → str¶
-