Find Right Angle to a Vector

BlitzMax Forums/BlitzMax Programming/Find Right Angle to a Vector

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hiya, so if I have a vector like [dx,dy] and I want to work out the vector which is at a right angle to it (or a left angle), basically 90 degrees left or right, is there a quick way to work this out as at the moment all I can think of is:

Use pythagoras to get the radius from origin. Work out angle of line from 0 degress. Subtract or add 90 degress to the angle. Use standard dx = r*cos(angle) and dy=r*sin(angle).

Just seems a bit long-winded. I'm pretty sure there must be a better options using quadrants or something.

Any ideas? Thanks.