home *** CD-ROM | disk | FTP | other *** search
- /*
- macros.h
-
- some of the most important stuff in the program
- */
-
- #ifndef MYMATH_H
- # include "MyMath.h"
- #endif
-
- /* returns dot product of two vectors */
- #define DOT(v1,v2) (\
- SPAdd(\
- SPAdd(\
- SPMul(v1.x, v2.x),\
- SPMul(v1.y, v2.y)\
- ),\
- SPMul(v1.z, v2.z)\
- )\
- )
-
-
- /* returns the square of the length of a vector */
- #define LN2(v) (DOT(v,v))
-
-
- /* guess */
- #define LEN(v) SPSqrt(LN2(v))
-
-
- /* returns the component in the xz plane of a vector */
- #define XZL(v) SPSqrt(\
- SPAdd(\
- SPMul(v.x, v.x),\
- SPMul(v.z, v.z)\
- )\
- )
-
-
- /* multiplies a vetor by a scalar */
- #define SCMLT(sc,vct) vct.x = SPMul(vct.x, sc);\
- vct.y = SPMul(vct.y, sc);\
- vct.z = SPMul(vct.z, sc);\
- vct.l = SPMul(vct.l, sc);
-
-
- /* makes a vector. wouldn't need this with c++ */
- #define MV(a,b,c,v) v.x= a;v.y= b;v.z= c;
-
-
- /*subtract vector t=u-v */
- #define SV(t,u,v) t.x=SPSub(v.x, u.x);\
- t.y=SPSub(v.y, u.y);\
- t.z=SPSub(v.z, u.z);
-
-
- /* add vector t=u+v */
- #define AV(t,u,v) t.x=SPAdd(u.x, v.x);\
- t.y=SPAdd(u.y, v.y);\
- t.z=SPAdd(u.z, v.z);
-
-
- /* multiply transpose matrix by vector. v1=m*v2 */
- #define MTV(v1,m,v2) MV( DOT(m.x,v2), DOT(m.y,v2), DOT(m.z,v2), v1)
-
-
- /* levels of recursion */
- #define LEVEL 5
-
- /* don't want as many inside the ball, takes forever as it is */
- #define RLEV 3
-