I'm drawing a circle on a canvas. I would like to know, given radius and origin x/y of a circle, at what points the circle intersects (if at all) with the canvas edges.
This is a geometry question for sure, but that part seems too simple to post elsewhere. The JavaScript part is escaping me completely. I'm not even entirely sure how to begin.
The canvas will vary in size, but that's easy enough to access. The circle will be dynamic in size and position as well, but those variables are readily available. Any hints or nudges in the right direction are very welcome.
PS
I am using RaphaelJS to draw the shapes, if that helps. If anyone has a solution for canvas/modern browsers, I can backwards myself the rest.