Flatten 3D VectorA so it's perpendicular to VectorB

823 Views Asked by At

Basically I have 2 3D vectors: Vector A (green) and vector B(red).

enter image description here

I need to calculate a third vector that is perpendicular to VectorA (green) but points in the same direction than VectorB (red). Kinda like "flattening" VectorB.

Please ask me any question to clarify or edit the question if you got it and can make it more clear, I'm completely new to 3d vectors.

EDIT

Here's another example, I added a plane perpendicular to VectorA (the white area). The resulting vector should be in that plane.

enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

I think what you are talking about is called vector projection. In order to project b from a, you could use the formula: $$ b' = b - {b \cdot a \over a \cdot a} a $$ This can be thought of as the part of b travelling perpendicular to a.