Find a point on a line that creates a perpendicular in 3D space

1.1k Views Asked by At

Visual of Question

Given the values of points A, B, and C, find the value of point D, where line BD is perpendicular to line AC.

This isn't homework, I'm creating a gizmo representation of "Spherecast" in unity. I know this is probably a pretty easy problem, I'm just really rusty with trig and can't find the right words in google.

1

There are 1 best solutions below

0
On BEST ANSWER

Since point $D$ will be on $AC$, then there exists a scalar $t \in \mathbb{R} $ such that

$ D = A + t (C - A) \hspace{20pt}(1)$

The vector $(C-A)$ is the direction vector of the ray $AC$. Now we want want $BD = D - B $ to be perpendicular to $(C - A)$. Then using dot product we must have

$ [(A - B) + t (C - A)] \cdot (C - A) = 0 \hspace{20pt} (2) $

From which, $ t = \dfrac{ (B - A) \cdot (C - A) }{ (C - A) \cdot (C - A) } \hspace{20pt}(3) $

Using $t$ from $(3)$ into $(1)$ gives the point $D$.