3

How can I find projection of a point p=(x, y, z) on the line l(t)= q + vt? where v is the unit norm vector, and q is a point on the line

ron
  • 57
  • 4
  • 1
    what projection ? if perpendicular then simple dot product `dot(p-q,v)` will give you the distance to `q` see [`line closest(point p0,axis a0)`](https://stackoverflow.com/a/62257945/2521214). Funny I just made similar comment pointing to this for slightly different reason just a minute ago. – Spektre Apr 16 '21 at 07:53

1 Answers1

1

enter image description here

From this sketch, if we define define the vectors q = OQ and p = OP, then the orthogonal projection of p onto v is the component of p that follows the direction of v.

Or more explicitly, it's the vector ((p · v)/v²) · v = (p · v) · v, since v² = 1.

  • the `v²` should be `|v²|` however commonmark breaks the bold formatting if I add it ... also `p` should be relative to `q` so `((p-q).v)` in respect to OP notation. – Spektre Apr 17 '21 at 07:28
  • 1
    Hi @Spektre, **v²** and |v|² are equivalent, since **v²** = **v** · **v** = vvcos(0) = |v|². Also, please note that the unit vector **v** has already implicit **q** on it, since **v** = (**q'** - **q**)/(| **q'** - **q** |²) for some **q'**. The vector **p** is given and its coordinates are relative to O(0, 0, 0), not from **q** (why would you modify it by **p** - **q**?), The vector you say, ((**p** - **q**) · **v**) · **v**, is the projection of **p** - **r** onto **v**, but not the one of **p** onto **v**, which is what the OP is asking for. – Daniel Muñoz Parsapoormoghadam Apr 17 '21 at 08:40
  • 1
    Ahh English math notation ... when I look at `v²` I did not see its `(v.v)` ... I see no mention in OP about `p` is already relative to `q` but if the case you're right. – Spektre Apr 17 '21 at 08:43