Circle

Defines geometric entity known as a circle.

A plane curve everywhere equidistant from a given fixed point, the center.  http://dictionary.com

Operators

  • Circle == Circle
  • ostream& <<
Summary
Defines geometric entity known as a circle.
Default constructor for circle, sets position to (0,0) and radius to 0.
Constructs circle with a given radius and center point.
Destructor, does nothing, exists to make Circle inheritance safe.
Move the center of the Circle to a new location.
Move the center of the Circle a given x and y distance.
Change the size of the Circle.
Change the size of the Circle in relation to the current size.
Check if circle intersects another.
Check if circle intersects rectangle.
Check if circle contains a given point.
Get center <Point2>.
Get radius of Circle.

(Con/ De)structors

Circle

Circle()

Default constructor for circle, sets position to (0,0) and radius to 0.

Circle

Circle(const Point2 &center,
scalar radius)

Constructs circle with a given radius and center point.

Parameters

centerCenter point for circle.
radiusRadius of circle.

~Circle

virtual ~Circle()

Destructor, does nothing, exists to make Circle inheritance safe.

Movement/ Scaling

moveTo

void moveTo(const Point2 &center)

Move the center of the Circle to a new location.

Parameters

centerNew center for circle.

moveRel

void moveRel(scalar xMove,
scalar yMove)

Move the center of the Circle a given x and y distance.

Parameters

xMoveThe amount to move in the x direction.
yMoveThe amount to move in the y direction.

resize

void resize(scalar radius)

Change the size of the Circle.

Parameters

radiusThe new radius for the Circle.

resizeRel

void resizeRel(scalar radiusChange)

Change the size of the Circle in relation to the current size.

Parameters

radiusChangeThe change to apply to the radius.

Geometry

intersects

bool intersects(const Circle &circle) const

Check if circle intersects another.

Parameters

circleCircle to check for intersection with.

Returns

True if the circles intersect, false otherwise.

intersects

bool intersects(const Rect &rect) const

Check if circle intersects rectangle.

Parameters

rectRectangle to check for intersection with.

Returns

True if circle/rect intersect, false otherwise.

contains

bool contains(const Point2 &point) const

Check if circle contains a given point.

Parameters

pointPoint to check for containment of.

Returns

True if circle contains point, false otherwise.

Accessors

getCenter

Point2 getCenter() const

Get center <Point2>.

Returns

Center point.

getRadius

scalar getRadius() const

Get radius of Circle.

Returns

Radius of circle.

Circle()
Default constructor for circle, sets position to (0,0) and radius to 0.
virtual ~Circle()
Destructor, does nothing, exists to make Circle inheritance safe.
void moveTo(const Point2 &center)
Move the center of the Circle to a new location.
void moveRel(scalar xMove,
scalar yMove)
Move the center of the Circle a given x and y distance.
void resize(scalar radius)
Change the size of the Circle.
void resizeRel(scalar radiusChange)
Change the size of the Circle in relation to the current size.
bool intersects(const Circle &circle) const
Check if circle intersects another.
bool contains(const Point2 &point) const
Check if circle contains a given point.
Point2 getCenter() const
Get center Point2.
scalar getRadius() const
Get radius of Circle.