KanoopCommonQt 2.1.1
Kanoop foundational Qt utility library
Loading...
Searching...
No Matches
Circle Class Reference

Represents a 2D circle with centre and radius, supporting geometric queries. More...

#include <circle.h>

Public Member Functions

 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.
 

Static Public Member Functions

static Circle fromThreePoints (const Point &a, const Point &b, const Point &c)
 Construct the unique circle passing through three non-collinear points.
 

Detailed Description

Represents a 2D circle with centre and radius, supporting geometric queries.

Definition at line 16 of file circle.h.

Constructor & Destructor Documentation

◆ Circle() [1/2]

Circle::Circle ( )
inline

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
centerCentre of the circle
radiusRadius of the circle

Definition at line 27 of file circle.h.

Member Function Documentation

◆ 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()

static Circle Circle::fromThreePoints ( const Point a,
const Point b,
const Point c 
)
static

Construct the unique circle passing through three non-collinear points.

Parameters
aFirst point on the circle
bSecond point on the circle
cThird 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
lineLine segment to test
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
lineLine segment to intersect
intersection1Output for the first intersection point
intersection2Output 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
valueNew centre point

Definition at line 49 of file circle.h.

◆ setRadius()

void Circle::setRadius ( double  value)
inline

Set the radius of the circle.

Parameters
valueNew radius value

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: