HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Calculating Arcs

01-23-2007, 06:57 PM#1
Ghost.X
What kind of formula can I use to calulate a point in a curve using distance between points? I hope it's not too much of a question to ask.
01-23-2007, 07:33 PM#2
rain9441
Well, pick a formula and evaluate it.

Simple line:

d = sqrt((targetx-startx)*(targetx-startx))
x = (targetx-startx)*v*t/d + startx
y = (targety-starty)*v*t/d + starty
z = 0 or some constant

v = velocity

Simple parabola:

d = sqrt((targetx-startx)*(targetx-startx))
x = (targetx-startx)*v*t/d + startx
y = (targety-starty)*v*t/d + starty
z = -1/2g(t^2) + Vt + C (where g = gravitational constant, V = initial upwards velocity, and C = initial Z location, probably 0 or some constant).

v = velocity

Simple circle:
x = r*cos(t*w) + centerx
y = r*sin(t*w) + centery
z = 0 or some constant

w in both cases = angular velocity
r in both cases = radius of the circle the unit moves along.


If you want formulas without constant acceleration, I suggest taking a calculas orientated physics course.

In all cases, t = the time elapsed since the start of the movement

Keep in mind, evaluating these formulas often will be extremely slow, you'll want to calculate the derivatives of the functions and apply changes.

Good luck!
01-23-2007, 11:52 PM#3
shadow1500
Try this: http://www.wc3jass.com/viewtopic.php?t=2689
01-25-2007, 03:26 PM#4
Ghost.X
Hmm, i'm taking up physics soon so maybe it'll be a lot clearer then. TY i'll try these out.