angle.h

Go to the documentation of this file.
00001 /*
00002 **  ClanLib SDK
00003 **  Copyright (c) 1997-2011 The ClanLib Team
00004 **
00005 **  This software is provided 'as-is', without any express or implied
00006 **  warranty.  In no event will the authors be held liable for any damages
00007 **  arising from the use of this software.
00008 **
00009 **  Permission is granted to anyone to use this software for any purpose,
00010 **  including commercial applications, and to alter it and redistribute it
00011 **  freely, subject to the following restrictions:
00012 **
00013 **  1. The origin of this software must not be misrepresented; you must not
00014 **     claim that you wrote the original software. If you use this software
00015 **     in a product, an acknowledgment in the product documentation would be
00016 **     appreciated but is not required.
00017 **  2. Altered source versions must be plainly marked as such, and must not be
00018 **     misrepresented as being the original software.
00019 **  3. This notice may not be removed or altered from any source distribution.
00020 **
00021 **  Note: Some of the libraries ClanLib may link to may have additional
00022 **  requirements or restrictions.
00023 **
00024 **  File Author(s):
00025 **
00026 **    Harry Storbacka
00027 */
00028 
00031 
00032 #pragma once
00033 
00034 #include "../api_core.h"
00035 #include "../System/sharedptr.h"
00036 
00037 class CL_Angle_Impl;
00038 
00042 enum CL_AngleUnit
00043 {
00044         cl_degrees,
00045         cl_radians
00046 };
00047 
00051 enum CL_EulerOrder
00052 {
00053         cl_XYZ,
00054         cl_XZY,
00055         cl_YZX,
00056         cl_YXZ,
00057         cl_ZXY,
00058         cl_ZYX
00059 };
00060 
00061 
00065 class CL_API_CORE CL_Angle
00066 {
00069 public:
00071         CL_Angle();
00072 
00074         CL_Angle(float value, CL_AngleUnit unit);
00075 
00081         static CL_Angle from_radians(float value);
00082 
00088         static CL_Angle from_degrees(float value);
00089 
00093 public:
00095         float to_degrees() const;
00096 
00098         float to_radians() const;
00099 
00103 public:
00105         void set_degrees(float degrees);
00106 
00108         void set_radians(float radians);
00109 
00113         CL_Angle &normalize();
00114 
00118         CL_Angle &normalize_180();
00119 
00123 public:
00125         void operator += (const CL_Angle &angle);
00126 
00128         void operator -= (const CL_Angle &angle);
00129 
00131         void operator *= (const CL_Angle &angle);
00132 
00134         void operator /= (const CL_Angle &angle);
00135 
00137         CL_Angle operator + (const CL_Angle &angle) const;
00138 
00140         CL_Angle operator - (const CL_Angle &angle) const;
00141 
00143         CL_Angle operator * (const CL_Angle &angle) const;
00144 
00146         CL_Angle operator * (float value) const;
00147 
00149         CL_Angle operator / (const CL_Angle &angle) const;
00150 
00152         CL_Angle operator / (float value) const;
00153 
00155         bool operator < (const CL_Angle &angle) const;
00156 
00158         bool operator <= (const CL_Angle &angle) const;
00159 
00161         bool operator > (const CL_Angle &angle) const;
00162 
00164         bool operator >= (const CL_Angle &angle) const;
00165 
00167         bool operator== (const CL_Angle &angle) const;
00168 
00170         bool operator!= (const CL_Angle &angle) const;
00171 
00175 private:
00176         float value_rad;
00177 
00179 };
00180