Posted: 29th Jan 2004 5:01
Finds the point of intersection between two circles. Rather than show the two intersection points of overlapping circles, it'll show the single initial point of intersection.

+ Code Snippet
REM Point of intersection between two circles
REM written by: Phaelax

x1# = 300
y1# = 200
r1# = 50
r2# = 30

do
   cls
   x2#=mousex()
   y2#=mousey()


   ink rgb(255,255,255),0
   circle x1#,y1#,r1#
   circle x2#,y2#,r2#


   rem only calculate point of intersection if circles are intersecting
   if (x1#-x2#)^2 + (y1#-y2#)^2 <= (r1#+r2#)^2
      dx#=x2#-x1#
      dy#=y2#-y1#
      angle#=atanfull(dx#,dy#)
      x# = newxvalue(x1#,angle#,r1#)
      y# = newzvalue(y1#,angle#,r1#)

      rem show point of intersection
      ink rgb(255,0,0),0
      circle x#, y#,2
   endif

loop