Calculating object position with non-constant speed

  • Thread starter Thread starter caibbor
  • Start date Start date
  • Tags Tags
    Position Speed
caibbor
Messages
19
Reaction score
0
The problem (long story short) to use an analogy... if I stand here, and then immediately run 5mph for an hour, after 30 minutes I have run 2.5 miles. But if I instead linearly drop from 5mph to 1mph over the course of that hour, where do I stand after 30 minutes?

The speed is linear so I don't think this quite breaks into calculus, but I've been banging my head over this for a while.

Reasoning:

I'm trying to program a particle engine and calculate movement without storing origins since they won't be drawn on screen unless they're within the view frustum and therefore particles off screen that are moving around that suddenly come on screen would not be in the proper place. So the calculations have to be made without any state variables.
 
Mathematics news on Phys.org
caibbor said:
The problem (long story short) to use an analogy... if I stand here, and then immediately run 5mph for an hour, after 30 minutes I have run 2.5 miles. But if I instead linearly drop from 5mph to 1mph over the course of that hour, where do I stand after 30 minutes?

The speed is linear so I don't think this quite breaks into calculus, but I've been banging my head over this for a while.

Reasoning:

I'm trying to program a particle engine and calculate movement without storing origins since they won't be drawn on screen unless they're within the view frustum and therefore particles off screen that are moving around that suddenly come on screen would not be in the proper place. So the calculations have to be made without any state variables.

I don't know about the particle engine part, but the calculation of distance run is easy - sketch a graph of velocity vs time. The area under that graph will be the distance covered. In this case, your area will be a trapezoid.

Before you sketch the graph, you have to be clear whether you're decelerating from 5mph to 1mph over 1 hour or half-hour. It makes a big difference.
 
Well, I've got some food for thought on this. I gave a more explicit variation of the problem to a friend which goes as follows:

A particle at is going to travel past three non-evenly separated points A, B, and C in a straight line on the x-axis. The particle starts at 0.0 seconds at point A at (0,0) moving at 5 units right per second. It linearly slows down until it reaches point C at 1.0 seconds moving 1.0 units per second. Along the way, it passes through point B at 0.5 seconds. Where is point B and C?


The friend gave the following answer, where A is accelleration.


Iv = 5.0 u/s
A = -1.0 u/s/s

x_pos at 0.0 Sec
Final Velocity = 5.0 + (-1.0 * 0) = 5.0
Distance = .5 * (5.0 * 5.0) * 0 = 0

x_pos at 0.5 Sec
Final Velocity = 5.0 + (-1.0 * 0.5) = 4.5
Distance = .5 * (5.0 + 4.5) * (0.5) = 2.375

x_pos at 1.0 Sec
Final Velocity = 5.0 + (-1.0 * 1) = 4.0
Distance = .5 * (5.0 + 4.0) * (1) = 4.5


relevant: http://en.wikipedia.org/wiki/Equations_of_motion
 
caibbor said:
The problem (long story short) to use an analogy... if I stand here, and then immediately run 5mph for an hour, after 30 minutes I have run 2.5 miles. But if I instead linearly drop from 5mph to 1mph over the course of that hour, where do I stand after 30 minutes?

The speed is linear so I don't think this quite breaks into calculus, but I've been banging my head over this for a while.
As long as acceleration is constant, as here, the "average speed" is just the arithmetic average of the speeds at the beginning and ending. If speed drops linearly from 5 to 1 mph then the average speed over that time is (5+1)/2= 3 mph. In 1/2 hour you will have gone 3/2 mile.

Reasoning:

I'm trying to program a particle engine and calculate movement without storing origins since they won't be drawn on screen unless they're within the view frustum and therefore particles off screen that are moving around that suddenly come on screen would not be in the proper place. So the calculations have to be made without any state variables.
 
So my friend was wrong. How did you calculate that?
 
HallsofIvy said:
As long as acceleration is constant, as here, the "average speed" is just the arithmetic average of the speeds at the beginning and ending. If speed drops linearly from 5 to 1 mph then the average speed over that time is (5+1)/2= 3 mph. In 1/2 hour you will have gone 3/2 mile.

Close, but no cigar! :smile:

The average speed for 1 hour is 3 mph so you go 3 miles in the full hour.

But, the average speed for the first half hour is 4 mph and the average for the second half hour is 2 mph. So you go 2 miles in the first half hour, and 1 mile in the second.
 
caibbor said:
Iv = 5.0 u/s
A = -1.0 u/s/s
etc

The method is OK.
But A = -4.0, not - 1.0.
 
AlephZero said:
The method is OK.
But A = -4.0, not - 1.0.

x_pos at 0.0 Sec
Velocity = 5.0 + (-4.0 * 0.0) = 5.0
Distance = .5 * (5.0 + 5.0) * (0.0) = 0

x_pos at 0.5 Sec
Velocity = 5.0 + (-4.0 * 0.5) = 3.0
Distance = .5 * (5.0 + 3.0) * (0.5) = 2

x_pos at 1.0 Sec
Velocity = 5.0 + (-4.0 * 1.0) = 1.0
Distance = .5 * (5.0 + 1.0) * (1.0) = 3

yes? if this method is "okay," is there a better one? more accurate or, perhaps simpler?
 
Back
Top