Quantcast
Channel: VBForums - Maths Forum
Viewing all articles
Browse latest Browse all 112

[RESOLVED] Rise/Run to Angle

$
0
0
For a number of years I've been using a simple rise/run vector to represent the direction of a moving object onscreen. For example, if I wanted to represent the trajectory of an object moving from somewhere in the upper left on the screen to the lower right at an exact angle of 45 degrees, I'd use a value of (5,5). The values themselves aren't important, only their ratio to one another so (5,5) is the exact same direction as (1,1) or (23,23). If I wanted to represent movement along the Y axis with no movement along the X axis, I can use say, (0,10) which is downward movement or (0,-10) which is upward movement.

This works really well for me. Its simple and makes certain calculations like plotting an intercept course quite easy. But I've always been curious: Is there anyway to convert this to an angle. How can I convert (5,5) to 45 degrees or 315 depending on how you want to interpret the angles.

[EDIT]

I forgot to mention that the signs of the numbers in the vector represents the direction on the specific axis. So a vector of say (12,3) represents movement in a downward right direction. (-12,3) is downward left. (-12,-3) is upward left. (12,-3) is upward right. The absolute value of the larger number is what I use to represent speed. But for the purposes of converting to an angle, speed is not important.

Viewing all articles
Browse latest Browse all 112

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>