Download text file
' =============================================================
' ===== test code
' =============================================================
SCREEN 12
PUBLIC pPi! : pPi! = 4 * ATN(1)
Xcen% = 320
Ycen% = 240
Rad% = 100
Asp! = .5
CIRCLE (Xcen%,Ycen%), Rad%, 8, , ,Asp!
FOR Deg% = 0 TO 359 STEP 30
CALL RayPoint( Xcen%,Ycen%,Rad%-10,Asp!,Deg%,X%,Y%)
LINE (Xcen%,Ycen%) - (X%,Y%), 9
CALL RayPoint(Xcen%,Ycen%,Rad%,Asp!,Deg%,X%,Y%)
CIRCLE (X%,Y%), 10, 15, , ,Asp!
NEXT
' =============================================================
' =============================================================
' PURPOSE: compute the point on a circle
' PARAMS: X%, Y% graphic center of a/the circle
' Radius% radius of a/the circle
' Aspect! circle's aspect ratio
' Degree% point to be computed (0 -> 359)
' RETURNS: Col% graphic column number
' Row% graphic row number
' NOTE: Points of the circle are considered to start at the
' top and move around the circle clockwise by degrees
' IE: point 3 of 12 would be 3 o'clock or 90 degrees
' =============================================================
' =============================================================
SUB RayPoint (X%,Y%,Radius%,Aspect!,Degree%,Col%,Row%)
IF Aspect! => 1 THEN
Xradius% = ( Radius% / Aspect! )
Yradius% = Radius%
ELSE
Xradius% = Radius%
Yradius% = ( Radius% * Aspect! )
END IF
D! = ( pPi! / 180 )
A! = ( Degree% * D! - 1.570796 )
Col% = ( COS(A!) * Xradius% + X% )
Row% = ( SIN(A!) * Yradius% + Y% )
END SUB