2022-06-05 18:53:01 +02:00
|
|
|
# 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$
|
|
|
|
|
2022-06-16 14:03:54 +02:00
|
|
|
Let's plug in our numbers
|
2022-06-05 18:53:01 +02:00
|
|
|
|
|
|
|
$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)]
|
|
|
|
}
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|