# Class: QgsCircle¶

class `qgis.core.``QgsCircle`

Bases: `QgsEllipse`

QgsCircle(center: `QgsPoint`, radius: float, azimuth: float = 0) Constructs a circle by defining all the members.

Parameters
• center – The center of the circle.

• azimuth – Angle in degrees started from the North to the first quadrant.

QgsCircle(`QgsCircle`)

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).

Methods

 `area` rtype float `boundingBox` rtype QgsRectangle `contains` Returns `True` if the circle contains the `point`. `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). `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`). `innerTangents` Calculates the inner tangent points between this circle and an `other` circle. `intersections` Calculates the intersections points between this circle and an `other` circle. `minimalCircleFrom3Points` Constructs the smallest circle from 3 points. `northQuadrant` The four quadrants of the ellipse. `outerTangents` Calculates the outer tangent points between this circle and an `other` circle. `perimeter` rtype float `radius` Returns the radius of the circle `setRadius` Sets the radius of the circle `setSemiMajorAxis` Inherited method. `setSemiMinorAxis` Inherited method. `tangentToPoint` Calculates the tangent points between this circle and the point `p`. `toCircularString` Returns a circular string from the circle. `toString` param pointPrecision
`area`(self) → float
Return type

float

`boundingBox`(self)QgsRectangle
Return type

QgsRectangle

`contains`(self, point: QgsPoint, epsilon: float = 1e-08) → bool

Returns `True` if the circle contains the `point`.

Parameters
• point (QgsPoint) –

• epsilon (float = 1e-08) –

Return type

bool

`from2Points`(pt1: QgsPoint, pt2: QgsPoint)QgsCircle

Constructs a circle by 2 points on the circle. The center point can have m value which is the result from the midpoint operation between `pt1` and `pt2`. Z dimension is also supported and is retrieved from the first 3D point amongst `pt1` and `pt2`. The radius is calculated from the 2D distance between `pt1` and `pt2`. The azimuth is the angle between `pt1` and `pt2`.

Parameters
Return type

QgsCircle

`from3Points`(pt1: QgsPoint, pt2: QgsPoint, pt3: QgsPoint, epsilon: float = 1e-08)QgsCircle

Constructs a circle by 3 points on the circle. M value is dropped for the center point. Z dimension is supported and is retrieved from the first 3D point amongst `pt1`, `pt2` and `pt3`. The azimuth always takes the default value. If the points are colinear an empty circle is returned.

Parameters
• pt1 (QgsPoint) – First point.

• pt2 (QgsPoint) – Second point.

• pt3 (QgsPoint) – Third point.

• epsilon (float = 1e-08) – Value used to compare point.

Return type

QgsCircle

`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 (QgsPoint) – First point of the first tangent.

• pt2_tg1 (QgsPoint) – Second point of the first tangent.

• pt1_tg2 (QgsPoint) – First point of the second tangent.

• pt2_tg2 (QgsPoint) – Second point of the second tangent.

• pt1_tg3 (QgsPoint) – First point of the third tangent.

• pt2_tg3 (QgsPoint) – Second point of the third tangent.

• epsilon (float = 1e-08) – Value used to compare point.

Return type

QgsCircle

`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 (QgsPoint) – Center point.

• diameter (float) – Diameter of the circle.

• azimuth (float = 0) – Azimuth of the circle.

Return type

QgsCircle

`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 between `center` and `pt1`. The azimuth is the angle between `center` and `pt1`.

Parameters
Return type

QgsCircle

`fromExtent`(pt1: QgsPoint, pt2: QgsPoint)QgsCircle

Constructs a circle by an extent (aka bounding box / `QgsRectangle`). The center point can have m value which is the result from the midpoint operation between `pt1` and `pt2`. Z dimension is also supported and is retrieved from the first 3D point amongst `pt1` and `pt2`. Axes are calculated from the 2D distance between `pt1` and `pt2`. The azimuth always takes the default value.

Parameters
Return type

QgsCircle

`innerTangents`(self, other: QgsCircle) → Tuple[int, QgsPointXY, QgsPointXY, QgsPointXY, QgsPointXY]

Calculates the inner tangent points between this circle and an `other` circle.

The inner tangent points correspond to the points at which the two lines which are drawn so that they are tangential to both circles but on different sides, touching the circles and crossing each other.

The first tangent line is described by the points stored in `line1P1` and `line1P2`, and the second line is described by the points stored in `line2P1` and `line2P2`.

Returns the number of tangents (either 0 or 2).

Note that this method is 2D only and does not consider the z-value of the circle.

New in version 3.6.

Parameters

other (QgsCircle) –

Return type

Tuple[int, `QgsPointXY`, `QgsPointXY`, `QgsPointXY`, QgsPointXY]

`intersections`(self, other: QgsCircle, useZ: bool = False) → Tuple[int, QgsPoint, QgsPoint]

Calculates the intersections points between this circle and an `other` circle.

If found, the intersection points will be stored in `intersection1` and `intersection2`.

By default this method does not consider any z values and instead treats the circles as 2-dimensional. If `useZ` is set to `True`, then an intersection will only occur if the z values of both circles are equal. In this case the points returned for `intersection1` and `intersection2` will contain the z value of the circle intersections.

Return type

Tuple[int, `QgsPoint`, QgsPoint]

Returns

number of intersection points found.

New in version 3.2.

Parameters
• other (QgsCircle) –

• useZ (bool = False) –

`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 (QgsPoint) – First point.

• pt2 (QgsPoint) – Second point.

• pt3 (QgsPoint) – Third point.

• epsilon (float = 1e-08) – Value used to compare point.

Return type

QgsCircle

`northQuadrant`(self) → List[QgsPoint]

The four quadrants of the ellipse. They are oriented and started from North.

Return type

List[QgsPoint]

Returns

`quadrant()`

`outerTangents`(self, other: QgsCircle) → Tuple[int, QgsPointXY, QgsPointXY, QgsPointXY, QgsPointXY]

Calculates the outer tangent points between this circle and an `other` circle.

The outer tangent points correspond to the points at which the two lines which are drawn so that they are tangential to both circles touch the circles.

The first tangent line is described by the points stored in `line1P1` and `line1P2`, and the second line is described by the points stored in `line2P1` and `line2P2`.

Returns the number of tangents (either 0 or 2).

Note that this method is 2D only and does not consider the z-value of the circle.

New in version 3.2.

Parameters

other (QgsCircle) –

Return type

Tuple[int, `QgsPointXY`, `QgsPointXY`, `QgsPointXY`, QgsPointXY]

`perimeter`(self) → float
Return type

float

`radius`(self) → float

Returns the radius of the circle

Return type

float

`setRadius`(self, radius: float)

Sets the radius of the circle

Parameters

`setSemiMajorAxis`(self, semiMajorAxis: float)

Parameters

semiMajorAxis (float) –

`setSemiMinorAxis`(self, semiMinorAxis: float)

Parameters

semiMinorAxis (float) –

`tangentToPoint`(self, p: QgsPointXY) → Tuple[bool, QgsPointXY, QgsPointXY]

Calculates the tangent points between this circle and the point `p`.

If found, the tangent points will be stored in `pt1` and `pt2`.

Note that this method is 2D only and does not consider the z-value of the circle.

Return type

Tuple[bool, `QgsPointXY`, QgsPointXY]

Returns

`True` if tangent was found.

New in version 3.2.

Parameters

p (QgsPointXY) –

`toCircularString`(self, oriented: bool = False)QgsCircularString

Returns a circular string from the circle.

Parameters

oriented (bool = False) – If oriented is `True` the start point is from azimuth instead from north.

Return type

QgsCircularString

`toString`(self, pointPrecision: int = 17, radiusPrecision: int = 17, azimuthPrecision: int = 2) → str
Parameters
• pointPrecision (int = 17) –

• radiusPrecision (int = 17) –

• azimuthPrecision (int = 2) –

Return type

str
{"ft_lang_label":"__label__en","ft_lang_prob":0.7389869,"math_prob":0.98339623,"size":8553,"snap":"2020-45-2020-50","text_gpt3_token_len":2351,"char_repetition_ratio":0.18060592,"word_repetition_ratio":0.4463768,"special_character_ratio":0.23383608,"punctuation_ratio":0.13941018,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9928583,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-10-25T11:42:14Z\",\"WARC-Record-ID\":\"<urn:uuid:b00c2622-7fd7-493f-860b-24c15bbe10cd>\",\"Content-Length\":\"275143\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:50f25f94-5c00-47b1-b78e-3f8148ceb8c7>\",\"WARC-Concurrent-To\":\"<urn:uuid:33a167b8-4c58-4786-89ae-b0d0a352fe31>\",\"WARC-IP-Address\":\"172.67.143.23\",\"WARC-Target-URI\":\"https://qgis.org/pyqgis/master/core/QgsCircle.html\",\"WARC-Payload-Digest\":\"sha1:24N5PLX4PAU3DJA43ITV3M434VX2KDLQ\",\"WARC-Block-Digest\":\"sha1:G7ECO5LMBLAGEDAA7VELQKEO6L6GRZEF\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-45/CC-MAIN-2020-45_segments_1603107888931.67_warc_CC-MAIN-20201025100059-20201025130059-00588.warc.gz\"}"}