#ifndef GEO_STD_H
#define GEO_STD_H

#define PI 3.141592653
#define REAL double
#define sign(x) ((x>=0) ? 1.0 : -1.0)
/*! 
 * @file geo_std.h
 * @brief standard geometric functions. 
 *         suehiro notation for matrix is changed to normal notation
 * @date 2003.11.3
 * Copyright 2003 Takashi Suehiro
 */
typedef REAL VECTOR[3];
typedef REAL MATRIX[3][3];
typedef struct {MATRIX mtr; VECTOR vtr;} FRAME;
//! assignment of vector v1 to v2
void v_ass(VECTOR v1,VECTOR v2);
//! v1 + v2 => v3
void v_add(VECTOR v1,VECTOR v2,VECTOR v3);
//! v1 - v2 => v3
void v_sub(VECTOR v1,VECTOR v2,VECTOR v3);
//! inner product
REAL v_dot(VECTOR v1,VECTOR v2);
//! outer product v1 * v2 => v3. temp vector is used,
//  so v1 or v2 can be same as v3.
void v_cross(VECTOR v1,VECTOR v2,VECTOR v3);
//!
void sv_mul(REAL sc, VECTOR v1, VECTOR v2);
void m_ass(MATRIX m1,MATRIX m2);
void m_mul(MATRIX m1,MATRIX m2,MATRIX m3);
void sm_mul(REAL sc,MATRIX m1, MATRIX m2);
void m_trans(MATRIX m1,MATRIX m2);
/*
S_MATRIX *m_inv(S_MATRIX m1,m2);
*/
void mv_mul(MATRIX m1, VECTOR v1,VECTOR v2);
void m_vec(int cl, MATRIX mx, VECTOR vec);
void make_rot(REAL ang, VECTOR axis, MATRIX mtr);
REAL rot_axis(MATRIX mtr, VECTOR axis);
REAL arctan2(REAL y,REAL x);
void make_frame(MATRIX fig, VECTOR pos, FRAME& frm);
void f_mul(FRAME& f1, FRAME& f2, FRAME& f3);
void f_inv(FRAME& f1, FRAME& f2);
void f_ass(FRAME& f1, FRAME& f2);
//!
int ma(REAL a, MATRIX mx);
//! 
int mb(REAL b, MATRIX mx);
//! 
int mc(REAL c, MATRIX mx);
//!
int mabc(MATRIX mx, REAL abc[3]);

#endif
