<p>Let <span class="math-container">$e,f$</span> be the two edges of the triangle.  Let's construct an orthonormal system: <span class="math-container">$e = normalize(e)$</span>, <span class="math-container">$n = normalize(e\times f)$</span>, <span class="math-container">$f = n \times e$</span>, where <span class="math-container">$\times$</span> is the cross product. Now compute:</p>
<p><span class="math-container">$$e' = e - \frac{e \cdot n'}{1+(n\cdot n')}(n+n')$$</span></p>
<p><span class="math-container">$$f' = f - \frac{f \cdot n'}{1+(n\cdot n')}(n+n')$$</span></p>
<p>Then the rotation matrix is:</p>
<p><span class="math-container">$$R = \begin{bmatrix} e' &amp; f' &amp; n'\end{bmatrix} \begin{bmatrix} e^T \\ f^T \\ n^T \end{bmatrix}.$$</span></p>
<p>Note that the computation of <span class="math-container">$e'$</span> and <span class="math-container">$f'$</span>  breaks for <span class="math-container">$n' = -n$</span>.</p>

CC BY-SA 4.0
2022-10-07T22:12:38.513Z
2022-10-08T00:37:26.403Z
2022-10-08T00:37:26.403Z
lightxbulb
<p>Given a normal vector in 3D-Space, how can I rotate the vector, such it points to a point in 3D-Space.</p>
<p>I tried couple of ways doing this, which ended up looking completely wrong.</p>
<p><a href="https://i.sstatic.net/p2lsU.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/p2lsU.png" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2022-10-11T18:27:56.523Z
If the answer from @lightxbulb isn't what you are looking for then perhaps you could clarify your questions some.
pmw1234
CC BY-SA 4.0
2022-11-07T17:08:49.590Z
Vectors do not have position, only direction and magnitude, so creating a vector that "points to a point in 3D-Space" isn't possible.
pmw1234
<3d><mathematics><vector-graphics>
Point a normal vector towards a point in 3D-Space
user19022
# Point a normal vector towards a point in 3D-Space

(Asked by: username_0 on 2022-10-07)

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](https://i.sstatic.net/p2lsU.png)](https://i.sstatic.net/p2lsU.png)

**Tags:** 3d, mathematics, vector-graphics

> **Comments:**
> **username_1**: If the answer from @username_2 isn't what you are looking for then perhaps you could clarify your questions some.  
> **username_1**: Vectors do not have position, only direction and magnitude, so creating a vector that "points to a point in 3D-Space" isn't possible.  

---

## 1 answers

### Answer by username_2 on 2022-10-07. Score: 0

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$.


---

