Mail Archives: djgpp/1996/11/30/12:58:46
On Thu, 28 Nov 1996 23:46:11 GMT mert0407 AT sable DOT ox DOT ac DOT uk (George Foot)
writes:
>Other than that, I can't see any errors. Posting the typedef, struct
>and variable declarations would be helpful.
I've been working on this, and the problem just seems to get
stranger and stranger...
struct vector {
fixed32 x; // fixed32 is just a typedef for 'long'
fixed32 y;
fixed32 z;
};
typedef fixed32 matrix[4][4];
void xform_vector(matrix m, vector svect, vector *result)
// this multiplies matrix 'm' with vector 'svect', putting the
result in 'result'
{
// I think I managed to isolate the problem, but this is really weird...
I have all the real // code commented out, and have just one of the below
lines uncommmented...
// result->y = m[1][3]; // this will cause a page fault
// result->x = m[1][3]; // but this won't
// It seems totally illogical that trying to access an element of the
matrix with one // // variable works, but with the other causes a page
fault.
/*
result->x = FixedMul(m[0][0], svect.x) +
FixedMul(m[0][1], svect.y) +
FixedMul(m[0][2], svect.z) +
m[0][3];
result->y = FixedMul(m[1][0], svect.x) +
FixedMul(m[1][1], svect.y) +
FixedMul(m[1][2], svect.z) +
m[1][3];
result->z = FixedMul(m[2][0], svect.x) +
FixedMul(m[2][1], svect.y) +
FixedMul(m[2][2], svect.z) +
m[2][3];
*/
}
- Raw text -