MATH: Find Point At Set Distance Between Two Points?

Hello, I have a line created with two points:

Start: x1,y1,z1
End:x3,y3,z3

I want to find x2,y2,z2 which can be any point on that line from a set distance from the starting point

I know there is a formula for it but I can’t find it anywhere :confused:

|x1| < |x2| < |x3|
and so forth

i don’t quite understand what you’re asking though

I have two points in 3D(gmod is 3d :P) space that make a line, I need an equation to find any point on that line with a given distance from the starting point

You want a normalized vector.
[lua]
local startVec = Vector( 0, 0, 0 );
local endVec = Vector( 100, 100, 100 );
local normVec = startVec - endVec;
local dist = 10;

normVec:Normalize();

local point = startVec + ( normVec * dist );
[/lua]

Thank you very much my kind sir!

I needed to break it up a little more I guess, this is what I was doing:



	local Self_Pos = self:LocalToWorld(self:OBBCenter())
	local Norm = (pos-Self_Pos):GetNormalized()

You can also do a quick-trace, or normal trace between the two points, grab the normal, then take the startpos + ( normal *distance_towards_second_point ).

For future reference, this is called linear interpolation.