36 lines
577 B
Markdown
36 lines
577 B
Markdown
# Create a orthogonal Vector
|
|
|
|
For this we can use the dotproduct.
|
|
|
|
Example:
|
|
|
|
$V_1 = [1,6,2]$
|
|
$V_2 = ?$
|
|
|
|
We know that the dot product of these two vectors must be zero, we can use that
|
|
|
|
$V_1 \cdot V_2 = 0$
|
|
|
|
Let's plug in our numbers
|
|
|
|
$1 * V_2x + 6 * V_2y + 2 *V_2z = 0$
|
|
|
|
Lets choose arbitrary numbers for $V_2x$ and $V_2y$, for now $1$ because that makes the calculation a bit easier
|
|
|
|
$1*1+6*1+2*V_2z = 0$
|
|
|
|
$7+2V_2z = 0$
|
|
|
|
$V_2z = -3.5$
|
|
|
|
```ts
|
|
// Note the the resulting vector can be very large
|
|
function findOrthogonalVector([x,y,z]:number[]){
|
|
return [1,1,-((x+y)/z)]
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|