remove mathutils internal variable for storing pointers to each matrix row, instead use macros to access row/column's.

also add an assert so invalid index access will raise an error in debug mode, without this it was quite easy to access invalid memory without meaning to.

no functional change.
This commit is contained in:
2011-12-19 03:12:10 +00:00
parent d0aa012b0a
commit c3675c0e90
3 changed files with 54 additions and 53 deletions

View File

@@ -1487,7 +1487,7 @@ int column_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject* vec,
for (x = 0; x < mat->col_size; x++) {
for (y = 0; y < mat->row_size; y++) {
dot += (double)(mat->matrix[y][x] * vec_cpy[y]);
dot += (double)(MATRIX_ITEM(mat, y, x) * vec_cpy[y]);
}
rvec[z++] = (float)dot;
dot = 0.0f;
@@ -2610,7 +2610,7 @@ static int row_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject *v
//muliplication
for (x = 0; x < mat->row_size; x++) {
for (y = 0; y < mat->col_size; y++) {
dot += mat->matrix[x][y] * vec_cpy[y];
dot += MATRIX_ITEM(mat, x, y) * vec_cpy[y];
}
rvec[z++] = (float)dot;
dot = 0.0f;