Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 Re: Help Me ! » Calculating all Coordinates on a bearing » 2006-04-12 01:30:48

Hi again.

That sounds like something i had come up with previously. I found a problem with it though that would need some very detailed micro management code to get around the problem.

If moving from 2,3 to 5,10, then every time a move occurs a check is made to see if the shapes current position is 5,10, if its not then the shape can continue to move. What I found happened was that the shape a route similar to thi, depending of the increment values that were calulated 2,3 2,5, 3,7 3,9 4,11 5,11

Although that is a poor example you may be able to see what I mean, for each shape, moving will be moving in any direction each one may just miss the exact point at which is supposed to stop.

I have thought of another solution which is to  make all the Coordinate huge, in the thousands or tens of thousands and work out all the Maths positions with that. Then scale it all down to the screen size. This would presever accuracy mathimatically, which is needed, but the display would be displaying the best it could?

I have another thread here on the same subject
http://forums.devshed.com/java-help-9/drawing-from-one-coordinate-to-another-335813.html#post1460092

#2 Re: Help Me ! » Calculating all Coordinates on a bearing » 2006-04-12 01:12:10

Hi,

Thanks for the response. That is exactly what I want, but I failed to mention one small point at the start, all the coordinates have to integers, that is to say whole numbers.

Your method does make perfect sense but when coupled with the above piece of info its not as accurate. Maybe I will just have to live with this in-accuracy, because if I was to move from 2,3 to 5,10 there is a very limited number of whole numbers in between those points. Therefore a smooth motion is nearly impossible over a short distance.

#3 Help Me ! » Calculating all Coordinates on a bearing » 2006-04-11 23:44:24

jakenoble
Replies: 4

Hi all,

First post here, so bear with me.

I am writing a program in Java, and I am having a problem regarding some of the Maths when displaying what I need to display.
I want to be able to move a shape from one coordinate to another, this involves calulating all the coordinate in between, so i can tell the shape which coordinates it needs to move through.

This is proving extremely difficult, I have maned to work out the polar (bearing) coordinates by using 'tan'. What I need is some sort of formula that will determine all the coordinates on a bearing.

E.g. starting at 0,0 with a bearing of 45 degrees, then it could be said that all the coordinates on that bearing are 1,1 2,2 3,3 4,4  . . .  etc

If anyone can help, or point me in the right direction it would be a great help.

Thanks

Jake

Board footer

Powered by FluxBB