claw 1.9.0
 
Loading...
Searching...
No Matches
coordinate_2d.hpp
Go to the documentation of this file.
1/*
2 CLAW - a C++ Library Absolutely Wonderful
3
4 CLAW is a free library without any particular aim but being useful to
5 anyone.
6
7 Copyright (C) 2005-2011 Julien Jorge
8
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Lesser General Public
11 License as published by the Free Software Foundation; either
12 version 2.1 of the License, or (at your option) any later version.
13
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public
20 License along with this library; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
23 contact: julien.jorge@stuff-o-matic.com
24*/
30#ifndef __CLAW_COORDINATE_2D_HPP__
31#define __CLAW_COORDINATE_2D_HPP__
32
33namespace claw
34{
35 namespace math
36 {
41 template <typename T>
42 class coordinate_2d
43 {
44 public:
46 typedef T value_type;
47
49 typedef coordinate_2d<value_type> self_type;
50
51 public:
52 coordinate_2d();
53
54 template <typename U>
55 coordinate_2d(const coordinate_2d<U>& that);
56
57 coordinate_2d(const value_type& _x, const value_type& _y);
58
59 template <typename U>
60 coordinate_2d<U> cast_value_type_to() const;
61
62 void set(const value_type& _x, const value_type& _y);
63 value_type distance(const self_type& p) const;
64
65 void rotate(const self_type& center, double angle);
66 double slope_angle(const self_type& to) const;
67
68 bool operator==(const self_type& vect) const;
69 bool operator!=(const self_type& vect) const;
70 self_type operator+(const self_type& vect) const;
71 self_type operator-(const self_type& vect) const;
72 self_type& operator+=(const self_type& vect);
73 self_type& operator-=(const self_type& vect);
74
75 self_type operator*(const value_type& v) const;
76 self_type operator/(const value_type& v) const;
77 self_type& operator*=(const value_type& v);
78 self_type& operator/=(const value_type& v);
79
80 public:
83
86
87 }; // class coordinate_2d
88
89 template <typename T>
90 coordinate_2d<T> operator-(const coordinate_2d<T>& that);
91
92 template <typename T, typename U>
93 coordinate_2d<T> operator*(U v, const coordinate_2d<T>& self);
94
95 }
96}
97
98#include <claw/coordinate_2d.tpp>
99
100#endif // __CLAW_COORDINATE_2D_HPP__
Coordinates in a two dimensional space.
coordinate_2d< value_type > self_type
Manipulation of mathematic, geometric, etc. items.
Definition box_2d.hpp:38
This is the main namespace.