]> git.mxchange.org Git - simgear.git/blobdiff - simgear/math/SGMisc.hxx
Add dist and distSqr functions
[simgear.git] / simgear / math / SGMisc.hxx
index b6671f8434fbfedb20a9b253a1c63a3af7b6cfcb..9540dd0343259ab751c5b7522513631deff9faa4 100644 (file)
@@ -1,3 +1,20 @@
+// Copyright (C) 2006  Mathias Froehlich - Mathias.Froehlich@web.de
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+//
+
 #ifndef SGMisc_H
 #define SGMisc_H
 
@@ -29,6 +46,11 @@ public:
       return 0;
   }
 
+  static T rad2deg(const T& val)
+  { return val*180/pi(); }
+  static T deg2rad(const T& val)
+  { return val*pi()/180; }
+
 #ifndef NDEBUG
   /// Returns true if v is a NaN value
   /// Use with care: allways code that you do not need to use that!