Hi freinds i have problem with the implementation of the logic.

I have placed a node A(x,y,z) in the cubic box and at a particular distance from this node i need to place another node B.

I know x,y,z coordinates of the node A and this distacne at which i have to place the node B but i dont know the B node x,y,z coordiantes.

Could you plese help me out sloving this..

Thanks in advacne...

That's more of a math question than a C++ question.

At any rate, I believe it has something to do with the Pythagorean theorem. The 2D distance formula is sqrt((x2-x1)^2 + (y2-y1)^2) = D. I'm unsure what the 3D equation is.

Yes for three dimensional also ((x2-x1)^2 + (y2-y1)^2+(z2-z1)^2) = D. but i know here x1,y1,z1 and D..there are three unknown variables(x2,y2,z2)...how can we solve these three unkown variables is my question..anyway thanks friend for ur help.

Actually, those points which are D distance from noda A, form a sphere, so there are MANY (infinite) points in the space which could be node B. Choose x2 and y2 (both should be less than D), solve the equation for z2 and you have got node B.

There is another way if you know the direction to node B from node A. You should know two angles, but it's simpler in 2D, I don't know it for 3D.

Ohhm, sorry. abs(x2-x1) and abs(y2-y1) should be less than D.