Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Projection of a point onto a line in 3-space.

  1. Jan 12, 2012 #1
    I am working on an implementation of the Gilbert–Johnson–Keerthi distance algorithm and am having difficulty with some of the more general math involved.

    I am able to find the projection of a point onto a plane because I'm given at least three points on the plane and the point that is to be projected. I can form two vectors given the three points on the plane and take the cross product of those two vectors to create a vector orthogonal to both vectors in addition to the plane.

    I am unsure how to do this when projecting a point onto a line, however. I know two points on the line and the point that is to be projected. There are an infinite number of vectors perpendicular to this line, but the one that also goes through the given point not on the line should be the vector I'm looking for.

    I'd also like to note that I am using a single data structure to represent both points and vectors in 3-space. A structure containing the data {0, 0, 0} could represent a point at the origin or a vector with zero magnitude. A structure containing the data {3,4,0} could represent a point where x=3, y=4, and z=0 or it could represent a vector whose tail is at the origin and whose head is at the point where x=3, y=4, and z=0. In the implementation I am using, vector tails are always placed at the origin, and vector heads are placed at the given x,y,z coordinate. This makes it a little more difficult to think about the problem, for me at least.
     
  2. jcsd
  3. Jan 12, 2012 #2

    AlephZero

    User Avatar
    Science Advisor
    Homework Helper

    If you have a line AB and a point P, this is a 2D problem (on a plane with an arbitrary orientation in 3D space, of course).

    The point of intersection Q is a linear interpolation between the points A and B. So Q = A + s(B-A) for some value of s.

    Then you have the dot-product AB . PQ = 0 to find s.
     
  4. Jan 13, 2012 #3

    HallsofIvy

    User Avatar
    Staff Emeritus
    Science Advisor

    Assuming you mean orthogonal projection, the simplest way to find the projection of point [itex]P= (x_0, y_0, z_0)[/itex] on line l given by parametric equations [itex]x= at+ b[/itex], [itex]y= ct+ d[/itex], [itex]z= et+ f[/itex], is to determine to plane perpendicular to l that contains P- that will be, of course, a(x-x_0)+ c(y-y_0)+ e(z- z_0)= 0- and determine where the given line crosses that plane.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Projection of a point onto a line in 3-space.
  1. 3 Points in a line! (Replies: 4)

Loading...