Struct representing a circle in a 2 dimensional coordinate space. More...
#include <UTGeometry.h>
Public Member Functions | |
Circle_t () | |
Circle_t (const Point_t ¢er, double radius) | |
Circle_t (const Circle_t ©) | |
void | Set (const Point_t ¢er, double radius) |
const Circle_t & | operator= (const Circle_t ©) |
Circle_t | operator+ (const Point_t &add) const |
Circle_t | operator- (const Point_t &subtract) const |
const Circle_t & | operator+= (const Point_t &add) |
const Circle_t & | operator-= (const Point_t &subtract) |
bool | Contains (const Point_t &point) const |
bool | Overlapping (const Rect_t &rect) const |
Rect_t | BoundingBox () const |
void | GetBoundingBox (out Rect_t *bounding_box) const |
int | FindXIntercepts (float y, out float *x, out double *radian=NULL, out double *slope=NULL) const |
int | FindYIntercepts (float x, out float *y, out double *radian=NULL, out double *slope=NULL) const |
void | FindClosestPoint (const Point_t &from, bool on_edge_if_inside, out Point_t *closest_point_on_circle, out double *radian=NULL, out double *slope=NULL) const |
Public Attributes | |
Point_t | center |
double | radius |
Struct representing a circle in a 2 dimensional coordinate space. Although it can be used in other ways, the value space which is typically used is that for a monitor, with increasing x values to the right and increasing y values to the bottom. Floating point numbers are used by the UTgfx and UTgui libraries to represent screen display because for scaling, use of floating point computation until final conversion to an integer coordinate is more efficient than use of integers when scaling. That way the same interface can be used to render to the display, printer, and so on. Floats are accurate to within c_dbl_abs_min_denominator out to about 4,000,000.
Some related C API functionality for normalizing radians to the 0 to 2*PI range is documented in the UTGeometry.h page.
Definition at line 620 of file UTGeometry.h.
Circle_t::Circle_t | ( | ) | [inline] |
Constructor for an uninitialized circle, just to make the compiler happy.
Definition at line 1686 of file UTGeometry.h.
Circle_t::Circle_t | ( | const Point_t & | center, | |
double | radius | |||
) | [inline] |
Initializer for a new circle with the specified properties.
Definition at line 1693 of file UTGeometry.h.
Circle_t::Circle_t | ( | const Circle_t & | copy | ) | [inline] |
Copy constructor.
Definition at line 1701 of file UTGeometry.h.
void Circle_t::Set | ( | const Point_t & | center, | |
double | radius | |||
) | [inline] |
Sets the properties of the circle.
Definition at line 1709 of file UTGeometry.h.
Assignment operator.
Definition at line 1717 of file UTGeometry.h.
Adds the x and y values of the specified point to the center of the circle and returns the result in a new circle.
Definition at line 1726 of file UTGeometry.h.
Subtracts the x and y value of the specified point from the center of the circle and returns the result in a new circle.
Definition at line 1733 of file UTGeometry.h.
Adds the x and y values of the specified point to the center of the circle.
Definition at line 1740 of file UTGeometry.h.
Subtracts the x and y value of the specified point from the center of the circle.
Definition at line 1748 of file UTGeometry.h.
bool Circle_t::Contains | ( | const Point_t & | point | ) | const |
Returns true if this circle contains the specified point.
bool Circle_t::Overlapping | ( | const Rect_t & | rect | ) | const |
Returns true if this circle (not its bounding box) at least partially overlaps the rectangle.
Rect_t Circle_t::BoundingBox | ( | ) | const [inline] |
Returns the bounding box which would enclose the entire circle.
Definition at line 1756 of file UTGeometry.h.
void Circle_t::GetBoundingBox | ( | out Rect_t * | bounding_box | ) | const [inline] |
Returns the bounding box which would enclose the entire circle.
Definition at line 1766 of file UTGeometry.h.
int Circle_t::FindXIntercepts | ( | float | y, | |
out float * | x, | |||
out double * | radian = NULL , |
|||
out double * | slope = NULL | |||
) | const |
Finds the X intercepts of the circle at the specified Y value. Returns the number of intercepts. The maximum number of inercepts is 2, so x, radian, and slope must each, if they are not NULL, point to an array of two floats or doubles. Also returns the radian value and the slope at the points. If the slope is vertical, returns HUGE_VAL. Any of the output pointers can be NULL if the value is not needed. Radian value zero is the top of the circle, with increasing radian values going clockwise. The locations of t are as follows:
t=0: top edge t=pi/2: right edge t=pi: bottom edge t=3*pi/2: left edge
int Circle_t::FindYIntercepts | ( | float | x, | |
out float * | y, | |||
out double * | radian = NULL , |
|||
out double * | slope = NULL | |||
) | const |
Finds the Y intercepts of the circle at the specified X value. Returns the number of intercepts. The maximum number of inercepts is 2, so x, radian, and slope must each, if they are not NULL, point to an array of two floats or doubles. Also returns the radian value and the slope at the points. If the slope is vertical, returns HUGE_VAL. Any of the output pointers can be NULL if the value is not needed. Radian value zero is the top of the circle, with increasing radian values going clockwise. The locations of t are as follows:
t=0: top edge t=pi/2: right edge t=pi: bottom edge t=3*pi/2: left edge
void Circle_t::FindClosestPoint | ( | const Point_t & | from, | |
bool | on_edge_if_inside, | |||
out Point_t * | closest_point_on_circle, | |||
out double * | radian = NULL , |
|||
out double * | slope = NULL | |||
) | const |
Finds the closest point on the circle, returning the closest point through the closest_point_on_circle parameter, the corresponding radian value through radian, and the slope at that point through slope. Any of the output pointers can be NULL if the value is not needed. The on_edge_if_inside parameter can be false, in which case if from is inside the circle, it is returned as the closest point. If that is the case, radian and slope, if needed, are set as if the point had been on the edge of the circle along the line from the center to from. Radian value zero is the top of the circle, with increasing radian values going clockwise. The locations of t are as follows:
t=0: top edge t=pi/2: right edge t=pi: bottom edge t=3*pi/2: left edge
The center of the circle.
Definition at line 642 of file UTGeometry.h.
double Circle_t::radius |
The radius of the circle.
Definition at line 645 of file UTGeometry.h.