first check-in of feisty meow codebase. many things broken still due to recent
[feisty_meow.git] / graphiq / library / geometric / circle.h
1 #ifndef CIRCLE_CLASS
2 #define CIRCLE_CLASS
3
4 /*****************************************************************************\
5 *                                                                             *
6 *  Name   : circle                                                            *
7 *  Author : Chris Koeritz                                                     *
8 *                                                                             *
9 *******************************************************************************
10 * Copyright (c) 1992-$now By Author.  This program is free software; you can  *
11 * redistribute it and/or modify it under the terms of the GNU General Public  *
12 * License as published by the Free Software Foundation; either version 2 of   *
13 * the License or (at your option) any later version.  This is online at:      *
14 *     http://www.fsf.org/copyleft/gpl.html                                    *
15 * Please send any updates to: fred@gruntose.com                               *
16 \*****************************************************************************/
17
18 #include "cartesian_objects.h"
19
20 namespace geometric {
21
22 //! Represents a geometric circle.
23 /*!
24   A circle is specified by its center and its radius.  The angles are
25   measured in radians.
26 */
27
28 class circle
29 {
30 public:
31   circle();
32   circle(double radius, const cartesian_point &center);
33   ~circle();
34
35   double area() const;
36     //!< Returns the area occupied by the circle.
37
38   double circumference() const;
39     //!< Returns the perimeter for the circle.
40     /*!< The circumference is the length of a virtual string around the
41     circle. */
42
43   double diameter() const;
44     //!< Returns the length of the circle's bisecting line.
45     /*!< This is the length of a line segment that is circumscribed by the
46     circle and which passes through the center of the circle. */
47
48   bool inside(const cartesian_point &where) const;
49     //!< Returns true if the point is inside the circle.
50
51   cartesian_point location(const double_angle &where) const;
52     //!< Returns the point on the circle that is at the angle "where".
53
54   cartesian_rectangle dimensions() const;
55     //!< Returns a bounding box around the circle.
56
57   double radius() const;  //!< Half of the circle's diameter.
58   void radius(double to_set);  //!< Sets the radius of the circle.
59
60   cartesian_point center() const;  //!< The point at the center of the circle.
61   void center(const cartesian_point &to_set);  //!< Resets the circle's center.
62
63 private:
64   double _radius;  //!< Records the current radius.
65   cartesian_point _center;  //!< Records the current center.
66 };
67
68 } // namespace.
69
70 #endif
71