X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=include%2Fkmath.h;h=48370267f1f9d92740bded47f363b83e3a4dde78;hp=5599327d2c285de22af7b1745f3965edf8b86fbd;hb=b5857e74e5735455b5ef11cbea5044ae7b2e8a0d;hpb=4ff5096195e60f80c985d5762d74329406ffa21a diff --git a/include/kmath.h b/include/kmath.h index 5599327..4837026 100644 --- a/include/kmath.h +++ b/include/kmath.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: kmath.h,v 1.12 2000/06/13 16:20:31 kevin Exp $ +** $Id: kmath.h,v 1.13 2000/06/15 19:07:10 kevin Exp $ ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -30,7 +30,6 @@ #include #include -#include #define PI 3.14159265358979323846 #define HALFPI 1.57079632679489661923 /* PI divided by 2 */ @@ -44,21 +43,25 @@ #define F_EPSILON 1.0E-6 #define D_EPSILON 1.0E-10 -#define DEG_TO_RAD(x) (x*(PI/180.)) -#define RAD_TO_DEG(x) (x*(180./PI)) - #define ASSUMEDZERO 1E-10 typedef double GRFMTX_2D[3][3]; typedef double GRFMTX_3D[4][4]; +inline double +convertDegreesToRadians (double x) +{ return (x * (PI/180.)); } + +inline double +convertRadiansToDegrees (double x) +{ return (x*(180./PI)); } template inline T nearest (double x) { return (x > 0 ? static_cast(x+0.5) : static_cast(x-0.5)); } template -inline T clamp (T value, T upperBounds, T lowerBounds) +inline T clamp (T value, T lowerBounds, T upperBounds) { return (value >= upperBounds ? upperBounds : (value <= lowerBounds ? lowerBounds : value )); }