#ifndef GRAFIX_H #define GRAFIX_H // GGGG RRRR AAA FFFFF III X X H H // G R R A A F I X X H H // G GGG RRRR AAAAA FFFF I X HHHHH // G G R R A A F I X X .. H H // GGG R R A A F III X X .. H H /* g r a f i x . h DAHarrod 10-Feb-90 ** ** Copyright (c) 1990,1994 by WIZ WORX (DAHarrod) - Concord, MA ** Copyright (c) 2010 by Dennette@WiZ-WORX.com - Washington, DC */ /* WIZ WORX specific macros & functions */ #define GRAFIX "grafix.tmp" #define TRUE (1) #define FALSE (0) #define DN (1) #define UP (0) #define PLOT(p,x,y) if((p)==UP)move((x),(y));else draw((x),(y)) #define MOVDRW(p,x,y) if((p)==UP)move3d((x),(y),0.0);else draw3d((x),(y),0.0) #define MOVDRW3D(p,x,y,z) if((p)==UP)move3d((x),(y),(z));else draw3d((x),(y),(z)) // metric conversions #define IN_SCL ((double)1.0) #define MM_SCL ((double)0.03937) // number of segments per inch for curve sketching #define DSHCNT ((double)64.0) #define DSHSEG ((double)0.015625) /* 1/64th */ //#define DSHCNT ((double)16.0) //#define DSHSEG ((double)0.06125) /* 1/16th */ #define arc(x,y,r,s,t) drawarc((x),(y),(r),(s),(t)) #define circle(x,y,r) drawarc((x),(y),(r),0.0,0.0) // generic math macros ... BASIC mnemonics #define SGN(v) ((v)?((v)/fabs((double)(v))):(v)) #define SQR(n) ((n)*(n)) #define AMODF(x,y) fabs(modf((double)(x),(y))) #define CMD(b) (!strcmp(cmd,(b))) #define OPT(b) (strstr(opt,(b))!=NULL) /* mathemagical constants */ #define ZERO ((double)0.00001) #define PI ((double)3.1415926535897932384626433832795) #define TWOPI ((double)6.283185307179586476925286766558) #define HALFPI ((double)1.5707963267948966192313216916395) #define R2D ((double)57.2957795130823208767981548141143) #define D2R ((double)0.0174532925199432957692369076848833) #define H2D ((double)15.0) /* hours to degrees */ #define HRS2RAD(g) (H2D*D2R*(g)) /* hours to radians */ #define DEG2RAD(g) (D2R*(g)) #define RAD2DEG(g) (R2D*(g)) #define MM2INCH(n) (n*MM_SCL) #define INCH2MM(n) (n/MM_SCL) // HPGL plotter units are (1 inch == 1016 pixels == 2.54 cm) // && (1 pixel == 4 mm) #define HPSCALE ((double)1016.0) #define PLSCALE (HPSCALE*pltscale) // print window is 7.9 by 5.75 inches ... screen or plotter //#define PWIDTH 5.75 //#define PHEIGHT 7.90 //#define SCLHEIGHT (ps_half ? 3.75 : 7.90) //#define SKOSH (1.0/PLSCALE) // 2007-03-29 DAH resized to 8.0 by 6.0 for 800x600 pixel conversion #define PWIDTH 6.00 #define PHEIGHT 8.00 #define SCLHEIGHT (ps_half ? 4.0 : 8.0) #define SKOSH (1.0/PLSCALE) /* WiZ WORX line types and colors */ #define SOLID 1 /* line types */ #define DASHED 2 #define PHANTOM 3 #define CENTERLINE 4 #define DOTTED 5 #define BLANKED -1 // note: palette originally from DEC Rainbow 100 PC #define BLACK 0 /* colors */ #define RED 14 #define GREEN 1 #define BLUE 9 #define CYAN 4 #define MAGENTA 5 #define YELLOW 6 #define WHITE 7 #define DK_GRAY 8 #define BROWN 3 #define DK_GREEN 10 #define SKY_BLUE 11 #define FLESH 12 #define PURPLE 13 #define ORANGE 2 #define GRAY 15 #define NOCOLOR -1 /* IGES line types and colors */ #define I_NOLFONT 0 /* line types */ #define I_SOLID 1 #define I_DASHED 2 #define I_PHANTOM 3 #define I_CENTERLINE 4 #define I_DOTTED 5 #define I_NOCOLOR 0 /* colors */ #define I_BLACK 1 #define I_RED 2 #define I_GREEN 3 #define I_BLUE 4 #define I_CYAN 7 #define I_MAGENTA 6 #define I_YELLOW 5 #define I_WHITE 8 /* HP line types and colors */ #define H_SOLID 0 /* line types */ #define H_DASHED 2 #define H_PHANTOM 6 #define H_CENTERLINE 5 #define H_DOTTED 1 #define H_LT3 3 #define H_LT4 4 #define H_LT7 7 #define H_LT8 8 #define H_NOCOLOR 9 /* colors */ #define H_BLACK 1 #define H_RED 2 #define H_GREEN 3 /* #define H_YELLOW 4 #define H_BLUE 5 #define H_MAGENTA 6 #define H_CYAN 7 */ #define H_YELLOW 5 #define H_BLUE 4 #define H_MAGENTA 7 #define H_CYAN 6 #define H_WHITE 0 #endif