/****************************************************************************/
/* Copyright (c) 2000 MBARI                                                 */
/* MBARI Proprietary Information. All rights reserved.                      */
/****************************************************************************/
/* Summary  :                                                               */
/* Filename : matrixMath.h                                                  */
/* Author   :                                                               */
/* Project  :                                                               */
/* Version  : 1.0                                                           */
/* Created  : 02/22/2000                                                    */
/* Modified :                                                               */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/****************************************************************************/
/*
** PURPOSE: Perform simple matrix math such as vector addition, cross-product,
**          matrix multiply, etc.
** AUTHOR:  Rob McEwen
** DATE:    99/7/7
** NOTES:   1) All vectors and matrices are assumed to have dimension 3.  
**
*/
#ifdef __cplusplus
extern "C" {
#endif

#include <math.h>
#ifndef MATRIXMATH
#define MATRIXMATH
#define DIM 3
/*
** Take the standard 2-norm. This one returns the answer, since it is a scalar.
*/
double Vnorm( double v[] );
/*
** vsum = v1 + v2.  
*/
void Vadd( double vsum[], double v1[], double v2[] );
/*
** vcross = v1 x v2.  
*/
void Vcross( double vcross[], double v1[], double v2[] );
/*
** v_B = T_B_A * v_A
*/
void TVMult( double v_B[], double T_B_A[DIM][DIM], double v_A[] );
/*
** T_B_A = T_A_B'
*/
void TTransp( double T_B_A[DIM][DIM], double T_A_B[DIM][DIM] );
/*
** T_C_A = T_C_B * T_B_A
*/
void TTMult( double T_C_A[DIM][DIM], 
	     double T_C_B[DIM][DIM], 
	     double T_B_A[DIM][DIM] );
/*
** T_B_A is a direction cosine matrix that recoordinatizes a vector from the
** A frame into the B frame.  B is displaced from A by a right-handed rotation
** about the x axis.
*/
void TRoll( double T_B_A[DIM][DIM], double roll );
#ifdef __cplusplus
}
#endif

#endif
