$if 0 £ŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽù PowerBASIC v3.50 £ŽŽ' DASoft €ŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽƒŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽù ü AŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽã ü DATE: 1998-06-06 €Žù ü ü FILE NAME CIRCLE .BAS § by “¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Ž § § ü ü § Don Schullian, Jr. § § ü “¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¬ d83@ath.forthnet.gr § § ü § § ü Public Domain § § ü § § “¡¥¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¬ § “¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¬ This routine draws a circle or arc with or without a pie wedge. The parameters are the same as the CIRCLE command with one exception: Sdeg% and Edeg% are the starting and ending DEGREEs, not radians. (I don't think in radians!) 0 degree is assumed to be at the top of the circle and they proceed around the circle clockwise (to the right). eg: 90 degrees is EAST, 180 is SOUTH and 270 is WEST. The STEP value in the FOR/NEXT loop can be adjusted as required depending on which screen you are using. I've found that values from -.005 to -0025 work with most VESA screens but #13 may not require such fine stepping. Please, let me know if you experience any problems with this routine. C'ya, Don $endif '.í.í.í.í.í.í.í.í.í.í.í.í.í.í.í.í.í.í.í.í.í.í.í.í.í.í.í.í.í.í.í.í.í.í.í.í.í.í ' í í í í í í í í í í í í í í í í í í í í í í í í í í í í í í í í í í í í í í PUBLIC pPi! : pPi! = ( 4 * ATN(1) ) SCREEN 12 DELAY 1 LINE (320,0)-(320,479), 7 LINE (0,240)-(639,240), 7 DELAY 1 DrawCircle 320, 240, 140, 14, 0, 0, 1.51 ' complete circle DrawCircle 320, 240, 205, 13, 81, 163, 1.00 ' small arc in lower R quad DrawCircle 320, 240, 130, 12, 175, -40, 1.00 ' pie shape in upper L quad DrawCircle 320, 240, 130, 11, 40, 175, 1.00 ' complete the arc above DrawCircle 320, 240, 319, 10, 0, 0, 0.75 ' one BIG mama WHILE NOT INSTAT : WEND SCREEN 0 CLS END ' ------------------------------------------------------------------------- ' -------- see CIRCLE help for parameter details ' ------------------------------------------------------------------------- SUB DRAWcircle (BYVAL Xcen AS INTEGER , _ BYVAL Ycen AS INTEGER , _ BYVAL Radius AS INTEGER , _ BYVAL Colour AS INTEGER , _ BYVAL Sdeg AS INTEGER , _ BYVAL Edeg AS INTEGER , _ BYVAL Aspect AS SINGLE ) LOCAL PUBLIC DIM Erdn AS LOCAL SINGLE DIM Rdn AS LOCAL SINGLE DIM Srdn AS LOCAL SINGLE DIM Steep AS LOCAL SINGLE DIM X1 AS LOCAL INTEGER DIM Xrad AS LOCAL SINGLE DIM Xo AS LOCAL INTEGER DIM Y1 AS LOCAL INTEGER DIM Yrad AS LOCAL SINGLE DIM Yo AS LOCAL INTEGER IF Aspect! < 0 THEN Xrad! = ABS(Aspect!) * Radius% Yrad! = Radius% ELSE Xrad! = Radius% Yrad! = Aspect! * Radius% END IF Srdn! = fDeg2Rad!( ABS(Sdeg%) ) Erdn! = fDeg2Rad!( ABS(Edeg%) ) IF Erdn! => Srdn! THEN INCR Srdn!, 6.28 Xo% = -1 Yo% = -1 FOR Rdn! = Srdn! TO Erdn! STEP -.003 X1% = ( Xrad! * COS(Rdn!) ) Y1% = ( Yrad! * SIN(Rdn!) ) IF ( X1% <> Xo% ) OR _ ( Y1% <> Yo% ) THEN Xo% = X1% Yo% = Y1% X1% = Xcen% + X1% Y1% = Ycen% - Y1% PSET (X1%, Y1%), Colour% END IF NEXT IF ( Sdeg% < 0 ) OR _ ( Edeg% < 0 ) THEN X1% = ( Xrad! * COS(Srdn!) ) Y1% = ( Yrad! * SIN(Srdn!) ) X1% = Xcen% + X1% Y1% = Ycen% - Y1% LINE ( Xcen%, Ycen% )-( X1%, Y1% ), Colour% X1% = ( Xrad! * COS(Erdn!) ) Y1% = ( Yrad! * SIN(Erdn!) ) X1% = Xcen% + X1% Y1% = Ycen% - Y1% LINE ( Xcen%, Ycen% )-( X1%, Y1% ), Colour% END IF END SUB ' ------------------------------------------------------------------------- FUNCTION fDeg2Rad ( SEG Degree AS SINGLE ) LOCAL PUBLIC AS SINGLE DIM F AS LOCAL SINGLE IF Degree! > 89 THEN F! = 2.5 ELSE F! = 0.5 fDeg2Rad! = (F! * pPi!) - (( pPi! / 180 ) * Degree!) + 0.0001 END FUNCTION