Editorial for ECOO '12 R1 P3 - Triangles
Submitting an official solution before solving the problem yourself is a bannable offence.
First, figure out the angle () and length () of the line from the origin to the given point (use for the angle and the Pythagorean Theorem for the length). Points and are also at a distance of from the origin, but at angles and respectively. You can use and to get these points. (Another way to do this is to notice that the points are reflections of one another in the line , so once you have one you just flip the sign of the coordinates to get the other.)
The third point is trickier. Figure out where point is (it's at angle and at a distance of from the origin). Now the final point you want is on the perpendicular bisector of , at a distance of from the origin, where is the height of the small triangles (use the Pythagorean Theorem to get ). You can get the angle of the perpendicular bisector using the negative reciprocal of the slope of and . And you know this line goes through the origin. Now use and to get the coordinates of .
Pitfalls
You have to remember that your computer probably thinks in radians, not degrees. So you have to do the proper conversions. Every time you compute a new angle for a point, you may have to correct it to make sure you are within to , and you may also have to correct it to make sure it is in the same quadrant as the and you used to compute it. (e.g. if and , , but this puts you in Quadrant I. You need to add in this case to get the real angle.) You also have to watch out for vertical and horizontal lines and you may need to treat them as special cases.
Comments