Neta Meta
Neta Meta

Reputation: 4047

how can i find an 90 angle relative to another angle

Say i have a line pointing 35 degree, and i want to draw a line on that line and produce a 90 degree angle how can i fine the angle of the second line?

image would explain better.enter image description here

So in the upper image we have a line that has 0 degree, while another line intersects it at 90 degree - and we already know its a 90.

in the lower image a line is at 30-40 degrees, how do i find the angle of the second line ?

in javascript if possible.

Thanks

Upvotes: 0

Views: 771

Answers (1)

nnnnnn
nnnnnn

Reputation: 150020

If you know that angle A is 35 degrees then angle B just needs to be 35 + 90. Allowing for "wrap-around" past 360 degrees for cases where angle A is greater than 270 degrees you can do this:

var B = (A + 90) % 360;

That way if A is, say, 290 degrees you'll get B as 20 rather than 380.

Upvotes: 2

Related Questions