I did a test, am I right that C will always be a point between A and B in your formula? I need C to be a point 'behind' B with B being on the vector between A and C. I came up with this, which seems to be ok:

Cx = bx + -1*(D*(ax - bx) / L)

Cy = by + -1*(D*(ay - by) / L)

So Cx = bx + D*(ax - bx) / L and Cy = by + D*(ay - by) / L. This is because that vector will be the distance you have to travel from b to get to c, so to find the position of c, you just add the vector to that of b.

For all three planes, all you do is add in a z value:

A: (ax, ay, az)

B: (bx, by, bz)

Vector: <ax - bx, ay - by, az - bz>

L: √( (ax - bx)² + (ay - by)² + (az - bz)² )

Unit vector: <(ax - bx) / L, (ay - by) / L>

So you get Cx = bx + D*(ax - bx) / L, Cy = by + D*(ay - by) / L, and Cz = bz + D*(az - bz) / L.

]]>Actually this is a directx 3d issue. I have 2 objects (a and b) on the scene and I would like to place the cam (object C, which will render the visible part of the 3d world) behind object b in the direction of object A. The cam is always positioned on a predefined distance of object B. So you know the positions of object A and B. In directx you work with 3 coordinates but this issue doesn't include the y (vertical) plane only horizontal and depth.

For example the coordinates of A are 50 (x) and 70 (z) and the coordinates of B are 10 (x) and 80 (z), the distance between B and C should be 5. What are the exact x and z coordinates of object C?

Actually, it would also be nice if you would have the formula for all 3 planes.

Thanks!

]]>Do you know the (x,y) of points A nd B? If so you can use slope etc to help you out.

Feel free to tell us more about your problem, and one of us can give you the formulas.

]]>My maths are a bit rusty.

I have 2 objects A and B in a 2 dimensional world. I need to calculate the x and y position of object C. C is positioned on the line between A and B and I know that for example the distance between B and C is 5. How can I get the position of B. I know I have to do something with the angles and cosinus or sinus. But I really complete forgot about this.

Hope anyone can help me with this, thanks.

]]>