/***************************************************************************** Include file for CS480 Program 2 ****************************************************************************** Author: Stan Sclaroff Boston University Computer Science Dept. February 15, 1995 ****************************************************************************** Modifications: ******************************************************************************/ typedef struct { int n_points,n_polygons; float *points; int *polygon_table; float center[3]; short color[3]; float min[3]; float max[3]; } Polygon; typedef struct { float xmin,ymin,xmax,ymax; float aspect_ratio; short color[3]; } Frame; static short RGByellow[3] = {255,255,0}; static short RGBred[3] = {255,0,0}; static short RGBgreen[3] = {0,255,0}; static short RGBblue[3] = {0,0,255}; static short RGBblack[3] = {0,0,0}; static short RGBwhite[3] = {255,255,255}; void close_window(),free_frame(),free_polygon_object(); void activate_sliders(),setup_sliders(),activate_forms(); Device get_event(); long open_window(); Polygon *create_polygon_object(),*read_osu_polygons(); Frame *create_frame(); #define PI 3.14159265358979323846 #define BIG_FLOAT 100000000.0 #define SCREEN_WIDTH 768 #define SCREEN_HEIGHT 512 #define FRAME_XMIN 32.0 #define FRAME_XMAX (SCREEN_WIDTH - FRAME_XMIN) #define FRAME_YMIN 32.0 #define FRAME_YMAX (SCREEN_HEIGHT - FRAME_YMIN) #define CROSS_PRODUCT(R,A,B) (R)[0] = (A)[1]*(B)[2] - (A)[2]*(B)[1] ; \ (R)[1] = (A)[2]*(B)[0] - (A)[0]*(B)[2] ; \ (R)[2] = (A)[0]*(B)[1] - (A)[1]*(B)[0] #define VECTOR_SUBTRACT_3D(R,A,B) (R)[0] = (A)[0] - (B)[0]; \ (R)[1] = (A)[1] - (B)[1]; \ (R)[2] = (A)[2] - (B)[2]; #define LENGTH_3D(A) (sqrt(DOT_PRODUCT_3D((A),(A)))) #define SCALE_VECTOR_3D(V,S) (V)[0] *= S;(V)[1] *= S;(V)[2] *= S #define DOT_PRODUCT_3D(A,B) ((A)[0]*(B)[0] + (A)[1]*(B)[1] + (A)[2]*(B)[2]) #define COPY_VECTOR_3D(A,B) (A)[0]=(B)[0];(A)[1]=(B)[1];(A)[2]=(B)[2] #define MATRIX_MULT_VECTOR_4x4(R,M,V) \ (R)[0] = (M)[0][0]*V[0] + (M)[0][1]*V[1] + (M)[0][2]*V[2] + (M)[0][3]*V[3]; \ (R)[1] = (M)[1][0]*V[0] + (M)[1][1]*V[1] + (M)[1][2]*V[2] + (M)[1][3]*V[3]; \ (R)[2] = (M)[2][0]*V[0] + (M)[2][1]*V[1] + (M)[2][2]*V[2] + (M)[2][3]*V[3]; \ (R)[3] = (M)[3][0]*V[0] + (M)[3][1]*V[1] + (M)[3][2]*V[2] + (M)[3][3]*V[3]