Known radius of a circle, the center coordinates of the center of a rectangular coordinates, and width, to write a c # program to judge circular and rectangular position: intersection, containing, depart, tangent, etc.,
CodePudding user response:
Think along while, drew the along while, said a word or two to return true. General idea: Rectangular outside to create a distance of r buffer, get the casing outside the buffer curve (consisting of four straight lines, four quadrant), write a algorithm to judge circle on the buffer curve, the curve, the curve. The curve, and tangent, foreign curve. The curve points: in the intersection or contain, continue again after this time is: If the rectangle are small, can be included in the circle (r> H& & R> W), If the rectangle is bigger, can contain circle, need to create a distance of r in the rectangular buffers (this should be a rectangular) : similar to the above logic, judge the position and the center of the circle buffer curve relationship: or, rectangular contain circular, curve, intersection. General logic, may not be too strict, his painting figure, and then write code debugging, consuming brain