PDA

View Full Version : in-between points between 2 vertices



tango
02-05-2001, 06:46 AM
hi!

i have the coordinates for 2 3D points and these are connected using a straight line. How can i get the coordinates of the data points along this line, between the 2 specified endpoints?

Can the maths formulae be shown too?

thanks a lot!
patric

Gorg
02-05-2001, 07:01 AM
simply transform your 2 points in a parametric line. A parametric line is simply a point + a vector that gives the direction of the line. Any point on the line can be found using


point + t*vector

where t is a number. So, for your line, if you have point a and point b :

a + t(b-a)
b-a is the direction vector. To find any point you give a value to t.

Now, since your line is finite, you'll need an interval in which t is valid. For you case, since your line is between a and b, the t interval is [0,1].

Conclusion, if you input any t between 0 and 1, you'll get a point between your 2 end points


in the case where your line is infinite(ex : a ray), then the t interval would be

(-infinity,infinity) or ]-infinity,infinity[ depending on which math symbols you use http://www.opengl.org/discussion_boards/ubb/smile.gif


[This message has been edited by Gorg (edited 02-05-2001).]

Quaternion
02-05-2001, 07:05 AM
If I understood you right, you want to interpolate between two 3D points in space.

Let t be the interpolation factor, we want a function that maps P0 for t = 0 and P1 for t = 1.

P(t) = P0 + t*(P1 - P0)

Hope that helps.

tango
02-05-2001, 07:52 AM
understood!

thanks!