Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make double the default precision throughout

  • Loading branch information...
commit e1e4c38b6ee59e628103c7e5be4c30ffdcbfe8e5 1 parent 5f50af5
Luke Benstead authored
View
34 kazmath/mat3.c
@@ -41,7 +41,7 @@ kmMat3* const kmMat3Fill(kmMat3* pOut, const kmScalar* pMat)
/** Sets pOut to an identity matrix returns pOut*/
kmMat3* const kmMat3Identity(kmMat3* pOut)
{
- memset(pOut->mat, 0, sizeof(float) * 9);
+ memset(pOut->mat, 0, sizeof(kmScalar) * 9);
pOut->mat[0] = pOut->mat[4] = pOut->mat[8] = 1.0f;
return pOut;
}
@@ -101,11 +101,11 @@ kmMat3* const kmMat3Inverse(kmMat3* pOut, const kmScalar pDeterminate, const kmM
/** Returns true if pIn is an identity matrix */
const int kmMat3IsIdentity(const kmMat3* pIn)
{
- static const float identity [] = { 1.0f, 0.0f, 0.0f,
+ static const kmScalar identity [] = { 1.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 1.0f};
- return (memcmp(identity, pIn->mat, sizeof(float) * 9) == 0);
+ return (memcmp(identity, pIn->mat, sizeof(kmScalar) * 9) == 0);
}
/** Sets pOut to the transpose of pIn, returns pOut */
@@ -124,9 +124,9 @@ kmMat3* const kmMat3Transpose(kmMat3* pOut, const kmMat3* pIn)
/* Multiplies pM1 with pM2, stores the result in pOut, returns pOut */
kmMat3* const kmMat3Multiply(kmMat3* pOut, const kmMat3* pM1, const kmMat3* pM2)
{
- float mat[9];
+ kmScalar mat[9];
- const float *m1 = pM1->mat, *m2 = pM2->mat;
+ const kmScalar *m1 = pM1->mat, *m2 = pM2->mat;
mat[0] = m1[0] * m2[0] + m1[3] * m2[1] + m1[6] * m2[2];
mat[1] = m1[1] * m2[0] + m1[4] * m2[1] + m1[7] * m2[2];
@@ -140,14 +140,14 @@ kmMat3* const kmMat3Multiply(kmMat3* pOut, const kmMat3* pM1, const kmMat3* pM2)
mat[7] = m1[1] * m2[6] + m1[4] * m2[7] + m1[7] * m2[8];
mat[8] = m1[2] * m2[6] + m1[5] * m2[7] + m1[8] * m2[8];
- memcpy(pOut->mat, mat, sizeof(float)*9);
+ memcpy(pOut->mat, mat, sizeof(kmScalar)*9);
return pOut;
}
kmMat3* const kmMat3ScalarMultiply(kmMat3* pOut, const kmMat3* pM, const kmScalar pFactor)
{
- float mat[9];
+ kmScalar mat[9];
int i;
for(i = 0; i < 9; i++)
@@ -155,7 +155,7 @@ kmMat3* const kmMat3ScalarMultiply(kmMat3* pOut, const kmMat3* pM, const kmScala
mat[i] = pM->mat[i] * pFactor;
}
- memcpy(pOut->mat, mat, sizeof(float)*9);
+ memcpy(pOut->mat, mat, sizeof(kmScalar)*9);
return pOut;
}
@@ -165,7 +165,7 @@ kmMat3* const kmMat3Assign(kmMat3* pOut, const kmMat3* pIn)
{
assert(pOut != pIn); //You have tried to self-assign!!
- memcpy(pOut->mat, pIn->mat, sizeof(float)*9);
+ memcpy(pOut->mat, pIn->mat, sizeof(kmScalar)*9);
return pOut;
}
@@ -189,7 +189,7 @@ const int kmMat3AreEqual(const kmMat3* pMat1, const kmMat3* pMat2)
}
/* Rotation around the z axis so everything stays planar in XY */
-kmMat3* const kmMat3Rotation(kmMat3* pOut, const float radians)
+kmMat3* const kmMat3Rotation(kmMat3* pOut, const kmScalar radians)
{
/*
| cos(A) -sin(A) 0 |
@@ -215,7 +215,7 @@ kmMat3* const kmMat3Rotation(kmMat3* pOut, const float radians)
/** Builds a scaling matrix */
kmMat3* const kmMat3Scaling(kmMat3* pOut, const kmScalar x, const kmScalar y)
{
-// memset(pOut->mat, 0, sizeof(float) * 9);
+// memset(pOut->mat, 0, sizeof(kmScalar) * 9);
kmMat3Identity(pOut);
pOut->mat[0] = x;
pOut->mat[4] = y;
@@ -225,7 +225,7 @@ kmMat3* const kmMat3Scaling(kmMat3* pOut, const kmScalar x, const kmScalar y)
kmMat3* const kmMat3Translation(kmMat3* pOut, const kmScalar x, const kmScalar y)
{
-// memset(pOut->mat, 0, sizeof(float) * 9);
+// memset(pOut->mat, 0, sizeof(kmScalar) * 9);
kmMat3Identity(pOut);
pOut->mat[6] = x;
pOut->mat[7] = y;
@@ -261,8 +261,8 @@ kmMat3* const kmMat3RotationQuaternion(kmMat3* pOut, const kmQuaternion* pIn)
kmMat3* const kmMat3RotationAxisAngle(kmMat3* pOut, const struct kmVec3* axis, kmScalar radians)
{
- float rcos = cosf(radians);
- float rsin = sinf(radians);
+ kmScalar rcos = cosf(radians);
+ kmScalar rsin = sinf(radians);
pOut->mat[0] = rcos + axis->x * axis->x * (1 - rcos);
pOut->mat[1] = axis->z * rsin + axis->y * axis->x * (1 - rcos);
@@ -291,7 +291,7 @@ kmVec3* const kmMat3RotationToAxisAngle(kmVec3* pAxis, kmScalar* radians, const
/**
* Builds an X-axis rotation matrix and stores it in pOut, returns pOut
*/
-kmMat3* const kmMat3RotationX(kmMat3* pOut, const float radians)
+kmMat3* const kmMat3RotationX(kmMat3* pOut, const kmScalar radians)
{
/*
| 1 0 0 |
@@ -319,7 +319,7 @@ kmMat3* const kmMat3RotationX(kmMat3* pOut, const float radians)
* Builds a rotation matrix using the rotation around the Y-axis
* The result is stored in pOut, pOut is returned.
*/
-kmMat3* const kmMat3RotationY(kmMat3* pOut, const float radians)
+kmMat3* const kmMat3RotationY(kmMat3* pOut, const kmScalar radians)
{
/*
| cos(A) 0 sin(A) |
@@ -346,7 +346,7 @@ kmMat3* const kmMat3RotationY(kmMat3* pOut, const float radians)
* Builds a rotation matrix around the Z-axis. The resulting
* matrix is stored in pOut. pOut is returned.
*/
-kmMat3* const kmMat3RotationZ(kmMat3* pOut, const float radians)
+kmMat3* const kmMat3RotationZ(kmMat3* pOut, const kmScalar radians)
{
/*
| cos(A) -sin(A) 0 |
View
60 kazmath/mat4.c
@@ -39,9 +39,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/**
* Fills a kmMat4 structure with the values from a 16
- * element array of floats
+ * element array of kmScalars
* @Params pOut - A pointer to the destination matrix
- * pMat - A 16 element array of floats
+ * pMat - A 16 element array of kmScalars
* @Return Returns pOut so that the call can be nested
*/
kmMat4* const kmMat4Fill(kmMat4* pOut, const kmScalar* pMat)
@@ -57,25 +57,25 @@ kmMat4* const kmMat4Fill(kmMat4* pOut, const kmScalar* pMat)
*/
kmMat4* const kmMat4Identity(kmMat4* pOut)
{
- memset(pOut->mat, 0, sizeof(float) * 16);
+ memset(pOut->mat, 0, sizeof(kmScalar) * 16);
pOut->mat[0] = pOut->mat[5] = pOut->mat[10] = pOut->mat[15] = 1.0f;
return pOut;
}
-float get(const kmMat4 * pIn, int row, int col)
+kmScalar get(const kmMat4 * pIn, int row, int col)
{
return pIn->mat[row + 4*col];
}
-void set(kmMat4 * pIn, int row, int col, float value)
+void set(kmMat4 * pIn, int row, int col, kmScalar value)
{
pIn->mat[row + 4*col] = value;
}
void swap(kmMat4 * pIn, int r1, int c1, int r2, int c2)
{
- float tmp = get(pIn,r1,c1);
+ kmScalar tmp = get(pIn,r1,c1);
set(pIn,r1,c1,get(pIn,r2,c2));
set(pIn,r2,c2, tmp);
}
@@ -84,7 +84,7 @@ void swap(kmMat4 * pIn, int r1, int c1, int r2, int c2)
int gaussj(kmMat4 *a, kmMat4 *b)
{
int i, icol = 0, irow = 0, j, k, l, ll, n = 4, m = 4;
- float big, dum, pivinv;
+ kmScalar big, dum, pivinv;
int indxc[n];
int indxr[n];
int ipiv[n];
@@ -183,13 +183,13 @@ kmMat4* const kmMat4Inverse(kmMat4* pOut, const kmMat4* pM)
*/
const int kmMat4IsIdentity(const kmMat4* pIn)
{
- static const float identity [] = { 1.0f, 0.0f, 0.0f, 0.0f,
+ static const kmScalar identity [] = { 1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f
};
- return (memcmp(identity, pIn->mat, sizeof(float) * 16) == 0);
+ return (memcmp(identity, pIn->mat, sizeof(kmScalar) * 16) == 0);
}
/**
@@ -213,9 +213,9 @@ kmMat4* const kmMat4Transpose(kmMat4* pOut, const kmMat4* pIn)
*/
kmMat4* const kmMat4Multiply(kmMat4* pOut, const kmMat4* pM1, const kmMat4* pM2)
{
- float mat[16];
+ kmScalar mat[16];
- const float *m1 = pM1->mat, *m2 = pM2->mat;
+ const kmScalar *m1 = pM1->mat, *m2 = pM2->mat;
mat[0] = m1[0] * m2[0] + m1[4] * m2[1] + m1[8] * m2[2] + m1[12] * m2[3];
mat[1] = m1[1] * m2[0] + m1[5] * m2[1] + m1[9] * m2[2] + m1[13] * m2[3];
@@ -238,7 +238,7 @@ kmMat4* const kmMat4Multiply(kmMat4* pOut, const kmMat4* pM1, const kmMat4* pM2)
mat[15] = m1[3] * m2[12] + m1[7] * m2[13] + m1[11] * m2[14] + m1[15] * m2[15];
- memcpy(pOut->mat, mat, sizeof(float)*16);
+ memcpy(pOut->mat, mat, sizeof(kmScalar)*16);
return pOut;
}
@@ -250,7 +250,7 @@ kmMat4* const kmMat4Assign(kmMat4* pOut, const kmMat4* pIn)
{
assert(pOut != pIn && "You have tried to self-assign!!");
- memcpy(pOut->mat, pIn->mat, sizeof(float)*16);
+ memcpy(pOut->mat, pIn->mat, sizeof(kmScalar)*16);
return pOut;
}
@@ -281,8 +281,8 @@ const int kmMat4AreEqual(const kmMat4* pMat1, const kmMat4* pMat2)
*/
kmMat4* const kmMat4RotationAxisAngle(kmMat4* pOut, const kmVec3* axis, kmScalar radians)
{
- float rcos = cosf(radians);
- float rsin = sinf(radians);
+ kmScalar rcos = cosf(radians);
+ kmScalar rsin = sinf(radians);
kmVec3 normalizedAxis;
kmVec3Normalize(&normalizedAxis, axis);
@@ -313,7 +313,7 @@ kmMat4* const kmMat4RotationAxisAngle(kmMat4* pOut, const kmVec3* axis, kmScalar
/**
* Builds an X-axis rotation matrix and stores it in pOut, returns pOut
*/
-kmMat4* const kmMat4RotationX(kmMat4* pOut, const float radians)
+kmMat4* const kmMat4RotationX(kmMat4* pOut, const kmScalar radians)
{
/*
| 1 0 0 0 |
@@ -350,7 +350,7 @@ kmMat4* const kmMat4RotationX(kmMat4* pOut, const float radians)
* Builds a rotation matrix using the rotation around the Y-axis
* The result is stored in pOut, pOut is returned.
*/
-kmMat4* const kmMat4RotationY(kmMat4* pOut, const float radians)
+kmMat4* const kmMat4RotationY(kmMat4* pOut, const kmScalar radians)
{
/*
| cos(A) 0 sin(A) 0 |
@@ -386,7 +386,7 @@ kmMat4* const kmMat4RotationY(kmMat4* pOut, const float radians)
* Builds a rotation matrix around the Z-axis. The resulting
* matrix is stored in pOut. pOut is returned.
*/
-kmMat4* const kmMat4RotationZ(kmMat4* pOut, const float radians)
+kmMat4* const kmMat4RotationZ(kmMat4* pOut, const kmScalar radians)
{
/*
| cos(A) -sin(A) 0 0 |
@@ -456,15 +456,15 @@ kmMat4* const kmMat4RotationPitchYawRoll(kmMat4* pOut, const kmScalar pitch, con
*/
kmMat4* const kmMat4RotationQuaternion(kmMat4* pOut, const kmQuaternion* pQ)
{
- float x2 = pQ->x * pQ->x;
- float y2 = pQ->y * pQ->y;
- float z2 = pQ->z * pQ->z;
- float xy = pQ->x * pQ->y;
- float xz = pQ->x * pQ->z;
- float yz = pQ->y * pQ->z;
- float wx = pQ->w * pQ->x;
- float wy = pQ->w * pQ->y;
- float wz = pQ->w * pQ->z;
+ kmScalar x2 = pQ->x * pQ->x;
+ kmScalar y2 = pQ->y * pQ->y;
+ kmScalar z2 = pQ->z * pQ->z;
+ kmScalar xy = pQ->x * pQ->y;
+ kmScalar xz = pQ->x * pQ->z;
+ kmScalar yz = pQ->y * pQ->z;
+ kmScalar wx = pQ->w * pQ->x;
+ kmScalar wy = pQ->w * pQ->y;
+ kmScalar wz = pQ->w * pQ->z;
pOut->mat[0] = 1.0f - 2.0f * (y2 + z2);
pOut->mat[1] = 2.0f * (xy - wz);
@@ -496,7 +496,7 @@ kmMat4* const kmMat4RotationQuaternion(kmMat4* pOut, const kmQuaternion* pQ)
kmMat4* const kmMat4Scaling(kmMat4* pOut, const kmScalar x, const kmScalar y,
const kmScalar z)
{
- memset(pOut->mat, 0, sizeof(float) * 16);
+ memset(pOut->mat, 0, sizeof(kmScalar) * 16);
pOut->mat[0] = x;
pOut->mat[5] = y;
pOut->mat[10] = z;
@@ -513,7 +513,7 @@ kmMat4* const kmMat4Translation(kmMat4* pOut, const kmScalar x,
const kmScalar y, const kmScalar z)
{
//FIXME: Write a test for this
- memset(pOut->mat, 0, sizeof(float) * 16);
+ memset(pOut->mat, 0, sizeof(kmScalar) * 16);
pOut->mat[0] = 1.0f;
pOut->mat[5] = 1.0f;
@@ -733,7 +733,7 @@ kmMat4* const kmMat4RotationTranslation(kmMat4* pOut, const kmMat3* rotation, co
kmPlane* const kmMat4ExtractPlane(kmPlane* pOut, const kmMat4* pIn, const kmEnum plane)
{
- float t = 1.0f;
+ kmScalar t = 1.0f;
switch(plane) {
case KM_PLANE_RIGHT:
View
2  kazmath/plane.c
@@ -163,7 +163,7 @@ const POINT_CLASSIFICATION kmPlaneClassifyPoint(const kmPlane* pIn, const kmVec3
{
// This function will determine if a point is on, in front of, or behind
// the plane. First we store the dot product of the plane and the point.
- float distance = pIn->a * pP->x + pIn->b * pP->y + pIn->c * pP->z + pIn->d;
+ kmScalar distance = pIn->a * pP->x + pIn->b * pP->y + pIn->c * pP->z + pIn->d;
// Simply put if the dot product is greater than 0 then it is infront of it.
// If it is less than 0 then it is behind it. And if it is 0 then it is on it.
View
30 kazmath/quaternion.c
@@ -204,11 +204,11 @@ taken from the Matrix and Quaternion FAQ
}
*/
- float x, y, z, w;
- float *pMatrix = NULL;
- float m4x4[16] = {0};
- float scale = 0.0f;
- float diagonal = 0.0f;
+ kmScalar x, y, z, w;
+ kmScalar *pMatrix = NULL;
+ kmScalar m4x4[16] = {0};
+ kmScalar scale = 0.0f;
+ kmScalar diagonal = 0.0f;
if(!pIn) {
return NULL;
@@ -239,7 +239,7 @@ taken from the Matrix and Quaternion FAQ
if(diagonal > kmEpsilon) {
// Calculate the scale of the diagonal
- scale = (float)sqrt(diagonal ) * 2;
+ scale = (kmScalar)sqrt(diagonal ) * 2;
// Calculate the x, y, x and w of the quaternion through the respective equation
x = ( pMatrix[9] - pMatrix[6] ) / scale;
@@ -253,7 +253,7 @@ taken from the Matrix and Quaternion FAQ
if ( pMatrix[0] > pMatrix[5] && pMatrix[0] > pMatrix[10] )
{
// Find the scale according to the first element, and double that value
- scale = (float)sqrt( 1.0f + pMatrix[0] - pMatrix[5] - pMatrix[10] ) * 2.0f;
+ scale = (kmScalar)sqrt( 1.0f + pMatrix[0] - pMatrix[5] - pMatrix[10] ) * 2.0f;
// Calculate the x, y, x and w of the quaternion through the respective equation
x = 0.25f * scale;
@@ -265,7 +265,7 @@ taken from the Matrix and Quaternion FAQ
else if (pMatrix[5] > pMatrix[10])
{
// Find the scale according to the second element, and double that value
- scale = (float)sqrt( 1.0f + pMatrix[5] - pMatrix[0] - pMatrix[10] ) * 2.0f;
+ scale = (kmScalar)sqrt( 1.0f + pMatrix[5] - pMatrix[0] - pMatrix[10] ) * 2.0f;
// Calculate the x, y, x and w of the quaternion through the respective equation
x = (pMatrix[4] + pMatrix[1] ) / scale;
@@ -277,7 +277,7 @@ taken from the Matrix and Quaternion FAQ
else
{
// Find the scale according to the third element, and double that value
- scale = (float)sqrt( 1.0f + pMatrix[10] - pMatrix[0] - pMatrix[5] ) * 2.0f;
+ scale = (kmScalar)sqrt( 1.0f + pMatrix[10] - pMatrix[0] - pMatrix[5] ) * 2.0f;
// Calculate the x, y, x and w of the quaternion through the respective equation
x = (pMatrix[2] + pMatrix[8] ) / scale;
@@ -385,12 +385,12 @@ kmQuaternion* kmQuaternionSlerp(kmQuaternion* pOut,
kmScalar t)
{
- /*float CosTheta = Q0.DotProd(Q1);
- float Theta = acosf(CosTheta);
- float SinTheta = sqrtf(1.0f-CosTheta*CosTheta);
+ /*kmScalar CosTheta = Q0.DotProd(Q1);
+ kmScalar Theta = acosf(CosTheta);
+ kmScalar SinTheta = sqrtf(1.0f-CosTheta*CosTheta);
- float Sin_T_Theta = sinf(T*Theta)/SinTheta;
- float Sin_OneMinusT_Theta = sinf((1.0f-T)*Theta)/SinTheta;
+ kmScalar Sin_T_Theta = sinf(T*Theta)/SinTheta;
+ kmScalar Sin_OneMinusT_Theta = sinf((1.0f-T)*Theta)/SinTheta;
Quaternion Result = Q0*Sin_OneMinusT_Theta;
Result += (Q1*Sin_T_Theta);
@@ -470,7 +470,7 @@ kmQuaternion* kmQuaternionScale(kmQuaternion* pOut,
kmQuaternion* kmQuaternionAssign(kmQuaternion* pOut, const kmQuaternion* pIn)
{
- memcpy(pOut, pIn, sizeof(float) * 4);
+ memcpy(pOut, pIn, sizeof(kmScalar) * 4);
return pOut;
}
View
28 kazmath/ray2.c
@@ -11,27 +11,27 @@ void kmRay2Fill(kmRay2* ray, kmScalar px, kmScalar py, kmScalar vx, kmScalar vy)
kmBool kmRay2IntersectLineSegment(const kmRay2* ray, const kmVec2* p1, const kmVec2* p2, kmVec2* intersection) {
- float x1 = ray->start.x;
- float y1 = ray->start.y;
- float x2 = ray->start.x + ray->dir.x;
- float y2 = ray->start.y + ray->dir.y;
- float x3 = p1->x;
- float y3 = p1->y;
- float x4 = p2->x;
- float y4 = p2->y;
+ kmScalar x1 = ray->start.x;
+ kmScalar y1 = ray->start.y;
+ kmScalar x2 = ray->start.x + ray->dir.x;
+ kmScalar y2 = ray->start.y + ray->dir.y;
+ kmScalar x3 = p1->x;
+ kmScalar y3 = p1->y;
+ kmScalar x4 = p2->x;
+ kmScalar y4 = p2->y;
- float denom = (y4 -y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
+ kmScalar denom = (y4 -y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
//If denom is zero, the lines are parallel
if(denom > -kmEpsilon && denom < kmEpsilon) {
return KM_FALSE;
}
- float ua = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denom;
- float ub = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / denom;
+ kmScalar ua = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denom;
+ kmScalar ub = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / denom;
- float x = x1 + ua * (x2 - x1);
- float y = y1 + ua * (y2 - y1);
+ kmScalar x = x1 + ua * (x2 - x1);
+ kmScalar y = y1 + ua * (y2 - y1);
if(x < min(p1->x, p2->x) - kmEpsilon ||
x > max(p1->x, p2->x) + kmEpsilon ||
@@ -131,7 +131,7 @@ void calculate_line_normal(kmVec2 p1, kmVec2 p2, kmVec2 other_point, kmVec2* nor
n.x = edge.y;
n.y = -edge.x;
- float d = kmVec2Dot(&n, &other_edge);
+ kmScalar d = kmVec2Dot(&n, &other_edge);
if(d > 0.0f) {
n.x = -n.x;
n.y = -n.y;
View
4 kazmath/utility.h
@@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <math.h>
#ifndef kmScalar
-#define kmScalar float
+#define kmScalar double
#endif
#ifndef kmBool
@@ -51,7 +51,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define kmPI 3.141592f
#define kmPIOver180 0.017453f // PI / 180
#define kmPIUnder180 57.295779f // 180 / PI
-#define kmEpsilon 0.00001
+#define kmEpsilon 0.0001
View
4 kazmath/vec2.c
@@ -161,6 +161,10 @@ kmVec2* kmVec2RotateBy(kmVec2* pOut, kmVec2* pIn,
* Returns the angle in degrees between the two vectors
*/
kmScalar kmVec2DegreesBetween(const kmVec2* v1, const kmVec2* v2) {
+ if(kmVec2AreEqual(v1, v2)) {
+ return 0.0;
+ }
+
return kmRadiansToDegrees(acos(kmVec2Dot(v1, v2)));
}
View
6 kazmath/vec2.h
@@ -26,11 +26,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef VEC2_H_INCLUDED
#define VEC2_H_INCLUDED
-struct kmMat3;
+#include "utility.h"
-#ifndef kmScalar
-#define kmScalar float
-#endif
+struct kmMat3;
#pragma pack(push) /* push current alignment to stack */
#pragma pack(1) /* set alignment to 1 byte boundary */
View
5 kazmath/vec3.h
@@ -27,10 +27,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define VEC3_H_INCLUDED
#include <assert.h>
-
-#ifndef kmScalar
-#define kmScalar float
-#endif
+#include "utility.h"
struct kmMat4;
View
2  kazmath/vec4.c
@@ -147,7 +147,7 @@ int kmVec4AreEqual(const kmVec4* p1, const kmVec4* p2) {
kmVec4* kmVec4Assign(kmVec4* pOut, const kmVec4* pIn) {
assert(pOut != pIn);
- memcpy(pOut, pIn, sizeof(float) * 4);
+ memcpy(pOut, pIn, sizeof(kmScalar) * 4);
return pOut;
}
Please sign in to comment.
Something went wrong with that request. Please try again.