# Position between to points.

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

## Recommended Posts

Subject: 2d project. Particle flow between two points. Little fact: Particles about 200, and each has int X, int Y and int Z for speed. Now for the question: If you want the straight way between two point you use Y1+Y2/X1+X2 (im a right?). But because the particles might be more then 200 in the future I want the program to just calculate the movement once and then move it after the values. Follow me? I want the program to calc that if PosA 100,100 and PosB 200,200 it should move every particle one right and one down. Has anybody got a smart solution.

##### Share on other sites
Interpolation:
p = (1 - t) * u + t * f, as t varies from 0 to 1. u is initial position, f is final position, p is current position.

##### Share on other sites
Not sure I understand it but I was thinking more along the line of just calc how much to move to the side if moving one up or one down. (In other words im stupid in dont know what you saying. :D)

##### Share on other sites
Olusey has given you a way to set the position at any interval from point a to point b. I think you are looking for a way to precalculate the offset between steps

distance = point b - point a;
step_offset = distance / num_steps; // precalculated does not matter to use div

That should do the trick.

##### Share on other sites
Yes he had the most exact way were you can get the values anywere, but all I need is the fast way. So thank you both for the help.

1. 1
Rutin
47
2. 2
3. 3
4. 4
5. 5

• 13
• 10
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632994
• Total Posts
3009769
• ### Who's Online (See full list)

There are no registered users currently online

×