'original source code
PRINT "Use mouse, then press Esc for function test..." r& = 200 'radius change circle size and position here
cx& = 320 'center x horizontal
cy& = 240 'center y vertical
xy& = ((x& - cx&) ^ 2) + ((y& - cy&) ^ 2) 'Pythagorean theorem
'modified to function:
'cx&, cy&, r& are the same as is begin
IF INCIRCLE
(x&
, y&
, r&
, cx&
, cy&
) THEN PRINT "Point is in circle " ELSE PRINT "Point is not in circle"
FUNCTION INCIRCLE
(x&
, y&
, r&
, cx&
, cy&
) xy& = ((x& - cx&) ^ 2) + ((y& - cy&) ^ 2) 'Pythagorean theorem
IF r&
^ 2 >= xy&
THEN INCIRCLE
= 1 ELSE INCIRCLE
= 0