first check-in of feisty meow codebase. many things broken still due to recent
[feisty_meow.git] / graphiq / library / geometric / triangle.h
1 #ifndef TRIANGLE_CLASS
2 #define TRIANGLE_CLASS
3
4 /*****************************************************************************\
5 *                                                                             *
6 *  Name   : triangle                                                          *
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
19
20 // forward.
21 class cartesian_line;
22 class cartesian_point;
23
24 namespace geometric {
25
26 //! Represents a geometric triangle.
27
28 class triangle
29 {
30 public:
31   triangle();
32   triangle(const cartesian_point &vertex1, const cartesian_point &vertex2,
33           const cartesian_point &vertex3);
34   triangle(const triangle &to_copy);
35   ~triangle();
36
37   triangle &operator =(const triangle &to_copy);
38
39   bool inside(const cartesian_point &where) const;
40
41   double area() const;
42
43   line<double> side_1_2() const;
44   line<double> side_2_3() const;
45   line<double> side_3_1() const;
46
47   cartesian_point vertex_1() const;
48   cartesian_point vertex_2() const;
49   cartesian_point vertex_3() const;
50
51   void vertex_1(const cartesian_point &to_set);
52   void vertex_2(const cartesian_point &to_set);
53   void vertex_3(const cartesian_point &to_set);
54
55 protected:
56   cartesian_point _vertex_1;
57   cartesian_point _vertex_2;
58   cartesian_point _vertex_3;
59 };
60
61 } // namespace.
62
63 #endif
64