Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cbosgd!gatech!ut-sally!utastro!jk From: jk@utastro.UUCP (John Krist) Newsgroups: net.micro.16k Subject: DSI-32 : A problem in C - Help! Message-ID: <352@utastro.UUCP> Date: Mon, 10-Feb-86 23:06:35 EST Article-I.D.: utastro.352 Posted: Mon Feb 10 23:06:35 1986 Date-Received: Wed, 12-Feb-86 20:34:41 EST Organization: U. Texas, Astronomy, Austin, TX Lines: 50 Keywords: Just after I posted the last article.... Well, just after I finished with the update article, I began modifying the graphics routines for the DSI-32 virtual graphics library. I decided to substitute the included line drawing routine with the DDA routine show here. After I coded it, I tested it for speed and such just by timing (no pixel mapping routines included, just the calculations). To my suprise, I got the wrong answer. I converted it to fortran and got the right answer, so I tested it on the VAX here, and also got the right answer with the same identical C code - 20001.5. My C gives me 19893.5 ! If anyone out there can run this on there DSI and get the right results, please tell me (I've got the December 1985 dated compilers). Thanks, John Krist {allegra,ihnp4}!{noao,ut-sally}!utastro!jk DDA line drawing code: #include #include main() { float x1,x2,y1,y2,rlength,xinc,yinc,x,y; int i; x1=0.; x2=20000.; y1=0.; y2=20000.; rlength = fabs ( x2-x1 ); if (fabs( y2-y1 ) > rlength ) rlength = fabs ( y2-y1 ); xinc = ( x2-x1 ) / rlength; yinc = ( y2-y1 ) / rlength; x = x1 + .5; y = y1 + .5; while ( i <= rlength ) { x = x + xinc; y = y + yinc; i++; } printf ("%.6f\n",x); }