Hi Maths forum
The problem I have is actually for a program I am writing, I just cant figure it out though.
Let's say I have a fixed 2D cooridnate system using Y and X coords, I also have a character that can be facing in any direction. His direction is given as a heading in degrees. For example, 0° is north (Y direction), 180° is south (-Y direction) X is east...etc...
Let's say I wish to find the coordinates of a point that is directly in front of the person, no matter which way he is facing. For instance, I might want the coords for 2 units in front of the character. How would I do this? To make it more clear, if the character is facing south (180°), the position I am looking for will be (-2, 0)
Can anyonep provide an equation for this?
thanks for any answer Much appreciated
Thanks for that.
Although, I haven't used sin and cos for so long, could you give me an brief worked example. Is something like this correct? The coordinates seem to come out wrong
heading = 200 degrees from east
distance from origin = 2
x = 2 * cos(200)
y = 2 * sin(200)
x = -1.87
y = -0.68
note that angles are measured counter-clockwise from 0 degrees (east)
300 degrees is in quadrant IV ... x is positive, y is negative ... and the values you calculated are correct.
need more confirmation? go to the link ...
Convert Polar to Rectangular Coordinates - Calculator