   Projection of a point on a line !
  Hello, I have three non colinear,3D points A,B and C defined in cartesian coordinate system. Projection of C on the line defined by A and B is found as AC Cos(Theta) where Theta is angle between AC and AB, AC and AB are vectors joining A to B and A to C respectively.Say this projection is X. In order to get a specific value of this projection say y, I need to change the position of point C to E keeping E in the same plane as defined by A,B and C.In order to achieve that I add a vector CE to point C (essentially a vector from from origin (0,0,0))where magnitude of CE is equal to absolute value of y-x and the direction is same as that of AB.This must give me the coordinates of point E and I think moving the point C along the direction same as that of AB will keep it in the same plane.In order to check if this has been done correctly when I find the projection of AE on AB as discussed above, it doesnt turn out to be y. With different sets of point values it turns out to be less as well as greater than the expected value of y.I can't really tell you how much time I have already spent to figure out what is going on . Any thoughts?   
  The projection of the point C onto the vector AB is just A + AB*dot(AC,AB)/dot(AB,AB), where XY is shorthand for the vector (Y-X).  I don't really follow the other method you described.   ;  If y < x, then the direction of the added vector needs to be BA. That is, the added vector should be (y-x)nAB, where nAB is AB normalised.   ;  Thanks for reply guys !Guntharpo wrote:"If y < x, then the direction of the added vector needs to be BA. That is, the added vector should be (y-x)nAB, where nAB is AB normalised."    In my last post I wrote:"In order to achieve that I add a vector CE to point C (essentially a vector from from origin (0,0,0))where magnitude of CE is equal to absolute value of y-x and the direction is same as that of AB."   The use of absolute value of y-x serves the same purpose as you mentioned.Say if y=4 and x=3, the absolute value of y-x will be 1 and CE=1*nAB=nAB;while on the other hand as you mentioned CE=(y-x)*nBA= -1*nBA= nAB (as nBA=-nAB).Zipster wrote:"The projection of the point C onto the vector AB is just A + AB*dot(AC,AB)/dot(AB,AB), where XY is shorthand for the vector (Y-X). I don't really follow the other method you described".   Am I missing something in the formula because I don't see XY in it.Can you please elaborate it a bit. I will really appreciate it.Any other kind thoughts please......   ;  The use of absolute value means you will never get a point E with y < x. Say if x = 4 and y = 3; then you will add |y - x| nAB = 1 nAB to C, and your new y will be 5, not what you wanted. It might help us help you if you provide some sample input and output that isn't working for you. You could also post your source code; whether or not your concept is correct the implementation could be defective.   ;Quote:Original post by Phi XuZipster wrote:"The projection of the point C onto the vector AB is just A + AB*dot(AC,AB)/dot(AB,AB), where XY is shorthand for the vector (Y-X). I don't really follow the other method you described".   Am I missing something in the formula because I don't see XY in it.Can you please elaborate it a bit. I will really appreciate it.My apologies, I was just elaborating on the fact that something written as XY means the vector (Y-X).  X and Y are any two arbitrary points (variables basically) [smile]   