23 # define M_2PI (6.28318530717958647692)
27 # define M_1_2PI (0.15915494309189533577)
31 # define UINT16_MAX (65535)
35 # define UINT32_MAX (4294967295U)
40 #define D2R(x) ( ( x ) * M_PI / 180.0 )
44 #define R2D(x) ( ( x ) * 180.0 / M_PI)
49 # define MIN(a,b) ( ( ( a ) != ( a ) || ( a ) <= ( b ) ) ? ( a ) : ( b ) != ( b ) || ( a ) > ( b ) ? ( b ) : ( a ) )
55 # define MAX(a,b) ( ( ( a ) != ( a ) || ( a ) >= ( b ) ) ? ( a ) : ( b ) != ( b ) || ( a ) < ( b ) ? ( b ) : ( a ) )
69 static const double TWOPI = M_PI * 2.0;
78 static T
Limit(
const T& value,
const T& limit1,
const T& limit2 );
85 static bool InLimit(
const T& value,
const T& limit1,
const T& limit2 );
91 inline static T
Min(
const T& a,
const T& b )
100 inline static T
Max(
const T& a,
const T& b )
106 template <
typename T>
109 return number * number;
113 template <
typename T>
114 inline static void Swap( T& a, T& b )
129 template <
typename T>
130 static T
Round(
const T& value,
const T& divisor );
135 template <
typename T>
136 static T
Sign(
const T& x );
141 template <
typename T>
142 static T
ModPi(
const T& angle );
146 template <
typename T>
147 static T
NanZero(
const T& value );
153 template <
typename T>
155 const unsigned int indexMin,
const unsigned int indexMax );
159 template <
typename T>
160 static T
Interpolate1D(
const T& x,
const T& data0,
const T& data1,
161 const T& x0,
const T& x1 );
166 template <
typename T>
167 static T
Interpolate2D(
const T& x,
const T& y, T data[][ 2 ],
168 const T& x0,
const T& x1,
const T& y0,
const T& y1 );
173 template <
typename T>
176 const T& x0,
const T& x1,
177 const T& y0,
const T& y1,
178 const T& z0,
const T& z1 );
183 template <
typename T>
185 const T& z, T data[][ 2 ][ 2 ][ 2 ],
186 const T& w0,
const T& w1,
187 const T& x0,
const T& x1,
188 const T& y0,
const T& y1,
189 const T& z0,
const T& z1 );
210 static double BulkModulus(
double salinity,
double temperature,
double pressure );
234 static double Density(
double salinity,
double temperature,
double pressure );
257 static double OceanDepth(
const double& pressure,
const double& latitude );
274 static double OceanPressure(
const double& depth,
const double& latitude );
281 template <
typename T>
288 while( increment > 0 )
290 for( i = 0; i < arraySize; i++ )
294 while( ( j >= increment ) && ( array[j - increment] > temp ) )
296 array[j] = array[j - increment];
301 if( increment / 2 != 0 )
302 increment = increment / 2;
303 else if( increment == 1 )
310 static bool AreaContains(
float x,
float y,
int segments,
311 float* x0,
float* y0,
float* x1,
float* y1 );
314 float x0,
float y0,
float x1,
float y1,
315 float x2,
float y2 );
static T Max(const T &a, const T &b)
Returns the greater of the two arguments If either input is nan, nan is returned Unit tests in AuvMat...
Definition: AuvMath.h:100
static const double DEG_TO_RAD
Definition: AuvMath.h:70
#define MAX(a, b)
Maximum of two values – also available as AuvMath::Max() template function If either argument is a N...
Definition: AuvMath.h:55
static const double TWOPI
Definition: AuvMath.h:69
static double OceanPressure(const double &depth, const double &latitude)
OceanPressure (depth, latitude)
Definition: AuvMath.cpp:530
static T Interpolate3D(const T &x, const T &y, const T &z, T data[][2][2], const T &x0, const T &x1, const T &y0, const T &y1, const T &z0, const T &z1)
Examines a 2x2x2 data field for the value, where x0 <= x <= x1, y0 <= y <= y1, z0 <= z <= z1 Unit tes...
Definition: AuvMath.cpp:326
static T ModPi(const T &angle)
modulo Pi function: If input is nan, nan is returned Unit tests in AuvMath_Test.testModPi ...
Definition: AuvMath.cpp:107
static T FlipEndian(T value)
Does not test the endianness of the input value, Just flips it.
static T NanZero(const T &value)
Casts nan values to zero – otherwise returns the value Unit tests in AuvMath_Test.testNanZero.
Definition: AuvMath.cpp:118
static bool AreaContains(float x, float y, int segments, float *x0, float *y0, float *x1, float *y1)
Definition: AuvMath.cpp:555
static T Interpolate2D(const T &x, const T &y, T data[][2], const T &x0, const T &x1, const T &y0, const T &y1)
Examines a 2x2 data field for the value, where x0 <= x <= x1, y0 <= y <= y1, Unit tests in AuvMath_Te...
Definition: AuvMath.cpp:299
#define MIN(a, b)
Minimum of two values – also available as AuvMath::Min() template function If either argument is a N...
Definition: AuvMath.h:49
static T Interpolate4D(const T &w, const T &x, const T &y, const T &z, T data[][2][2][2], const T &w0, const T &w1, const T &x0, const T &x1, const T &y0, const T &y1, const T &z0, const T &z1)
Examines a 2x2x2x2 data field for the value, where w0 <= w <= w1, x0 <= x <= x1, y0 <= y <= y1...
Definition: AuvMath.cpp:366
static void Swap(T &a, T &b)
Swaps the two arguments.
Definition: AuvMath.h:114
Contains the Point3D class definition.
static double BulkModulus(double salinity, double temperature, double pressure)
Seawater bulk modulus (S,T,P)
Definition: AuvMath.cpp:420
static void UnitVectorToAzimuthAndElevation(Point3D &uhat, float &azimuth, float &elevation)
Definition: AuvMath.cpp:577
static T Limit(const T &value, const T &limit1, const T &limit2)
Makes sure a variable falls within defined limits...
Definition: AuvMath.cpp:20
static double Density(double salinity, double temperature, double pressure)
Seawater density (S,T,P)
Definition: AuvMath.cpp:476
static const double RAD_TO_DEG
Definition: AuvMath.h:71
Wraps three double precision (8-byte) floating point numbers.
Definition: Point3D.h:28
Contains useful math-related utilities.
Definition: AuvMath.h:64
static int FindLtEqIndex(const T *values, const T &value, const unsigned int indexMin, const unsigned int indexMax)
Finds the index within an array where the value is <= the supplied value Searches from indexMin to in...
Definition: AuvMath.cpp:239
static T Sign(const T &x)
Returns signum function: If input is nan, nan is returned Unit tests in AuvMath_Test.testSign.
Definition: AuvMath.cpp:226
static void AzimuthAndElevationToUnitVector(float &azimuth, float &elevation, Point3D &uhat)
Definition: AuvMath.cpp:583
static T Min(const T &a, const T &b)
Returns the lesser of the two arguments If either input is nan, nan is returned Unit tests in AuvMath...
Definition: AuvMath.h:91
static bool TriangleContains(float x, float y, float x0, float y0, float x1, float y1, float x2, float y2)
Definition: AuvMath.cpp:568
Contains the Matrix3x3 class definition.
static void ShellSort(T array[], int arraySize)
Definition: AuvMath.h:282
static T Square(T number)
Square function (opposite of sqrt(T))
Definition: AuvMath.h:107
static bool InLimit(const T &value, const T &limit1, const T &limit2)
Tests if a variable falls within defined limits...
Definition: AuvMath.cpp:65
static T Round(const T &value, const T &divisor)
Makes sure a variable is divisible by specified divisor...
Definition: AuvMath.cpp:202
static T Interpolate1D(const T &x, const T &data0, const T &data1, const T &x0, const T &x1)
Examines a 2 element data field for the value, where x0 <= x <= x1 Unit tests in AuvMath_Test.testInterpolate1D.
Definition: AuvMath.cpp:279
static double OceanDepth(const double &pressure, const double &latitude)
OceanDepth (pressure, latitude)
Definition: AuvMath.cpp:508