projected X and projected Y for a given X,Y

This topic is 4546 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I am trying to figure out a projected x y coordinate on a left hand cartesian coordinate system. Information I have Current Speed = 321 CurrentX = 498472 CurrentY = 439890 Heading = 147 Time = 11718 in ticks represents when I received the current info. Can someone help with a formula to do this?

Share on other sites
I need projectedx and projectedy. So basically from where they are using current x and y, speed and heading and the time since the last update I would like to calculate where they will be when I do my drawing. I need to do this in between updates.

Share on other sites
So, you've got a speed and a heading, and you want to know how much the object would move in a certain timeframe?

What are the units here?

Share on other sites
Yes basically, units are just cartesian units.

Share on other sites
NewX = CurrentX + (Current Speed * cosf(Heading * PI / 180.0f) * time_elapsed);NewY = CurrentY + (Current Speed * sinf(Heading * PI / 180.0f) * time_elapsed);

I have no idea if this is what you want, but then again I have no idea what you're talking about.

Any answer is only as good as the question.

"projected" is ambiguous. Programmers will think you mean "vector projection", which you can think of as a line casting a shadow onto some other line or surface. That's what he means by "projected onto what?" YOU mean "projected" = "future estimation"

Are you doing this calculation many times per second, between each frame (like in a game), or are you receiving packets of information kind of like a sonar/radar "ping"?

What is "11718" ticks? Is a tick a second? 1/1000th of a second? Is that the amount of time since you last got an update, or the amount of time since you started keeping track of time?

"Left handed coordinates" means nothing in 2 dimensions... you can point your thumb along +x or -x and still align your index finder to either +y or -y.

Assuming you're using screen-coordinates (X = right, Y = down), increasing an angle will rotate clockwise.

[Edited by - Nypyren on July 1, 2005 9:53:00 PM]

Share on other sites
Yes I mean future estimation and I am receiving packets. The ticks is milliseconds, lastupdate - System.Environment.TickCount so it's the time elapsed since I received the information.

My formula is basically the same as your.

dHyp = iSpeed * (lastupdated) * (1 / 1000)
s = Math.Sin(currentHeading * (180.0 / Math.PI))
c = Math.Cos(currentHeading * (180.0 / Math.PI))
newX = CInt(currentX - Math.Round(s * dHyp))
newY = CInt(currentY + Math.Round(c * dHyp))

Share on other sites

This topic is 4546 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Create an account

Register a new account

• Forum Statistics

• Total Topics
628655
• Total Posts
2984056

• 10
• 9
• 9
• 10
• 21