Main Page | Class Hierarchy | Class List | File List

PlaneAngle.h

Go to the documentation of this file.
00001 
00004 /* Copyright (C) 2002 - 2006, Bernd Speiser */
00005 
00006 /* This file is part of Quantities.
00007 
00008 PhysicalQuantities is free software; you can redistribute it and/or
00009 modify it under the terms of the GNU General Public License
00010 as published by the Free Software Foundation; either version 2
00011 of the License, or (at your option) any later version.
00012 
00013 PhysicalQuantities is distributed in the hope that it will be useful,
00014 but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 GNU General Public License for more details.
00017   
00018 You should have received a copy of the GNU General Public License
00019 along with this program; if not, write to the Free Software
00020 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00021 02111-1307, USA.
00022 */
00023 
00024 #ifndef _PlaneAngle_h
00025 #define _PlaneAngle_h
00026 
00027 #include "Quantity/Variable.h"
00028 #include "Quantity/Constant.h"
00029 #include "Quantity/QuantityCluster.h"
00030 
00031 namespace quantity {
00032   namespace planeAngle {
00033 
00034 /* PlaneAngle dimension */
00035 typedef BSUtilities::Rational<0> LE;
00036 typedef BSUtilities::Rational<0> M;
00037 typedef BSUtilities::Rational<0> TI;
00038 typedef BSUtilities::Rational<0> E;
00039 typedef BSUtilities::Rational<0> TE;
00040 typedef BSUtilities::Rational<0> A;
00041 typedef BSUtilities::Rational<0> LU;
00042 
00043 typedef dimension::Dimension<LE, M, TI, E, TE, A, LU> Dimension;
00044 
00046 class Unit;
00047 
00048 /* declaration of PlaneAngle units */
00049 class RadianUnits;
00050 class DegreeUnit;
00051 class MinuteUnit;
00052 class SecondUnit;
00053 class GradeUnit;
00054 
00055 /* the radian and prefixed radians */
00056 
00057 typedef unit::Prefixable<Unit, RadianUnits> Radians;
00058 
00059 typedef unit::Prefixed<Radians> Radian;
00060 typedef unit::Prefixed<Radians, unit::Deci> DeciRadian;
00061 typedef unit::Prefixed<Radians, unit::Milli> MilliRadian;
00062 typedef unit::Prefixed<Radians, unit::Micro> MicroRadian;
00063 typedef unit::Prefixed<Radians, unit::Nano> NanoRadian;
00064 typedef unit::Prefixed<Radians, unit::Pico> PicoRadian;
00065 
00066 /* the degree */
00067 
00068 typedef unit::NonPrefixable<Unit, DegreeUnit> Degree;
00069 
00070 /* the minute */
00071 
00072 typedef unit::NonPrefixable<Unit, MinuteUnit> Minute;
00073 
00074 /* the second */
00075 
00076 typedef unit::NonPrefixable<Unit, SecondUnit> Second;
00077 
00078 /* the grade */
00079 
00080 typedef unit::NonPrefixable<Unit, GradeUnit> Grade;
00081 
00082 typedef Loki::TL::Append<Radians::Units,
00083           LOKI_TYPELIST_4(Degree, Minute, Second, Grade)>::Result Units;
00084 
00085 /* PlaneAngle quantity */
00086 
00087 typedef quantity::Quantity<Dimension, Unit, Units, Radian> Quantity;
00088 typedef quantity::Quantity<Dimension, Unit, Units, Radian, long> 
00089                                                             IntQuantity;
00090 }
00091 
00092 /* specializations of trigonometric functions */
00093 
00095 
00096 template<class ST>
00097   struct Sin<planeAngle::Dimension, planeAngle::Unit, 
00098                           planeAngle::Units, planeAngle::Radian, ST>
00099     {static ST exec (const Quantity<planeAngle::Dimension, 
00100        planeAngle::Unit, planeAngle::Units, planeAngle::Radian, 
00101                                                       ST> &quantity)
00102       {return ST(std::sin (Reverse<planeAngle::Radian>::VAL
00103                                         (quantity.standard_value ())));}
00104     };
00105 
00107 
00108 template<class ST>
00109   struct Cos<planeAngle::Dimension, planeAngle::Unit, 
00110                           planeAngle::Units, planeAngle::Radian, ST>
00111     {static ST exec (const Quantity<planeAngle::Dimension, 
00112        planeAngle::Unit, planeAngle::Units, planeAngle::Radian, 
00113                                                       ST> &quantity)
00114       {return ST(std::cos (Reverse<planeAngle::Radian>::VAL
00115                                         (quantity.standard_value ())));}
00116     };
00117 
00119 
00120 template<class ST>
00121   struct Tan<planeAngle::Dimension, planeAngle::Unit, 
00122                           planeAngle::Units, planeAngle::Radian, ST>
00123     {static ST exec (const Quantity<planeAngle::Dimension,
00124        planeAngle::Unit, planeAngle::Units, planeAngle::Radian, 
00125                                                       ST> &quantity)
00126       {return ST(std::tan (Reverse<planeAngle::Radian>::VAL
00127                                         (quantity.standard_value ())));}
00128     };
00129 
00131 
00132 template<class ST>
00133   struct Sinh<planeAngle::Dimension, planeAngle::Unit, 
00134                           planeAngle::Units, planeAngle::Radian, ST>
00135     {static ST exec (const Quantity<planeAngle::Dimension,
00136        planeAngle::Unit, planeAngle::Units, planeAngle::Radian, 
00137                                                       ST> &quantity)
00138       {return ST(std::sinh (Reverse<planeAngle::Radian>::VAL
00139                                         (quantity.standard_value ())));}
00140     };
00141 
00143 
00144 template<class ST>
00145   struct Cosh<planeAngle::Dimension, planeAngle::Unit, 
00146                           planeAngle::Units, planeAngle::Radian, ST>
00147     {static ST exec (const Quantity<planeAngle::Dimension, 
00148        planeAngle::Unit, planeAngle::Units, planeAngle::Radian, 
00149                                                       ST> &quantity)
00150       {return ST(std::cosh (Reverse<planeAngle::Radian>::VAL
00151                                         (quantity.standard_value ())));}
00152     };
00153 
00155 
00156 template<class ST>
00157   struct Tanh<planeAngle::Dimension, planeAngle::Unit, 
00158                           planeAngle::Units, planeAngle::Radian, ST>
00159     {static ST exec (const Quantity<planeAngle::Dimension, 
00160        planeAngle::Unit, planeAngle::Units, planeAngle::Radian, 
00161                                                       ST> &quantity)
00162       {return ST(std::tanh (Reverse<planeAngle::Radian>::VAL
00163                                         (quantity.standard_value ())));}
00164     };
00165 
00167 
00168 template<class ST>
00169   struct Asin<planeAngle::Dimension, planeAngle::Unit, 
00170                           planeAngle::Units, planeAngle::Radian, ST>
00171     {static ST exec (const Quantity<planeAngle::Dimension, 
00172        planeAngle::Unit, planeAngle::Units, planeAngle::Radian, 
00173                                                       ST> &quantity)
00174       {return ST(std::asin (Reverse<planeAngle::Radian>::VAL
00175                                         (quantity.standard_value ())));}
00176     };
00177 
00179 
00180 template<class ST>
00181   struct Acos<planeAngle::Dimension, planeAngle::Unit, 
00182                           planeAngle::Units, planeAngle::Radian, ST>
00183     {static ST exec (const Quantity<planeAngle::Dimension, 
00184        planeAngle::Unit, planeAngle::Units, planeAngle::Radian, 
00185                                                       ST> &quantity)
00186       {return ST(std::cos (Reverse<planeAngle::Radian>::VAL
00187                                         (quantity.standard_value ())));}
00188     };
00189 
00191 
00192 template<class ST>
00193   struct Atan<planeAngle::Dimension, planeAngle::Unit, 
00194                           planeAngle::Units, planeAngle::Radian, ST>
00195     {static ST exec (const Quantity<planeAngle::Dimension,
00196        planeAngle::Unit, planeAngle::Units, planeAngle::Radian, 
00197                                                       ST> &quantity)
00198       {return ST(std::atan (Reverse<planeAngle::Radian>::VAL
00199                                         (quantity.standard_value ())));}
00200     };
00201 
00202 typedef Variable<planeAngle::Quantity> PlaneAngle;
00203 typedef Variable<planeAngle::IntQuantity> IntPlaneAngle;
00204 typedef Variable<planeAngle::Quantity, planeAngle::Degree> 
00205                                                        DegreePlaneAngle;
00206 typedef Constant<planeAngle::Quantity> PlaneAngleConstant;
00207 
00208 typedef QuantityVector<Variable, planeAngle::Quantity> PlaneAngleVector;
00209 
00210   }
00211 
00212 #endif /* _PlaneAngle_h */

Generated on Mon Feb 12 18:44:06 2007 for PhysicalQuantities by doxygen 1.3.6