0
$\begingroup$

Given a normal vector in 3D-Space, how can I rotate the vector, such it points to a point in 3D-Space.

I tried couple of ways doing this, which ended up looking completely wrong.

enter image description here

$\endgroup$
2
  • 1
    $\begingroup$ If the answer from @lightxbulb isn't what you are looking for then perhaps you could clarify your questions some. $\endgroup$
    – pmw1234
    Commented Oct 11, 2022 at 18:27
  • $\begingroup$ Vectors do not have position, only direction and magnitude, so creating a vector that "points to a point in 3D-Space" isn't possible. $\endgroup$
    – pmw1234
    Commented Nov 7, 2022 at 17:08

1 Answer 1

0
$\begingroup$

Let $e,f$ be the two edges of the triangle. Let's construct an orthonormal system: $e = normalize(e)$, $n = normalize(e\times f)$, $f = n \times e$, where $\times$ is the cross product. Now compute:

$$e' = e - \frac{e \cdot n'}{1+(n\cdot n')}(n+n')$$

$$f' = f - \frac{f \cdot n'}{1+(n\cdot n')}(n+n')$$

Then the rotation matrix is:

$$R = \begin{bmatrix} e' & f' & n'\end{bmatrix} \begin{bmatrix} e^T \\ f^T \\ n^T \end{bmatrix}.$$

Note that the computation of $e'$ and $f'$ breaks for $n' = -n$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.