utils.circlesIntersect()

The utils.circlesIntersect() function finds the intersections between two circles described by their center point and radius.

Signature

Javascript
array | false utils.circlesIntersect(
  Point centerA, 
  float radiusA, 
  Point centerB, 
  float radiusB, 
  string sort = 'x'
)

The 5th and last parameter controls the sorting of the found intersections. When this returns 2 intersections, you can choose how they are ordered in the returned array:

Set sort to:

  • x : The point with the lowest X-coordinate will go first (left to right)
  • y : The point with the lowest Y-coordinate will go first (top to bottom)

Example