Position calculation

  • Thread starter Dona123
  • Start date
  • #1
7
0

Main Question or Discussion Point

Hi,

I want to calculate a body x and y position at a particular z value in 3D space when applying particular force and impulse.

Appreciates all the help!

Tnx
Dona
 

Answers and Replies

  • #2
7
0
My objective is to draw the curvature path of the body in 3D space when applying a particular force and impulse!

Thanks
 
  • #3
rcgldr
Homework Helper
8,682
520
Assuming you can calculate accelerations, you'll need to do some form of numerical integration to calculate velocities and positions in small steps of time.

For each time step, you calculate

new_velocity = old_velocity + time_step x average_acceleration

One way to do this is to use trapezoidal method

average_accleration = 1/2 (acceleration0 + acceleration1)

where acceleration0 is the acceleration at the start of a time step and acceleration1 is the acceleration at the end of a time step. This requires you be able to calculate acceleration1 directly or to be able to predict it via an iterative method (see below)

You can then calculate position once you calculate the new velocity, using the same method:

new_position = old_position + time_step x 1/2 x (old_velocity + new_velocity)

An iterative corrector method will improve the results. In the algorithm shown below, an, vn, and pn, are successive "guesses" that should converge quickly. F(...) calculates the acceleration based on pn(t), and Δt is the elapsed time per step. You may want to do 6 to 8 interations instead of the 4 shown in this example. The first step is essentially Euler (since a1(t) is set = F(p0(t)) (= a(t-1)), the remaining steps are trapezoidal. Even though each step of this algorithm will converge to a specific set of values, the algorithm is based on trapezoidal rule, a linear approximation, so you need to use small time steps (Δt).

v0(t) = v(t-1)
p0(t) = p(t-1)

a1(t) = F(p0(t)) (= a(t-1))
v1(t) = v(t-1) + 1/2 (a(t-1) + a1(t)) Δt
p1(t) = p(t-1) + 1/2 (v(t-1) + v1(t)) Δt

a2 = F(p1(t))
v2(t) = v(t-1) + 1/2 (a(t-1) + a2(t)) Δt
p2(t) = p(t-1) + 1/2 (v(t-1) + v2(t)) Δt

a3 = F(p2(t))
v3(t) = v(t-1) + 1/2 (a(t-1) + a3(t)) Δt
p3(t) = p(t-1) + 1/2 (v(t-1) + v3(t)) Δt

a4 = F(p3(t))
v4(t) = v(t-1) + 1/2 (a(t-1) + a4(t)) Δt
p4(t) = p(t-1) + 1/2 (v(t-1) + v4(t)) Δt

...

v(t) = vn(t)
p(t) = pn(t)
a(t) = F(pn(t))

time += Δt
t += 1

This is a predictor-corrector type algorithm:

http://en.wikipedia.org/wiki/Predictor-corrector_method#Euler_trapezoidal_example
 

Related Threads on Position calculation

Replies
1
Views
1K
Replies
18
Views
14K
Replies
31
Views
2K
Replies
4
Views
3K
  • Last Post
Replies
10
Views
1K
  • Last Post
Replies
5
Views
847
  • Last Post
Replies
1
Views
2K
Replies
2
Views
742
  • Last Post
Replies
3
Views
771
Top