 All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars  perplexus dot info  Rotating slopes (Posted on 2006-03-21) 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.

 See The Solution Submitted by Jer Rating: 3.2000 (5 votes) Comments: ( Back to comment list | You must be logged in to post comments.) simple solution | Comment 3 of 5 | ...using complex numbers

I convert the slope into a vector in the complex plane.
let m = slope
vector = 1 + mi

Then I multiply the vector by sqrt(i), or any other vector that is 45 degrees counter-clockwise from the +x direction. i+1 for instance.
(1+mi)(i+1)
=(1-m) + (1+m)i

Last, I convert the vector back to a slope.
slope = (1+m)/(1-m)

In the clockwise direction, 45 degrees,
(1+mi)(1-i)
=(1+m) + (m-1)i
slope = (m-1)/(1+m)

Generally speaking, to rotate any angle (counter-clockwise),
(1+mi)(cosθ+isinθ)
=(cosθ-msinθ) + (mcosθ+sinθ)i
slope = (mcosθ+sinθ)/(cosθ-msinθ)

And applying the magic trig identities,
(mcosθ+sinθ)/(cosθ-msinθ)
= √(m�+1)sin(θ-arctan(1,m)) / √(m�+1)sin(θ-arctan(-m,1))
= sin(θ-arctan(1,m))/sin(θ-arctan(-m,1))
where arctan(a,b) is the generalized form of arctan(a/b)
Actually, on second thought, the previous equation is better.

 Posted by Tristan on 2006-03-21 19:25:34 Please log in:
 Login: Password: Remember me: Sign up! | Forgot password

 Search: Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (1)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2019 by Animus Pactum Consulting. All rights reserved. Privacy Information