Represents a 2D circle with centre and radius, supporting geometric queries.
More...
#include <circle.h>
|
| | Circle () |
| | Default constructor — creates a zero-radius circle at the origin.
|
| |
| | Circle (const QPointF center, double radius) |
| | Construct a circle from a centre point and radius.
|
| |
| QPointF | center () const |
| | Return the centre of the circle.
|
| |
| void | setCenter (const QPointF &value) |
| | Set the centre of the circle.
|
| |
| double | radius () const |
| | Return the radius of the circle.
|
| |
| void | setRadius (double value) |
| | Set the radius of the circle.
|
| |
| double | circumference () const |
| | Return the circumference of the circle.
|
| |
| double | diameter () const |
| | Return the diameter of the circle.
|
| |
| double | area () const |
| | Return the area of the circle.
|
| |
| bool | intersects (const Line &line) const |
| | Test whether a line intersects this circle.
|
| |
| int | intersects (const Line &line, QPointF &intersection1, QPointF &intersection2) const |
| | Find the intersection points of a line with this circle.
|
| |
| QString | toString () const |
| | Format the circle as a human-readable string.
|
| |
Represents a 2D circle with centre and radius, supporting geometric queries.
Definition at line 16 of file circle.h.
◆ Circle() [1/2]
Default constructor — creates a zero-radius circle at the origin.
Definition at line 20 of file circle.h.
◆ Circle() [2/2]
| Circle::Circle |
( |
const QPointF |
center, |
|
|
double |
radius |
|
) |
| |
|
inline |
Construct a circle from a centre point and radius.
- Parameters
-
| center | Centre of the circle |
| radius | Radius of the circle |
Definition at line 27 of file circle.h.
◆ area()
| double Circle::area |
( |
| ) |
const |
Return the area of the circle.
- Returns
- Area (pi * radius^2)
◆ center()
| QPointF Circle::center |
( |
| ) |
const |
|
inline |
Return the centre of the circle.
- Returns
- Centre QPointF
Definition at line 43 of file circle.h.
◆ circumference()
| double Circle::circumference |
( |
| ) |
const |
Return the circumference of the circle.
- Returns
- Circumference (2 * pi * radius)
◆ diameter()
| double Circle::diameter |
( |
| ) |
const |
Return the diameter of the circle.
- Returns
- Diameter (2 * radius)
◆ fromThreePoints()
Construct the unique circle passing through three non-collinear points.
- Parameters
-
| a | First point on the circle |
| b | Second point on the circle |
| c | Third point on the circle |
- Returns
- Circumscribed circle, or an invalid circle if points are collinear
◆ intersects() [1/2]
| bool Circle::intersects |
( |
const Line & |
line | ) |
const |
Test whether a line intersects this circle.
- Parameters
-
- Returns
- true if the line intersects or is tangent to the circle
◆ intersects() [2/2]
| int Circle::intersects |
( |
const Line & |
line, |
|
|
QPointF & |
intersection1, |
|
|
QPointF & |
intersection2 |
|
) |
| const |
Find the intersection points of a line with this circle.
- Parameters
-
| line | Line segment to intersect |
| intersection1 | Output for the first intersection point |
| intersection2 | Output for the second intersection point |
- Returns
- Number of intersection points (0, 1, or 2)
◆ radius()
| double Circle::radius |
( |
| ) |
const |
|
inline |
Return the radius of the circle.
- Returns
- Radius value
Definition at line 55 of file circle.h.
◆ setCenter()
| void Circle::setCenter |
( |
const QPointF & |
value | ) |
|
|
inline |
Set the centre of the circle.
- Parameters
-
Definition at line 49 of file circle.h.
◆ setRadius()
| void Circle::setRadius |
( |
double |
value | ) |
|
|
inline |
Set the radius of the circle.
- Parameters
-
Definition at line 61 of file circle.h.
◆ toString()
| QString Circle::toString |
( |
| ) |
const |
Format the circle as a human-readable string.
- Returns
- String representation of centre and radius
The documentation for this class was generated from the following file: