HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Math help

08-21-2007, 02:09 PM#1
MaD[Lion]
For an Object given:
I know start position X0,end position X1, start velocity V0, end velocity V1 and i know time t.
So here are what i know:
X0
X1
V0
V1
t

what i want to find out is the non constant acceleration that the object wmust have in order to move from X0 with V0 to X1 with V1 over a periode of t.

I've never learned non constant acceleration, and forgot how to do second order derivation. So can someone give me formula, not too long pls, cus tat will confuse me
08-21-2007, 02:41 PM#2
moyack
IF you want to get the formula of the acceleration over time, I should know at least how the position vary over time.

if you don't want to overcomplicate the things :)

(V1^2-V0^2)/(2d)= a where d is the distance.

08-21-2007, 03:25 PM#3
sas_Skorpion
I Think this one is better :

There is the basic formula
V0- Start Speed
V - End Speed
t - Time
a- Acceleration

V = a*t + V0 here u can extract a and u get

a = (V-V0) / t

i think its simple enough
08-21-2007, 04:00 PM#4
Ammorth
Moyack's method is better, since then you would have to calculate v1.
08-21-2007, 04:27 PM#5
MaD[Lion]
none of ur guy's method works, because ure trying to find constant acceleration. Wat i need is Acceleration of Acceleration. meaning i need to find a(t).

lets say:
X0 = 0
X1 = 20
V0 = 1
V1 = 0
t = 10
a = ??
if a = constant then it wont work, so a must be time dependent
08-21-2007, 04:28 PM#6
PipeDream
This is potentially a hard problem as it consists of two integral equations. There are also many possible solutions, so you need to break the degeneracy somehow. We can try by using the simplest possible a that can satisfy your general constraints: linearly varying acceleration. In practice I suspect this may not work well at all, but we can try.

Code:
v(t) = v0 + Integral(0,t) a(t') dt'
x(t) = x0 + Integral(0,t) v(t') dt'

v(tf) = v1
x(tf) = x1

a = a0 + a1 t
v(t) = v0 + a0 t + a1 t^2/2
x(t) = x0 + v0 t + a0 t^2/2 + a1 t^3/6

v1 - v0 = a0 t + a1 t^2/2
x1 - x0 - v0 t = a0 t^2/2 + a1 t^3/6

[ x1 - v0 ] =        [ t      t^2/2 ] [ a0 ]
[ x1 - x0 - v0 t ]   [ t^2/2  t^3/6 ] [ a1 ]

That's a system of linear equations you can solve to find one such non constant acceleration. It sucks though, the determinant of that matrix is -t^4/12 which will be a very small number, so this could have serious numerical stability problems. Your accelerations may be extremely bizarre.

When you discover in what way it's bizarre, we can pick an interpolation with more degrees of freedom and a constraint that eliminates the bizarreness.
08-21-2007, 05:44 PM#7
grim001
here's a question: what the heck do you need this for?
08-21-2007, 06:07 PM#8
cohadar
Why indeed?
In 90% of cases acceleration actually looks worse than linear movement.

The only way you can see any benefit from acceleration is if
you move objects over a distance longer than 1600 (approximately)
otherwise noone will notice anyways.
08-21-2007, 06:26 PM#9
Ammorth
Constant acceleration is fine, but increasing acceleration is not normally used.
08-21-2007, 06:34 PM#10
MaD[Lion]
well my problem is this, im not sure if it can be solved with constant acceleration:

I have object A.
I want object A to move from P to R over t seconds
A has starting velocity at V0
A has ending velocity at V1
i need to find acceleration a for object A.

So how do i do this
Note: A MUST have speed V0 at start and V1 at end, and it MUST move over t seconds.

It means if V0=0,V1=0 and t=10 seconds, then A will still move from P to R. even if distance between P and R are 10m. So constant acceleration wont work here... And it seems like v(t) must be quadratic, therefore acceleration must not be constant.

I need this for making my camera system, each camera node can have a moving speed tat ur local camera will have when entering tat node, and everything must happen smoothly
08-21-2007, 06:36 PM#11
Anitarf
The way I solved this very same problem for my cinematic system was by dividing the time into two halves, each with it's own constant acceleration.
Collapse JASS:
    local real accel1 = 4 * ( distance ) / ( time * time ) - ( endvelocity + 3 * startvelocity ) / time
    local real accel2 = ( 3 * endvelocity + startvelocity ) / time - 4 * ( distance ) / ( time * time )
    //startvelocity would be V0, endvelocity V1 and distance would be X1-X0
The sudden change in acceleration in the middle of the time isn't really noticeable, as long as the speed changes gradualy the motion appears smooth. Even if you had smooth acceleration throughout the move, it would suddenly change at the start of the next move so solving it that way isn't any smoother.
08-21-2007, 06:44 PM#12
PipeDream
He wants to compute a path which is differentiable everywhere, i.e. free of kinks. One obvious application for this is linking camera motions. Acceleration needs to be non zero and non constant somewhere. You can either make rates of changes infinite at the end points the user specifies or attempt to smoosh it out over the interval.
08-21-2007, 07:17 PM#13
MaD[Lion]
hmm anitarf's way seems tempting, i will try that, thnx :) But its also nice to do it my way, but we will see wat i get from my brain
08-21-2007, 07:21 PM#14
moyack
Quote:
Originally Posted by MaD[Lion]
Wat i need is Acceleration of Acceleration. meaning i need to find a(t)
a(t) is not the acceleration of acceleration, it's just the acceleration as a function of time, which is quite different.

* Explanation removed because it's not needed*
08-21-2007, 09:02 PM#15
MaD[Lion]
a(t) can also be acceleration of acceleration if i decide function for acceleration is A(t) ^^ Its just matter of definition