'=========================================================================== ' Subject: GEOMETRIC CIRCLE Date: 01-04-99 (23:33) ' Author: Roger Hermans Code: QB, QBasic, PDS, PB ' Origin: r.hermans@planetinternet.be Packet: GRAPHICS.ABC '=========================================================================== DECLARE SUB s.WachtLus (A$) 'for PowerBasic and QBasic. 'Geo.bas 1/4/1999. 'r.hermans@planetinternet.be 'CornerR is the corner 'et tight 's with the center of the circle. 'the value off the Cosinus is the center off the circle to the cosinus. 'the value off the Sinus is the Cosinus to the Sinus. 'Simplefied example off the geometric circle. The basic for triangles. '-------------------------------------------------------------------------- SCREEN 12 PI# = 4 * ATN(1): Straal = 239: CornerR = 1: px = 399: py = 240 DO IF CornerR > 360 THEN CornerR = 1 A$ = INKEY$ CIRCLE (px, py), 239, 9 p2x = px + Straal * COS(PI# / 180 * CornerR) p2y = py + Straal * SIN(PI# / 180 * CornerR) LINE (px - 239, py)-(px + 239, py), 2 'de 2 haakse lijnen. LINE (px, py + 239)-(px, py - 239), 2 LINE (px, py)-(p2x, p2y), 15 'de straal. LINE (px, py)-(p2x, py), 15 'de cos lijn. LINE (p2x, py)-(p2x, p2y), 15 'de sin lijn. LOCATE 1, 1: PRINT "Cosinus ="; ABS(Straal * COS(PI# / 180 * CornerR)) LOCATE 3, 1: PRINT "Sinus ="; ABS(Straal * SIN(PI# / 180 * CornerR)) LOCATE 5, 1: PRINT "CornerR ="; CornerR IF CornerR > 90 AND CornerR < 180 THEN LOCATE 5, 14: PRINT "("; 180 - CornerR; ")" ELSEIF CornerR > 180 AND CornerR < 270 THEN LOCATE 5, 14: PRINT "("; ABS((270 - CornerR) - 90); ")" ELSEIF CornerR > 270 AND CornerR < 360 THEN LOCATE 5, 14: PRINT "("; 360 - CornerR; ")" END IF LOCATE 1, 73: PRINT "Cosinus" LINE (605, 15)-(p2x, py), 12 LOCATE 26, 1: PRINT "Sinus" LINE (40, 408)-(p2x, p2y), 4 LOCATE 28, 72: PRINT "Esc = end" LOCATE 28, 1: PRINT "Push a button" s.WachtLus A$ COLOR 15 CLS CornerR = CornerR + 1 'for QBasic fans. IF A$ = CHR$(27) THEN LOCATE 4, 10: PRINT "Roger Hermans - Geo1.bas -" LOCATE 6, 10: PRINT "r.hermans@planetinternet.be" LOCATE 8, 10: PRINT " See You on the Internet." END END IF LOOP '--------------------------------------------------------------------------- SUB s.WachtLus (A$) DO A$ = INKEY$ IF A$ <> "" THEN EXIT DO COLOR 11 LOCATE 16, 1 PRINT TIME$ LOOP END SUB