889 lines
35 KiB
C++
889 lines
35 KiB
C++
/*
|
|
AUTOMATICALLY GENERATED FILE - DO NOT EDIT!
|
|
Please change MatrixNxN.py and re-run it
|
|
*/
|
|
/* Generated with ./VectorN.py n = 3, TYPE = double */
|
|
|
|
#include "ZUnitTest.hpp"
|
|
#include <float.h>
|
|
#include <math.h>
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <SST/SST_Vec3.h>
|
|
|
|
|
|
|
|
|
|
static const char* testSST_Math_Vec3dAdd();
|
|
static const char* testSST_Math_Vec3dAddLocal();
|
|
static const char* testSST_Math_Vec3dSubtract();
|
|
static const char* testSST_Math_Vec3dSubtractLocal();
|
|
static const char* testSST_Math_Vec3dMultiply();
|
|
static const char* testSST_Math_Vec3dMultiplyLocal();
|
|
static const char* testSST_Math_Vec3dScale();
|
|
static const char* testSST_Math_Vec3dScaleLocal();
|
|
static const char* testSST_Math_Vec3dDivide();
|
|
static const char* testSST_Math_Vec3dDivideLocal();
|
|
static const char* testSST_Math_Vec3dAbs();
|
|
static const char* testSST_Math_Vec3dAbsLocal();
|
|
static const char* testSST_Math_Vec3dNegate();
|
|
static const char* testSST_Math_Vec3dNegateLocal();
|
|
static const char* testSST_Math_Vec3dBias();
|
|
static const char* testSST_Math_Vec3dBiasLocal();
|
|
static const char* testSST_Math_Vec3dRecip();
|
|
static const char* testSST_Math_Vec3dRecipLocal();
|
|
static const char* testSST_Math_Vec3dRecipSqrt();
|
|
static const char* testSST_Math_Vec3dRecipSqrtLocal();
|
|
static const char* testSST_Math_Vec3dSqrt();
|
|
static const char* testSST_Math_Vec3dSqrtLocal();
|
|
static const char* testSST_Math_Vec3dSqrt();
|
|
static const char* testSST_Math_Vec3dSqrtLocal();
|
|
static const char* testSST_Math_Vec3dCross();
|
|
static const char* testSST_Math_Vec3dCrossLocal();
|
|
static const char* testSST_Math_Vec3dRotateAbout();
|
|
static const char* testSST_Math_Vec3dRotateAboutLocal();
|
|
static const char* testSST_Math_Vec3dProject();
|
|
static const char* testSST_Math_Vec3dProjectLocal();
|
|
static const char* testSST_Math_Vec3dMagnitude();
|
|
static const char* testSST_Math_Vec3dNormalize();
|
|
static const char* testSST_Math_Vec3dNormalizeLocal();
|
|
static const char* testSST_Math_Vec3dMagnitudeSquared();
|
|
static const char* testSST_Math_Vec3dDot();
|
|
// List of unit tests
|
|
ZUnitTest SST_Math_Vec3dUnitTests[] =
|
|
{
|
|
{ "testSST_Math_Vec3dAdd " , testSST_Math_Vec3dAdd },
|
|
{ "testSST_Math_Vec3dAddLocal " , testSST_Math_Vec3dAddLocal },
|
|
{ "testSST_Math_Vec3dSubtract " , testSST_Math_Vec3dSubtract },
|
|
{ "testSST_Math_Vec3dSubtractLocal " , testSST_Math_Vec3dSubtractLocal },
|
|
{ "testSST_Math_Vec3dMultiply " , testSST_Math_Vec3dMultiply },
|
|
{ "testSST_Math_Vec3dMultiplyLocal " , testSST_Math_Vec3dMultiplyLocal },
|
|
{ "testSST_Math_Vec3dScale " , testSST_Math_Vec3dScale },
|
|
{ "testSST_Math_Vec3dScaleLocal " , testSST_Math_Vec3dScaleLocal },
|
|
{ "testSST_Math_Vec3dDivide " , testSST_Math_Vec3dDivide },
|
|
{ "testSST_Math_Vec3dDivideLocal " , testSST_Math_Vec3dDivideLocal },
|
|
{ "testSST_Math_Vec3dAbs " , testSST_Math_Vec3dAbs },
|
|
{ "testSST_Math_Vec3dAbsLocal " , testSST_Math_Vec3dAbsLocal },
|
|
{ "testSST_Math_Vec3dNegate " , testSST_Math_Vec3dNegate },
|
|
{ "testSST_Math_Vec3dNegateLocal " , testSST_Math_Vec3dNegateLocal },
|
|
{ "testSST_Math_Vec3dBias " , testSST_Math_Vec3dBias },
|
|
{ "testSST_Math_Vec3dBiasLocal " , testSST_Math_Vec3dBiasLocal },
|
|
{ "testSST_Math_Vec3dRecip " , testSST_Math_Vec3dRecip },
|
|
{ "testSST_Math_Vec3dRecipLocal " , testSST_Math_Vec3dRecipLocal },
|
|
{ "testSST_Math_Vec3dRecipSqrt " , testSST_Math_Vec3dRecipSqrt },
|
|
{ "testSST_Math_Vec3dRecipSqrtLocal " , testSST_Math_Vec3dRecipSqrtLocal },
|
|
{ "testSST_Math_Vec3dSqrt " , testSST_Math_Vec3dSqrt },
|
|
{ "testSST_Math_Vec3dSqrtLocal " , testSST_Math_Vec3dSqrtLocal },
|
|
{ "testSST_Math_Vec3dSqrt " , testSST_Math_Vec3dSqrt },
|
|
{ "testSST_Math_Vec3dSqrtLocal " , testSST_Math_Vec3dSqrtLocal },
|
|
{ "testSST_Math_Vec3dMagnitude " , testSST_Math_Vec3dMagnitude },
|
|
{ "testSST_Math_Vec3dNormalize " , testSST_Math_Vec3dNormalize },
|
|
{ "testSST_Math_Vec3dNormalizeLocal " , testSST_Math_Vec3dNormalizeLocal },
|
|
{ "testSST_Math_Vec3dCross " , testSST_Math_Vec3dCross },
|
|
{ "testSST_Math_Vec3dCrossLocal " , testSST_Math_Vec3dCrossLocal },
|
|
{ "testSST_Math_Vec3dRotateAbout " , testSST_Math_Vec3dRotateAbout },
|
|
{ "testSST_Math_Vec3dRotateAboutLocal " , testSST_Math_Vec3dRotateAboutLocal },
|
|
{ "testSST_Math_Vec3dProject " , testSST_Math_Vec3dProject },
|
|
{ "testSST_Math_Vec3dProjectLocal " , testSST_Math_Vec3dProjectLocal },
|
|
{ "testSST_Math_Vec3dMagnitudeSquared " , testSST_Math_Vec3dMagnitudeSquared },
|
|
{ "testSST_Math_Vec3dDot " , testSST_Math_Vec3dDot }
|
|
};
|
|
DECLARE_ZTESTBLOCK(SST_Math_Vec3d)
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dAdd()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
SST_Vec3d y; /* 3 vector */
|
|
SST_Vec3d w; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = -1.0000000000000000;
|
|
x.v[1] = -8.0000000000000000;
|
|
x.v[2] = -5.0000000000000000;
|
|
y.v[0] = 9.0000000000000000;
|
|
y.v[1] = -4.0000000000000000;
|
|
y.v[2] = -18.0000000000000000;
|
|
w.v[0] = 0.0000000000000000;
|
|
w.v[1] = 0.0000000000000000;
|
|
w.v[2] = 0.0000000000000000;
|
|
/*
|
|
[-1. -8. -5.]
|
|
[ 9. -4. -18.]
|
|
[ 8. -12. -23.]
|
|
*/
|
|
SST_Math_Vec3dAdd(&x,&y,&w);
|
|
TASSERT(fabs((w.v[0])-( 8.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((w.v[1])-( -12.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((w.v[2])-( -23.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dAddLocal()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
SST_Vec3d y; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = -13.0000000000000000;
|
|
x.v[1] = -4.0000000000000000;
|
|
x.v[2] = 8.0000000000000000;
|
|
y.v[0] = -6.0000000000000000;
|
|
y.v[1] = 9.0000000000000000;
|
|
y.v[2] = -17.0000000000000000;
|
|
/*
|
|
[-13. -4. 8.]
|
|
[ -6. 9. -17.]
|
|
[-19. 5. -9.]
|
|
*/
|
|
SST_Math_Vec3dAddLocal(&x,&y); /* for accuracy */
|
|
TASSERT(fabs((x.v[0])-( -19.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((x.v[1])-( 5.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((x.v[2])-( -9.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dSubtract()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
SST_Vec3d y; /* 3 vector */
|
|
SST_Vec3d w; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = 12.0000000000000000;
|
|
x.v[1] = 14.0000000000000000;
|
|
x.v[2] = 2.0000000000000000;
|
|
y.v[0] = 4.0000000000000000;
|
|
y.v[1] = -8.0000000000000000;
|
|
y.v[2] = 3.0000000000000000;
|
|
w.v[0] = 0.0000000000000000;
|
|
w.v[1] = 0.0000000000000000;
|
|
w.v[2] = 0.0000000000000000;
|
|
/*
|
|
[ 12. 14. 2.]
|
|
[ 4. -8. 3.]
|
|
[ 8. 22. -1.]
|
|
*/
|
|
SST_Math_Vec3dSubtract(&x,&y,&w);
|
|
TASSERT(fabs((w.v[0])-( 8.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((w.v[1])-( 22.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((w.v[2])-( -1.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dSubtractLocal()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
SST_Vec3d y; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = -13.0000000000000000;
|
|
x.v[1] = -3.0000000000000000;
|
|
x.v[2] = -7.0000000000000000;
|
|
y.v[0] = 13.0000000000000000;
|
|
y.v[1] = 13.0000000000000000;
|
|
y.v[2] = -12.0000000000000000;
|
|
/*
|
|
[-13. -3. -7.]
|
|
[ 13. 13. -12.]
|
|
[-26. -16. 5.]
|
|
*/
|
|
SST_Math_Vec3dSubtractLocal(&x,&y); /* for accuracy */
|
|
TASSERT(fabs((x.v[0])-( -26.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((x.v[1])-( -16.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((x.v[2])-( 5.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dMultiply()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
SST_Vec3d y; /* 3 vector */
|
|
SST_Vec3d w; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = -17.0000000000000000;
|
|
x.v[1] = -13.0000000000000000;
|
|
x.v[2] = 19.0000000000000000;
|
|
y.v[0] = 10.0000000000000000;
|
|
y.v[1] = 2.0000000000000000;
|
|
y.v[2] = -2.0000000000000000;
|
|
w.v[0] = 0.0000000000000000;
|
|
w.v[1] = 0.0000000000000000;
|
|
w.v[2] = 0.0000000000000000;
|
|
/*
|
|
[-17. -13. 19.]
|
|
[ 10. 2. -2.]
|
|
[-170. -26. -38.]
|
|
*/
|
|
SST_Math_Vec3dMultiply(&x,&y,&w);
|
|
TASSERT(fabs((w.v[0])-( -170.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((w.v[1])-( -26.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((w.v[2])-( -38.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dMultiplyLocal()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
SST_Vec3d y; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = -2.0000000000000000;
|
|
x.v[1] = -17.0000000000000000;
|
|
x.v[2] = 7.0000000000000000;
|
|
y.v[0] = -11.0000000000000000;
|
|
y.v[1] = -17.0000000000000000;
|
|
y.v[2] = 5.0000000000000000;
|
|
/*
|
|
[ -2. -17. 7.]
|
|
[-11. -17. 5.]
|
|
[ 22. 289. 35.]
|
|
*/
|
|
SST_Math_Vec3dMultiplyLocal(&x,&y); /* for accuracy */
|
|
TASSERT(fabs((x.v[0])-( 22.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((x.v[1])-( 289.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((x.v[2])-( 35.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dDivide()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
SST_Vec3d y; /* 3 vector */
|
|
SST_Vec3d w; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = 7.0000000000000000;
|
|
x.v[1] = 25.0000000000000000;
|
|
x.v[2] = 8.0000000000000000;
|
|
y.v[0] = 22.0000000000000000;
|
|
y.v[1] = 33.0000000000000000;
|
|
y.v[2] = 3.0000000000000000;
|
|
w.v[0] = 0.0000000000000000;
|
|
w.v[1] = 0.0000000000000000;
|
|
w.v[2] = 0.0000000000000000;
|
|
/*
|
|
[ 7. 25. 8.]
|
|
[ 22. 33. 3.]
|
|
[ 0.31818182 0.75757576 2.66666667]
|
|
*/
|
|
SST_Math_Vec3dDivide(&x,&y,&w);
|
|
TASSERT(fabs((w.v[0])-( 0.3181818181818182)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((w.v[1])-( 0.7575757575757576)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((w.v[2])-( 2.6666666666666665)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dDivideLocal()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
SST_Vec3d y; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = 10.0000000000000000;
|
|
x.v[1] = 24.0000000000000000;
|
|
x.v[2] = 14.0000000000000000;
|
|
y.v[0] = 17.0000000000000000;
|
|
y.v[1] = 39.0000000000000000;
|
|
y.v[2] = 28.0000000000000000;
|
|
/*
|
|
[ 10. 24. 14.]
|
|
[ 17. 39. 28.]
|
|
[ 0.58823529 0.61538462 0.5 ]
|
|
*/
|
|
SST_Math_Vec3dDivideLocal(&x,&y); /* for accuracy */
|
|
TASSERT(fabs((x.v[0])-( 0.5882352941176471)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((x.v[1])-( 0.6153846153846154)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((x.v[2])-( 0.5000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dScale()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
SST_Vec3d w; /* 3 vector */
|
|
double a; /* scalar */
|
|
/* Resetting test vectors */
|
|
x.v[0] = -4.0000000000000000;
|
|
x.v[1] = -8.0000000000000000;
|
|
x.v[2] = 1.0000000000000000;
|
|
w.v[0] = 0.0000000000000000;
|
|
w.v[1] = 0.0000000000000000;
|
|
w.v[2] = 0.0000000000000000;
|
|
a = 2.0000000000000000;
|
|
/*
|
|
[-4. -8. 1.]
|
|
[ -8. -16. 2.]
|
|
*/
|
|
SST_Math_Vec3dScale(&x,a,&w);
|
|
TASSERT(fabs((w.v[0])-( -8.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((w.v[1])-( -16.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((w.v[2])-( 2.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dScaleLocal()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
double a; /* scalar */
|
|
/* Resetting test vectors */
|
|
x.v[0] = -2.0000000000000000;
|
|
x.v[1] = -4.0000000000000000;
|
|
x.v[2] = 17.0000000000000000;
|
|
a = 2.0000000000000000;
|
|
/*
|
|
[ -2. -4. 17.]
|
|
[ -4. -8. 34.]
|
|
*/
|
|
SST_Math_Vec3dScaleLocal(&x,a); /* for accuracy */
|
|
TASSERT(fabs((x.v[0])-( -4.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((x.v[1])-( -8.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((x.v[2])-( 34.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dAbs()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
SST_Vec3d w; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = -2.0000000000000000;
|
|
x.v[1] = -11.0000000000000000;
|
|
x.v[2] = -19.0000000000000000;
|
|
w.v[0] = 0.0000000000000000;
|
|
w.v[1] = 0.0000000000000000;
|
|
w.v[2] = 0.0000000000000000;
|
|
/*
|
|
[ -2. -11. -19.]
|
|
[ 2. 11. 19.]
|
|
*/
|
|
SST_Math_Vec3dAbs(&x,&w);
|
|
TASSERT(fabs((w.v[0])-( 2.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((w.v[1])-( 11.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((w.v[2])-( 19.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dAbsLocal()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = -18.0000000000000000;
|
|
x.v[1] = -3.0000000000000000;
|
|
x.v[2] = -12.0000000000000000;
|
|
/*
|
|
[-18. -3. -12.]
|
|
[ 18. 3. 12.]
|
|
*/
|
|
SST_Math_Vec3dAbsLocal(&x); /* for accuracy */
|
|
TASSERT(fabs((x.v[0])-( 18.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((x.v[1])-( 3.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((x.v[2])-( 12.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dBias()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
SST_Vec3d w; /* 3 vector */
|
|
double a; /* scalar */
|
|
/* Resetting test vectors */
|
|
x.v[0] = -20.0000000000000000;
|
|
x.v[1] = -9.0000000000000000;
|
|
x.v[2] = 13.0000000000000000;
|
|
w.v[0] = 0.0000000000000000;
|
|
w.v[1] = 0.0000000000000000;
|
|
w.v[2] = 0.0000000000000000;
|
|
a = 15.0000000000000000;
|
|
/*
|
|
[-20. -9. 13.]
|
|
[-40. -18. 26.]
|
|
*/
|
|
SST_Math_Vec3dBias(&x,a,&w);
|
|
TASSERT(fabs((w.v[0])-( -5.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((w.v[1])-( 6.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((w.v[2])-( 28.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dBiasLocal()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
double a; /* scalar */
|
|
/* Resetting test vectors */
|
|
x.v[0] = -4.0000000000000000;
|
|
x.v[1] = -6.0000000000000000;
|
|
x.v[2] = -7.0000000000000000;
|
|
a = -20.0000000000000000;
|
|
/*
|
|
[-4. -6. -7.]
|
|
[ -8. -12. -14.]
|
|
*/
|
|
SST_Math_Vec3dBiasLocal(&x,a); /* for accuracy */
|
|
TASSERT(fabs((x.v[0])-( -24.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((x.v[1])-( -26.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((x.v[2])-( -27.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dNegate()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
SST_Vec3d w; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = 5.0000000000000000;
|
|
x.v[1] = -2.0000000000000000;
|
|
x.v[2] = -17.0000000000000000;
|
|
w.v[0] = 0.0000000000000000;
|
|
w.v[1] = 0.0000000000000000;
|
|
w.v[2] = 0.0000000000000000;
|
|
/*
|
|
[ 5. -2. -17.]
|
|
[ -5. 2. 17.]
|
|
*/
|
|
SST_Math_Vec3dNegate(&x,&w);
|
|
TASSERT(fabs((w.v[0])-( -5.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((w.v[1])-( 2.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((w.v[2])-( 17.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dNegateLocal()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = -5.0000000000000000;
|
|
x.v[1] = -20.0000000000000000;
|
|
x.v[2] = 2.0000000000000000;
|
|
/*
|
|
[ -5. -20. 2.]
|
|
[ 5. 20. -2.]
|
|
*/
|
|
SST_Math_Vec3dNegateLocal(&x); /* for accuracy */
|
|
TASSERT(fabs((x.v[0])-( 5.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((x.v[1])-( 20.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((x.v[2])-( -2.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dSqrt()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
SST_Vec3d w; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = 20.0000000000000000;
|
|
x.v[1] = 25.0000000000000000;
|
|
x.v[2] = 27.0000000000000000;
|
|
w.v[0] = 0.0000000000000000;
|
|
w.v[1] = 0.0000000000000000;
|
|
w.v[2] = 0.0000000000000000;
|
|
/*
|
|
[ 20. 25. 27.]
|
|
[ 4.47213595 5. 5.19615242]
|
|
*/
|
|
SST_Math_Vec3dSqrt(&x,&w);
|
|
TASSERT(fabs((w.v[0])-( 4.4721359549995796)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((w.v[1])-( 5.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((w.v[2])-( 5.1961524227066320)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dSqrtLocal()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = 8.0000000000000000;
|
|
x.v[1] = 13.0000000000000000;
|
|
x.v[2] = 4.0000000000000000;
|
|
/*
|
|
[ 8. 13. 4.]
|
|
[ 2.82842712 3.60555128 2. ]
|
|
*/
|
|
SST_Math_Vec3dSqrtLocal(&x); /* for accuracy */
|
|
TASSERT(fabs((x.v[0])-( 2.8284271247461903)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((x.v[1])-( 3.6055512754639891)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((x.v[2])-( 2.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dRecipSqrt()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
SST_Vec3d w; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = 19.0000000000000000;
|
|
x.v[1] = 28.0000000000000000;
|
|
x.v[2] = 10.0000000000000000;
|
|
w.v[0] = 0.0000000000000000;
|
|
w.v[1] = 0.0000000000000000;
|
|
w.v[2] = 0.0000000000000000;
|
|
/*
|
|
[ 19. 28. 10.]
|
|
[ 0.22941573 0.18898224 0.31622777]
|
|
*/
|
|
SST_Math_Vec3dRecipSqrt(&x,&w);
|
|
TASSERT(fabs((w.v[0])-( 0.2294157338705617)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((w.v[1])-( 0.1889822365046136)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((w.v[2])-( 0.3162277660168379)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dRecipSqrtLocal()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = 26.0000000000000000;
|
|
x.v[1] = 12.0000000000000000;
|
|
x.v[2] = 37.0000000000000000;
|
|
/*
|
|
[ 26. 12. 37.]
|
|
[ 0.19611614 0.28867513 0.16439899]
|
|
*/
|
|
SST_Math_Vec3dRecipSqrtLocal(&x); /* for accuracy */
|
|
TASSERT(fabs((x.v[0])-( 0.1961161351381840)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((x.v[1])-( 0.2886751345948129)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((x.v[2])-( 0.1643989873053573)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dRecip()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
SST_Vec3d w; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = 5.0000000000000000;
|
|
x.v[1] = 3.0000000000000000;
|
|
x.v[2] = 14.0000000000000000;
|
|
w.v[0] = 0.0000000000000000;
|
|
w.v[1] = 0.0000000000000000;
|
|
w.v[2] = 0.0000000000000000;
|
|
/*
|
|
[ 5. 3. 14.]
|
|
[ 0.2 0.33333333 0.07142857]
|
|
*/
|
|
SST_Math_Vec3dRecip(&x,&w);
|
|
TASSERT(fabs((w.v[0])-( 0.2000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((w.v[1])-( 0.3333333333333333)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((w.v[2])-( 0.0714285714285714)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dRecipLocal()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = 23.0000000000000000;
|
|
x.v[1] = 16.0000000000000000;
|
|
x.v[2] = 6.0000000000000000;
|
|
/*
|
|
[ 23. 16. 6.]
|
|
[ 0.20851441 0.25 0.40824829]
|
|
*/
|
|
SST_Math_Vec3dRecipLocal(&x); /* for accuracy */
|
|
TASSERT(fabs((x.v[0])-( 0.0434782608695652)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((x.v[1])-( 0.0625000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((x.v[2])-( 0.1666666666666667)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dNormalize()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
SST_Vec3d w; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = 18.0000000000000000;
|
|
x.v[1] = 13.0000000000000000;
|
|
x.v[2] = -7.0000000000000000;
|
|
w.v[0] = 0.0000000000000000;
|
|
w.v[1] = 0.0000000000000000;
|
|
w.v[2] = 0.0000000000000000;
|
|
/*
|
|
[ 18. 13. -7.]
|
|
[ 0.7731662 0.55839781 -0.30067575]
|
|
*/
|
|
SST_Math_Vec3dNormalize(&x,&w);
|
|
TASSERT(fabs((w.v[0])-( 0.7731662032576040)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((w.v[1])-( 0.5583978134638251)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((w.v[2])-( -0.3006757457112904)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dNormalizeLocal()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = -15.0000000000000000;
|
|
x.v[1] = -20.0000000000000000;
|
|
x.v[2] = -12.0000000000000000;
|
|
/*
|
|
[-15. -20. -12.]
|
|
[-0.54091383 -0.72121845 -0.43273107]
|
|
*/
|
|
SST_Math_Vec3dNormalizeLocal(&x); /* for accuracy */
|
|
TASSERT(fabs((x.v[0])-( -0.5409138344809642)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((x.v[1])-( -0.7212184459746188)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((x.v[2])-( -0.4327310675847713)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dProject()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
SST_Vec3d y; /* 3 vector */
|
|
SST_Vec3d w; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = -2.0000000000000000;
|
|
x.v[1] = 7.0000000000000000;
|
|
x.v[2] = -12.0000000000000000;
|
|
y.v[0] = -14.0000000000000000;
|
|
y.v[1] = 6.0000000000000000;
|
|
y.v[2] = 15.0000000000000000;
|
|
w.v[0] = 0.0000000000000000;
|
|
w.v[1] = 0.0000000000000000;
|
|
w.v[2] = 0.0000000000000000;
|
|
/*
|
|
[ -2. 7. -12.]
|
|
[-14. 6. 15.]
|
|
[ 3.36980306 -1.44420131 -3.61050328]
|
|
*/
|
|
SST_Math_Vec3dProject(&x,&y,&w);
|
|
TASSERT(fabs((w.v[0])-( 3.3698030634573306)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((w.v[1])-( -1.4442013129102844)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((w.v[2])-( -3.6105032822757113)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dProjectLocal()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
SST_Vec3d y; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = -9.0000000000000000;
|
|
x.v[1] = 4.0000000000000000;
|
|
x.v[2] = 10.0000000000000000;
|
|
y.v[0] = 17.0000000000000000;
|
|
y.v[1] = 0.0000000000000000;
|
|
y.v[2] = -12.0000000000000000;
|
|
/*
|
|
[ -9. 4. 10.]
|
|
[ 17. 0. -12.]
|
|
[-10.7182448 -0. 7.56581986]
|
|
*/
|
|
SST_Math_Vec3dProjectLocal(&x,&y); /* for accuracy */
|
|
TASSERT(fabs((x.v[0])-( -10.7182448036951499)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((x.v[1])-( -0.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((x.v[2])-( 7.5658198614318710)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dCross()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
SST_Vec3d y; /* 3 vector */
|
|
SST_Vec3d w; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = -14.0000000000000000;
|
|
x.v[1] = -5.0000000000000000;
|
|
x.v[2] = 14.0000000000000000;
|
|
y.v[0] = 0.0000000000000000;
|
|
y.v[1] = -15.0000000000000000;
|
|
y.v[2] = 8.0000000000000000;
|
|
w.v[0] = 0.0000000000000000;
|
|
w.v[1] = 0.0000000000000000;
|
|
w.v[2] = 0.0000000000000000;
|
|
/*
|
|
[-14. -5. 14.]
|
|
[ 0. -15. 8.]
|
|
[ 170. 112. 210.]
|
|
*/
|
|
SST_Math_Vec3dCross(&x,&y,&w);
|
|
TASSERT(fabs((w.v[0])-( 170.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((w.v[1])-( 112.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((w.v[2])-( 210.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dCrossLocal()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
SST_Vec3d y; /* 3 vector */
|
|
/* Resetting test vectors */
|
|
x.v[0] = 17.0000000000000000;
|
|
x.v[1] = 7.0000000000000000;
|
|
x.v[2] = 8.0000000000000000;
|
|
y.v[0] = -5.0000000000000000;
|
|
y.v[1] = 11.0000000000000000;
|
|
y.v[2] = 2.0000000000000000;
|
|
/*
|
|
[ 17. 7. 8.]
|
|
[ -5. 11. 2.]
|
|
[ -74. -74. 222.]
|
|
*/
|
|
SST_Math_Vec3dCrossLocal(&x,&y); /* for accuracy */
|
|
TASSERT(fabs((x.v[0])-( -74.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((x.v[1])-( -74.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((x.v[2])-( 222.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dRotateAbout()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
SST_Vec3d y; /* 3 vector */
|
|
SST_Vec3d w; /* 3 vector */
|
|
x.v[0] = 1.0000000000000000;
|
|
x.v[1] = 0.0000000000000000;
|
|
x.v[2] = 0.0000000000000000;
|
|
y.v[0] = 0.0000000000000000;
|
|
y.v[1] = 0.0000000000000000;
|
|
y.v[2] = 1.0000000000000000;
|
|
/*
|
|
[ 1. 0. 0.]
|
|
[ 0. 0. 1.]
|
|
[ 0. 1. 0.]
|
|
*/
|
|
SST_Math_Vec3dRotateAbout(&x,&y, 1.5707963267948966,&w);
|
|
TASSERT(fabs((w.v[0])-( 0.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((w.v[1])-( 1.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((w.v[2])-( 0.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dRotateAboutLocal()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
SST_Vec3d y; /* 3 vector */
|
|
x.v[0] = 1.0000000000000000;
|
|
x.v[1] = 0.0000000000000000;
|
|
x.v[2] = 0.0000000000000000;
|
|
y.v[0] = 0.0000000000000000;
|
|
y.v[1] = 0.0000000000000000;
|
|
y.v[2] = 1.0000000000000000;
|
|
/*
|
|
[ 1. 0. 0.]
|
|
[ 0. 0. 1.]
|
|
[ 0. 1. 0.]
|
|
*/
|
|
SST_Math_Vec3dRotateAboutLocal(&x,&y, 1.5707963267948966);
|
|
TASSERT(fabs((x.v[0])-( 0.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _x failed!");
|
|
TASSERT(fabs((x.v[1])-( 1.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _y failed!");
|
|
TASSERT(fabs((x.v[2])-( 0.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Entry _z failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dMagnitude()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
double a; /* scalar */
|
|
/* Resetting test vectors */
|
|
x.v[0] = -10.0000000000000000;
|
|
x.v[1] = 14.0000000000000000;
|
|
x.v[2] = -1.0000000000000000;
|
|
/*
|
|
[-10. 14. -1.]
|
|
17.2336879396
|
|
*/
|
|
a = SST_Math_Vec3dMagnitude(&x);
|
|
TASSERT(fabs((a)-( 17.2336879396140858)) <=100*DBL_EPSILON /* yes this is bad */,"Magnitude failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dMagnitudeSquared()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
double a; /* scalar */
|
|
/* Resetting test vectors */
|
|
x.v[0] = 0.0000000000000000;
|
|
x.v[1] = -11.0000000000000000;
|
|
x.v[2] = -20.0000000000000000;
|
|
/*
|
|
[ 0. -11. -20.]
|
|
521.0
|
|
*/
|
|
a = SST_Math_Vec3dMagnitudeSquared(&x);
|
|
TASSERT(fabs((a)-( 521.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"MagnitudeSquared failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
static const char* testSST_Math_Vec3dDot()
|
|
{
|
|
SST_Vec3d x; /* 3 vector */
|
|
SST_Vec3d y; /* 3 vector */
|
|
double a; /* scalar */
|
|
/* Resetting test vectors */
|
|
x.v[0] = 10.0000000000000000;
|
|
x.v[1] = 4.0000000000000000;
|
|
x.v[2] = -17.0000000000000000;
|
|
y.v[0] = -6.0000000000000000;
|
|
y.v[1] = -16.0000000000000000;
|
|
y.v[2] = -6.0000000000000000;
|
|
/*
|
|
[ 10. 4. -17.]
|
|
-22.0
|
|
*/
|
|
a = SST_Math_Vec3dDot(&x,&y);
|
|
TASSERT(fabs((a)-( -22.0000000000000000)) <=100*DBL_EPSILON /* yes this is bad */,"Dot failed!");
|
|
return ZTEST_SUCCESS;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|