CirclesIntersect
IntersectFlag = CirclesIntersect(Xpos1, Ypos1, Radius1, Xpos2, Ypos2, Radius2)
 
Parameters:

    Xpos1 = X position of 1st circle
    Ypos1 = Y position of 1st circle
    Radius1 = Radius of 1st circle
    Xpos2 = X position of 2nd circle
    Ypos2 = Y position of 2nd circle
    Radius2 = Radius of 2nd circle
Returns:

    IntersectFlag = The intersect flag return a TRUE (1) if the circle overlap, otherwise it'll be FALSE (0)
 

      CirclesIntersect checks if two specified circles intersect each other. The function returns TRUE (1) if an intersection has occurred, otherwise it returns a FALSE (0).








Mini Tutorial:


      Show simple the use of CirclesIntersect.


  
; Init the variables circleX & Y to the middle of the display
  CircleX = GetScreenWidth() / 2
  CircleY = GetScreenHeight() / 2
  CircleRAdius = 40
  
  
; Start Program Main Loop
  Repeat
     
   ; Clear the screen to black (rgb(0,0,0) = black)
     Cls RGB(0,0,0)
     
   ; Display instructions
     Print "Move Mouse To Check If Circles Intersect"
     
   ; Draw circle to the the screen
     Circle CircleX, CircleY, CircleRAdius, 0
     
   ; Draw another circle at the mouse position
     Circle MouseX(), MouseY(), 10,0
     
   ; Check for Intersection
     If CirclesIntersect(CircleX, CircleY, CircleRAdius, MouseX(), MouseY(), 10)
        Print "Circles Intersect"
     EndIf
     
   ; Show the drawn screen to the user
     Sync
     
   ; loop back to the Repeat statement unless the ESC key was pressed
  Until EscKey()
  





 
Related Info: LineIntersectCircle | LineIntersectRect | LinesIntersect | PointInBox | PointIntersectCircle :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com