Definition
An instance C of the data type circle is an oriented circle in the plane passing through three points p1, p2, p3. The orientation of C is equal to the orientation of the three defining points, i.e. orientation(p1, p2, p3). If | {p1, p2, p3} |= 1 C is the empty circle with center p1. If p1, p2, p3 are collinear C is a straight line passing through p1, p2 and p3 in this order and the center of C is undefined.
#include < LEDA/circle.h >
Types
circle::coord_type | the coordinate type (double). |
circle::point_type | the point type (point). |
Creation
circle | C(point a, point b, point c) | |
introduces a variable C of type circle. C is initialized to the oriented circle through points a, b, and c. | ||
circle | C(point a, point b) | introduces a variable C of type circle. C is initialized to the counter-clockwise oriented circle with center a passing through b. |
circle | C(point a) | introduces a variable C of type circle. C is initialized to the trivial circle with center a. |
circle | C | introduces a variable C of type circle. C is initialized to the trivial circle with center (0, 0). |
circle | C(point c, double r) | introduces a variable C of type circle. C is initialized to the circle with center c and radius r with positive (i.e. counter-clockwise) orientation. |
circle | C(double x, double y, double r) | |
introduces a variable C of type circle. C is initialized to the circle with center (x, y) and radius r with positive (i.e. counter-clockwise) orientation. | ||
circle | C(circle c, int prec) | introduces a variable C of type circle. C is initialized to a copy of c. The second argument is for compatability with rat_circle. |
Operations
point | C.center() | returns the center of C.
Precondition The orientation of C is not 0. |
double | C.radius() | returns the radius of C.
Precondition The orientation of C is not 0. |
double | C.sqr_radius() | returns the squared radius of C.
Precondition The orientation of C is not 0. |
point | C.point1() | returns p1. |
point | C.point2() | returns p2. |
point | C.point3() | returns p3. |
point | C.point_on_circle(double alpha, double=0) | |
returns a point p on C with angle of alpha. The second argument is for compatability with rat_circle. | ||
bool | C.is_degenerate() | returns true if the defining points are collinear. |
bool | C.is_trivial() | returns true if C has radius zero. |
int | C.orientation() | returns the orientation of C. |
int | C.side_of(point p) | returns -1, +1, or 0 if p lies right of, left of, or on C respectively. |
bool | C.inside(point p) | returns true if p lies inside of C, false otherwise. |
bool | C.outside(point p) | returns !C.inside(p). |
bool | C.contains(point p) | returns true if p lies on C, false otherwise. |
circle | C.translate_by_angle(double a, double d) | |
returns C translated in direction a by distance d. | ||
circle | C.translate(double dx, double dy) | |
returns C translated by vector (dx, dy). | ||
circle | C.translate(vector v) | returns C translated by vector v. |
circle | C + vector v | returns C translated by vector v. |
circle | C - vector v | returns C translated by vector - v. |
circle | C.rotate(point q, double a) | |
returns C rotated about point q by angle a. | ||
circle | C.rotate(double a) | returns C rotated about the origin by angle a. |
circle | C.rotate90(point q) | returns C rotated about q by an angle of 90 degrees. |
circle | C.reflect(point p, point q) | |
returns C reflected across the straight line passing through p and q. | ||
circle | C.reflect(point p) | returns C reflected across point p. |
circle | C.reverse() | returns C reversed. |
list<point> | C.intersection(circle D) | returns C D as a list of points. |
list<point> | C.intersection(line l) | returns C l as a list of (zero, one, or two) points sorted along l. |
list<point> | C.intersection(segment s) | returns C s as a list of (zero, one, or two) points sorted along s. |
segment | C.left_tangent(point p) | returns the line segment starting in p tangent to C and left of segment [p, C.center()]. |
segment | C.right_tangent(point p) | returns the line segment starting in p tangent to C and right of segment [p, C.center()]. |
double | C.distance(point p) | returns the distance between C and p. |
double | C.sqr_dist(point p) | returns the squared distance between C and p. |
double | C.distance(line l) | returns the distance between C and l. |
double | C.distance(circle D) | returns the distance between C and D. |