Sign in to follow this  

Position between to points.

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this