Home /  Sketchbook /  p5.js - Common Examples - Circle-Line Intersection
  • Info

Overview

This is a p5.js sketch to demonstrate the calculation of the intersection points between a circle and a line.

Controls

Mouse

  • Click and Drag - Allows user to click and drag the green end points of the line to move the line around (and see the red intersection points).

References:

  • Math StackExchange Answer - Post that answers the question: “How do I calculate the intersection(s) of a straight line and a circle?”

Links:

  • Live View
  • Source on Github

Screenshot:

screenshot