I want to visualize two different algorithms that decide if they overlap in a collection of circles in a plane in Java:
- O (nΒ²) algorithm that checks each combination of circles
- O (nlogn) algorithm using a scan line
Is there a way to let an object of the vizualization class βlistenβ to an object of the algorithm class so that it can, for example, see when the algorithm checks for overlap between two circles and knows when to update the visualization?
another example: I can save the list of active circles (those that intersect the scan line) as a variable of the scan line algorithm, and let another class (visualization class) receive this variable. But how does this class know when the list will be updated, and it should update the visualization?
This is just the strategy I was thinking about. Maybe there are better ways ...
aerod source share