Given 2 random circle sections, return how many times they intersect. Rules/clarifications are as below.
- You are provided 10 total values,
- The center (x,y) of the circle section
- Angles of the circle (i.e. (0,90) would be a quarter circle "facing" the top-right corner.
- The radius of the circle section
- The circle sections are "drawn" on a 128 by 128 screen, with (0,0) being the center. They have a max radius of 64.
- You don't need to draw the circles - the program should only print out the number of intersections.
- You can choose to generate the values randomly, in-program, or have the user write it in at program start. (The latter is preferred, but not necessary.)
Below is an example case. As you can see, it has one intersect.
The output should look something like this:
$ run ./circle
input (circle 1 center)
input (circle 1 radius)
input (circle 1 angles)
input (more inputs...)
...
intersections
Heres the output for the example case (the prompts are optional):
$ run ./circle
c1center: (20,20)
c1radius: 40
c1angles: (210,150)
c2center: (-30,-30)
c2radius: 90
c2angles: (270,180
1
Anyway, best of luck! This is code golf, so the minimum number of bytes in any programming language wins!
Oh, and it'd be nice if you could provide a description/link to your program in the answer. Standard Loopholes are not allowed. If you find any errors in my explanation or want me to clarify, just ask. Thanks!