(a) Write the function: float getDistance (float x1, float y1, float x2, float y2)
which computes and returns the distance between two coordinate points.
(b) Given two circles, write a function of the form:
int intersect (int cx1, int cy1, int r1, int cx2, int cy2, int r2) which returns 1
if circle 1 intersects circle 2; otherwise, 0.
(c) Write the function:
int getNumIntersects (int n, int x[], int y[], int r[], int cx, int cy, int cr)
which returns the number of intersections between circle (cx, cy; cr) and the circles in the arrays.
(d) Write an openframeworks program create the data needed for making such image. Follow the given algorithm.
1. Declare variables.
(a) 3 arrays for circles list: x[],
y[], r[] (dim 1000)
(b) single circle: cx, cy, cr (c for candidate)
(c) count: int
2. Setup. Set the first circle in the circles arrays to
a random circle and set count to 1.
3. Update.
(a) Generate a candidate circle randomly
(b) If no intersects, add candidate to circles array and
increment the count
4. Draw. Draw all the circles