Circle_t Struct Reference

Struct representing a circle in a 2 dimensional coordinate space. More...

#include <UTGeometry.h>

List of all members.

Public Member Functions

 Circle_t ()
 Circle_t (const Point_t &center, double radius)
 Circle_t (const Circle_t &copy)
void Set (const Point_t &center, double radius)
const Circle_toperator= (const Circle_t &copy)
Circle_t operator+ (const Point_t &add) const
Circle_t operator- (const Point_t &subtract) const
const Circle_toperator+= (const Point_t &add)
const Circle_toperator-= (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

Detailed Description

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.


Constructor & Destructor Documentation

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.


Member Function Documentation

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.

const Circle_t & Circle_t::operator= ( const Circle_t copy  )  [inline]

Assignment operator.

Definition at line 1717 of file UTGeometry.h.

Circle_t Circle_t::operator+ ( const Point_t add  )  const [inline]

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.

Circle_t Circle_t::operator- ( const Point_t subtract  )  const [inline]

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.

const Circle_t & Circle_t::operator+= ( const Point_t add  )  [inline]

Adds the x and y values of the specified point to the center of the circle.

Definition at line 1740 of file UTGeometry.h.

const Circle_t & Circle_t::operator-= ( const Point_t subtract  )  [inline]

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
								     

Member Data Documentation

The center of the circle.

Definition at line 642 of file UTGeometry.h.

The radius of the circle.

Definition at line 645 of file UTGeometry.h.


The documentation for this struct was generated from the following file:

Generated on Tue Dec 14 22:35:06 2010 for UT library by  doxygen 1.6.1