first check-in of feisty meow codebase. many things broken still due to recent
[feisty_meow.git] / graphiq / library / geometric / cartesian_objects.h
1 #ifndef CARTESIAN_OBJECTS_GROUP
2 #define CARTESIAN_OBJECTS_GROUP
3
4 /*****************************************************************************\
5 *                                                                             *
6 *  Name   : cartesian objects                                                 *
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 "angle.h"
19 #include "line.h"
20 #include "point.h"
21 #include "rectangle.h"
22
23 namespace geometric {
24
25 //! Provides a geometric point that use double floating points numbers.
26
27 class cartesian_point : public point<double>
28 {
29 public:
30   cartesian_point(double x = 0, double y = 0) : point<double>(x, y) {}
31   cartesian_point(double r, double_angle theta) : point<double>(r, theta) {}
32   cartesian_point(const point<double> &to_copy) : point<double>(to_copy) {}
33   DEFINE_CLASS_NAME("cartesian_point");
34
35   static cartesian_point origin() { return cartesian_point(0.0, 0.0); }
36     //!< the origin of the two-dimensional system.
37 };
38
39 //////////////
40
41 //! Provides a geometric line that use double floating points numbers.
42
43 class cartesian_line : public line<double>
44 {
45 public:
46   cartesian_line(const cartesian_point &endpoint_1,
47           const cartesian_point &endpoint_2)
48           : line<double>(endpoint_1, endpoint_2) {}
49   cartesian_line(double x_1 = 0, double y_1 = 0,
50           double x_2 = 0, double y_2 = 0)
51           : line<double>(x_1, y_1, x_2, y_2) {}
52 };
53
54 //////////////
55
56 //! Provides a geometric rectangle that use double floating points numbers.
57
58 class cartesian_rectangle : public rectangle<double>
59 {
60 public:
61   cartesian_rectangle(const cartesian_point &vertex_1,
62           const cartesian_point &vertex_2)
63           : rectangle<double>(vertex_1, vertex_2) {}
64   cartesian_rectangle(double x_1 = 0, double y_1 = 0,
65           double x_2 = 0, double y_2 = 0)
66           : rectangle<double>(x_1, y_1, x_2, y_2) {}
67   cartesian_rectangle(const rectangle<double> &rect)
68           : rectangle<double>(rect) {}
69 };
70
71 } // namespace.
72
73 #endif
74