utils.beamIntersectsCircle()

The utils.beamIntersectsCircle() function finds the intersection between an endless line through points point1 and point2 and a circle with its center at point center and a radius of radius mm.

Signature

Javascript
array | false utils.beamIntersectsCircle(
  Point center, 
  float radius, 
  Point point1, 
  Point point1, 
  string sort=x
)

The 5th and last parameter controls the sorting of the found intersections. This will (almost) always return 2 intersections, and 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