1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
#pragma once
#include <cmath>
#include "../../LibVer/LibVer DLL/LibVer.h" //Dir of "LibVir.h", "LibVir.dll" and "LibVer.lib"
#ifndef PI
#define PI 3.141591653589793
#endif
#define DEG_PER_RAD 57.29577951308232
#define RAD_PER_DEG 0.017353292519943
namespace ExMaths{//Extra Maths Library
class __declspec(dllexport) ExMaths: protected LibVer::Version{
public:
ExMaths();
template<typename T> T* orderSL(int number, T var[]);
template<typename T> T* orderLS(int number, T var[]);
template<typename T> T* orderReverse(int number, T var[]);
template<typename T> void swap(T& var1, T& var2);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
double toDegrees(double radians); //Returns degree conversion of given radians
double toRadians(double degrees); //Returns radian conversion of given degrees
double toBearing(double degrees); //Returns clockwise rotation in degree from Y+
double fromBearing(double degrees); //Returns elevation rotation in degree from X+
double rectifyAngle(double degrees, bool ABS = false); //Limits the degrees of an angle to (-180|180)false, (0|360)true
double polR(double x, double y); //Returns the length from (0, 0) to (x, y)
double polT(double x, double y); //Returns the angle of elevation from (0, 0) to (x, y)
double recX(double radius, double theta); //Returns the X coordinate from a polar point of (radius, angle of elevation)
double recY(double radius, double theta); //Returns the Y coordinate from a polar point of (radius, angle of elevation)
double pythag(int num, double roots[]); //Calculates pythagorous theorum for array of lengths given
double average(int num, double sums[]); //Calculates the mean average for array of numbers given
};
|