#ifndef _MACROS_H_ #define _MACROS_H_ #ifndef PI #define PI 3.141592653589793238462643 #endif typedef struct { float x; float y; float z; } point3d; /* typedef struct { double x; double y; double z; } point3d_double; */ #define CROSSPRODUCT(x1,y1,z1,x2,y2,z2,x,y,z)\ \ x = (y1) * (z2) - (y2) * (z1);\ y = (x2) * (z1) - (x1) * (z2);\ z = (x1) * (y2) - (x2) * (y1) #define CROSSPRODUCT_ADD(x1,y1,z1,x2,y2,z2,x,y,z)\ \ (x) += (y1) * (z2) - (y2) * (z1);\ (y) += (x2) * (z1) - (x1) * (z2);\ (z) += (x1) * (y2) - (x2) * (y1) #define NORMALIZE(x,y,z)\ \ normaLength007 = sqrt((x) * (x) + (y) * (y) + (z) * (z));\ x /= normaLength007;\ y /= normaLength007;\ z /= normaLength007; #define XSTR11(s) STR11(s) #define STR11(s) #s #endif