next up previous contents index
Next: Polygons ( POLYGON ) Up: Basic Data Types for Previous: Straight Lines ( line   Contents   Index


Circles ( circle )

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/geo/circle.h >

Types

circle::coord_type the coordinate type (double).

circle::point_type the point type (point).

Creation

circle C(const point& a, const point& b, const point& c)
    introduces a variable C of type circle. C is initialized to the oriented circle through points a, b, and c.

circle C(const point& a, const 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(const 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(const 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(const circle& c, int) 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.

bool C.is_line() returns true if C is a line.

line C.to_line() returns line(point1(), point3()).

int C.orientation() returns the orientation of C.

int C.side_of(const point& p) returns -1, +1, or 0 if p lies right of, left of, or on C respectively.

bool C.inside(const point& p) returns true iff p lies inside of C.

bool C.outside(const point& p) returns true iff p lies outside of C.

bool C.contains(const point& p)
    returns true iff p lies on C.

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(const vector& v)
    returns C translated by vector v.

circle C + const vector& v returns C translated by vector v.

circle C - const vector& v returns C translated by vector - v.

circle C.rotate(const 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(const point& q, int i=1)
    returns C rotated about q by an angle of i x 90 degrees. If i > 0 the rotation is counter-clockwise otherwise it is clockwise.

circle C.reflect(const point& p, const point& q)
    returns C reflected across the straight line passing through p and q.

circle C.reflect(const point& p) returns C reflected across point p.

circle C.reverse() returns C reversed.

list<point> C.intersection(const circle& D)
    returns C $\cap$ D as a list of points.

list<point> C.intersection(const line& l)
    returns C $\cap$ l as a list of (zero, one, or two) points sorted along l.

list<point> C.intersection(const segment& s)
    returns C $\cap$ s as a list of (zero, one, or two) points sorted along s.

segment C.left_tangent(const point& p)
    returns the line segment starting in p tangent to C and left of segment [p, C.center()].

segment C.right_tangent(const point& p)
    returns the line segment starting in p tangent to C and right of segment [p, C.center()].

double C.distance(const point& p)
    returns the distance between C and p.

double C.sqr_dist(const point& p)
    returns the squared distance between C and p.

double C.distance(const line& l) returns the distance between C and l.

double C.distance(const circle& D)
    returns the distance between C and D.

bool radical_axis(const circle& C1, const circle& C2, line& rad_axis)
    if the radical axis for C1 and C2 exists, it is assigned to rad_axis and true is returned; otherwise the result is false.


next up previous contents index
Next: Polygons ( POLYGON ) Up: Basic Data Types for Previous: Straight Lines ( line   Contents   Index