4 /*****************************************************************************\
7 * Author : Chris Koeritz *
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 \*****************************************************************************/
18 #include "cartesian_objects.h"
20 #include "rectangle.h"
26 : _vertex_1(cartesian_point::origin()),
27 _vertex_2(cartesian_point::origin()),
28 _vertex_3(cartesian_point::origin())
31 triangle::triangle(const cartesian_point &vertex_1,
32 const cartesian_point &vertex_2, const cartesian_point &vertex_3)
33 : _vertex_1(vertex_1),
38 triangle::triangle(const triangle &to_copy)
39 : _vertex_1(to_copy._vertex_1),
40 _vertex_2(to_copy._vertex_2),
41 _vertex_3(to_copy._vertex_3)
44 triangle::~triangle() {}
46 triangle &triangle::operator =(const triangle &to_copy)
48 if (this == &to_copy) return *this;
49 _vertex_1 = to_copy._vertex_1;
50 _vertex_2 = to_copy._vertex_2;
51 _vertex_3 = to_copy._vertex_3;
55 line<double> triangle::side_1_2() const
56 { return line<double>(_vertex_1, _vertex_2); }
58 line<double> triangle::side_2_3() const
59 { return line<double>(_vertex_2, _vertex_3); }
61 line<double> triangle::side_3_1() const
62 { return line<double>(_vertex_3, _vertex_1); }
64 cartesian_point triangle::vertex_1() const { return _vertex_1; }
66 cartesian_point triangle::vertex_2() const { return _vertex_2; }
68 cartesian_point triangle::vertex_3() const { return _vertex_3; }
70 void triangle::vertex_1(const cartesian_point &to_set) { _vertex_1 = to_set; }
72 void triangle::vertex_2(const cartesian_point &to_set) { _vertex_2 = to_set; }
74 void triangle::vertex_3(const cartesian_point &to_set) { _vertex_3 = to_set; }
76 bool triangle::inside(const cartesian_point &where) const
78 //cerr << "triangle::inside: not implemented" << endl << flush;
79 if (where.x()) where.y(); // bogus.
83 double triangle::area() const
85 //cerr << "triangle::area: not implemented" << endl << flush;
94 using namespace geometric;
95 typedef rectangle_warper<double> chuzzo;
96 chuzzo beanburp = chuzzo(rectangle<double>(0, 23, 39, 1012),
97 rectangle<double>(8, 19, 92982, -2), chuzzo::BOTTOM_RIGHT,
99 typedef rectangle_warper<double>::horizontal_component horzo;
100 typedef rectangle_warper<double>::vertical_component verzo;
103 beanburp.separate_horizontal(chuzzo::BOTTOM_RIGHT, peen);
105 beanburp.separate_vertical(chuzzo::TOP_RIGHT, neep);