Question 23rd (algorithm):
The simplest and quickest way to calculate whether the following circle intersects a square. "
3D coordinate system origin (0.0,0.0,0.0)
Circular:
Radius r = 3.0
Center o = (*. *, 0.0, *. *)
Square:
4 angular coordinates;
1: (* *, 0.0, * *)
2: (* *, 0.0, * *)
3: (* *, 0.0, * *)
4: (* *, 0.0, * *)
I don't know what the coordinates are. * * Indicates the value of coordinates?
It is not clear whether circles and squares are solid. If it is solid, then the inclusion is also intersected. If it is hollow, the inclusion is disjoint.
Just tell me if the circle and the square intersect.
Idea: Judging the angle by length is not within the circle. Directly calculates the distance from the angle to the center of the circle, if it is greater then no longer in the garden, less than or equal to the circle, intersect.
If it is solid. This makes it possible to determine if there is a crossover. If it is hollow, it must intersect if there is an angle to the center of the distance equal to the radius. Otherwise, to determine the four corners, if the four corners are in the garden (distance is less than the radius), then does not intersect (circle contains square).
Data structure and algorithm surface test questions 80 (23)