ClanLib  2.3.7
angle.h
Go to the documentation of this file.
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2011 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Harry Storbacka
27 */
28 
31 
32 #pragma once
33 
34 #include "../api_core.h"
35 #include "../System/sharedptr.h"
36 
37 class CL_Angle_Impl;
38 
43 {
46 };
47 
52 {
59 };
60 
61 
66 {
69 public:
71  CL_Angle();
72 
74  CL_Angle(float value, CL_AngleUnit unit);
75 
81  static CL_Angle from_radians(float value);
82 
88  static CL_Angle from_degrees(float value);
89 
93 public:
95  float to_degrees() const;
96 
98  float to_radians() const;
99 
103 public:
105  void set_degrees(float degrees);
106 
108  void set_radians(float radians);
109 
113  CL_Angle &normalize();
114 
118  CL_Angle &normalize_180();
119 
123 public:
125  void operator += (const CL_Angle &angle);
126 
128  void operator -= (const CL_Angle &angle);
129 
131  void operator *= (const CL_Angle &angle);
132 
134  void operator /= (const CL_Angle &angle);
135 
137  CL_Angle operator + (const CL_Angle &angle) const;
138 
140  CL_Angle operator - (const CL_Angle &angle) const;
141 
143  CL_Angle operator * (const CL_Angle &angle) const;
144 
146  CL_Angle operator * (float value) const;
147 
149  CL_Angle operator / (const CL_Angle &angle) const;
150 
152  CL_Angle operator / (float value) const;
153 
155  bool operator < (const CL_Angle &angle) const;
156 
158  bool operator <= (const CL_Angle &angle) const;
159 
161  bool operator > (const CL_Angle &angle) const;
162 
164  bool operator >= (const CL_Angle &angle) const;
165 
167  bool operator== (const CL_Angle &angle) const;
168 
170  bool operator!= (const CL_Angle &angle) const;
171 
175 private:
176  float value_rad;
177 
179 };
180