Given a line with slope y/x, find a simple formula for the slope of a second line that forms a 45 degree angle with this line (find slopes for both 45 degrees more and 45 degrees less.)
This can be done without trigonometry.
Find a general formula for any angle.
This requires trigonometry.
OK, I had to draw this for it to make sense  you may need to do the same... :)
For a line A with slope y/x, the line B perpendicular (forming a 90 degree angle) has slope x/y. You can join these two perpendicular lines with a third line C that creates an isosceles right triangle. Line C has a slope 45 degrees "more" than line A. The slope of line C is found by:
(y + x) / ( x  y)
The line D, perpendicular to line C, will be 45 degrees "less" than line A, and its slope is simply the negative reciprocal of line C:
(y  x) / (y + x)
I'm not 100% sure of the second part, but here's a guess. I'm pretty sure that the slope of a line is equal to the tangent of its angle. So, could you do something like this (where m_new is the slope of the new line, m_orig is the slope of the original line)?...
m_new = tan [ (arctan m_orig) + 45 ] 45 deg "more"
m_new = tan [ (arctan m_orig)  45 ] 45 deg "less"

Posted by tomarken
on 20060321 15:59:16 