* This file contains routines that operate solely on matrices.
* -------------------------------------------------------------------------*/
-#include "mat3defs.h"
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifdef WIN32
+# include <memory.h> /* required for memset() and memcpy() */
+#endif
+
+#include <string.h>
+#include <Math/mat3defs.h>
+
+#define USE_MEM
/* #include "macros.h" */
/* -------------------------- Public Routines ---------------------------- */
+#if !defined( USE_XTRA_MAT3_INLINES )
+
/*
* Sets a matrix to identity.
*/
{
register int i;
+#ifdef USE_MEM /* WIN32 */
+ memset(mat, 0x00, sizeof(MAT3mat));
+#else
bzero (mat, sizeof(MAT3mat));
+#endif
+
for (i = 0; i < 4; i++)
mat[i][i] = 1.0;
}
void
MAT3zero (MAT3mat mat)
{
+#ifdef USE_MEM /* WIN32 */
+ memset(mat,0x00, sizeof(MAT3mat));
+#else
bzero (mat, sizeof(MAT3mat));
+#endif
}
void
MAT3copy(MAT3mat to, MAT3mat from)
{
- bcopy (from, to, sizeof(MAT3mat));
+#ifdef USE_MEM /* WIN32 */
+ memcpy(to, from, sizeof(MAT3mat));
+#else
+ bcopy(from, to, sizeof(MAT3mat));
+#endif
}
/*
*/
void
-MAT3mult (result_mat, mat1, mat2)
-MAT3mat result_mat;
-register MAT3mat mat1, mat2;
+MAT3mult (double (*result_mat)[4], register double (*mat1)[4], register double (*mat2)[4])
{
register int i, j;
MAT3mat tmp_mat;
mat1[i][3] * mat2[3][j]);
MAT3copy (result_mat, tmp_mat);
}
+#endif // !defined( USE_XTRA_MAT3_INLINES )
/*
* This returns the transpose of a matrix. The result matrix may be
*/
void
-MAT3transpose (result_mat, mat)
-MAT3mat result_mat;
-register MAT3mat mat;
+MAT3transpose (double (*result_mat)[4], register double (*mat)[4])
{
register int i, j;
MAT3mat tmp_mat;
*/
void
-MAT3print(mat, fp)
-MAT3mat mat;
-FILE *fp;
+MAT3print(double (*mat)[4], FILE *fp)
{
MAT3print_formatted(mat, fp, CNULL, CNULL, CNULL, CNULL);
}
*/
void
-MAT3print_formatted(mat, fp, title, head, format, tail)
-MAT3mat mat;
-FILE *fp;
-char *title, *head, *format, *tail;
+MAT3print_formatted(double (*mat)[4], FILE *fp, char *title, char *head, char *format, char *tail)
{
register int i, j;