Grid Help

valrikJay

New member
Joined
Jul 20, 2020
Messages
10
Basically, i have a 2d grid coord system. say 10 x 10.

a point is chosen. lets say 5,5. if i have a facing direction in degrees, and a 2d move distance(0,1), how can i easily calculate the new position from these details alone?
 
Hi, I don't understand your question. What do you mean by a 2d move distance (0,1)? Distance is not a vector. Try to write more clearly what is given. I understand that the initial point is given. Now what is next? the direction of motion (angle)? and the distance d it moves?
 
Basically, i have a 2d grid coord system. say 10 x 10.

a point is chosen. lets say 5,5. if i have a facing direction in degrees, and a 2d move distance(0,1), how can i easily calculate the new position from these details alone?
What class and what subject - e.g. 7th grade geometry - did this assignment come from?

Please post the exact problem presented to you.

Please show us what you have tried and exactly where you are stuck.​
Please follow the rules of posting in this forum, as enunciated at:​
Please share your work/thoughts about this assignment.​
 
this hasnt come from an assignment, its a personal project. I apologise i find it very hard to descibe things please bare with me.

its like a game board with 2 coordinates. i see what i did wrong in my explanation im sorry. if a current position resides at point 5,5. if i have a heading in degrees, and a forward distance. how do i work out the new coordinates.

im at 5,5, i turn 65 degrees and move forward say 2 points. if i was already at 5,5 facing 0 degrees, id be at 5,7 after moving 2 spaces.

i hope that makes a little more sense
 
im trying to be able to plot map like coordinates from being given a starting position and a series of headings and forward move distances
 
this hasnt come from an assignment, its a personal project. I apologise i find it very hard to descibe things please bare with me.

its like a game board with 2 coordinates. i see what i did wrong in my explanation im sorry. if a current position resides at point 5,5. if i have a heading in degrees, and a forward distance. how do i work out the new coordinates.

im at 5,5, i turn 65 degrees and move forward say 2 points. if i was already at 5,5 facing 0 degrees, id be at 5,7 after moving 2 spaces.

i hope that makes a little more sense
Do you know trigonometry?
 
hoping to crack this, the next step is going to be a 3d grid. not looking forward to THAT one
 
Since you have a grid, I presume you are required to move along the grid lines. That is, from (5,5) you can move directly to (6,5), or (4,5), or (5,6) or (5, 4). You could not move directly from (5, 5) to (6, 6) though you could move from (5, 5) to (6, 5) and then to (6, 6), doing it in two moves.



Your "facing direction", then must be a multiple of 90 degrees. 0 degrees would be from (5, 5) to (6, 5), 180 degrees would be from (5, 5) to (5, 4), 270 degrees would be from (5,5) to (4,5), and 360 degrees would be from (5,5) to (5, 6). Since sin(90)= 1, sin(180)= 0, sin(270)= -1, sin(360)= 0 and cos(90)= 0, cos(180)= -1, cos(270)= 0, and cos(360)= 1, we can write a move of one step in direction \(\displaystyle \theta\), were \(\displaystyle theta\) is 90, 180, 270, or 360, as from \(\displaystyle (x, y)\) to \(\displaystyle (x+ sin(\theta), y+ cos(\theta))\).



Another way to do it would be to take \(\displaystyle \theta\) fixed at 90 degrees and i from 1 to 4. Then the four moves would be from \(\displaystyle (x, y)\) to \(\displaystyle (x+ cos(i*\theta), y+ sin(i*\theta)\).
 
No Im not restricted by grid lines, floating point values are ok to be returned, however your explanation is perfect for me i think. thank you so much. been struggling with this for a few weeks now
 
Top