How to find 2d angles for 3d vectors?

1.3k Views Asked by At

I have three vectors in 3d that originate at a point. If I look at them along a line perpendicular to a plane that intersects two of them, how do I find the angles between those two vectors and the third one?

Clarification because this is frickin difficult to explain:

enter image description here

I'll also accept a way to find how much of the longest line is on either side of the shorter line, because that's ultimately what I need.

3

There are 3 best solutions below

5
On

Hi the dot product (1) is a great way to do that

here is a random video

it seems I need to develop here a bit further sorry about the links I just wanna help^^

lets $\vec{OA}=\vec{A},\vec{OB}=\vec{B},\vec{OC}=\vec{C}$ be three vectors in 3D.

In the special case where $\vec{A}$ is perpendicular to $\vec{B}$ you can project $\vec{C}$ into the plane define by the two vectors $\vec{A}$ and $\vec{B}$ as the following sum

"the projection of $\vec{C}$ on $\vec{A}$" + "the projection of $\vec{C}$ on $\vec{B}$"

so $\vec{C_{proj}} =(\frac{\vec{C}\cdotp\vec{A}}{\vec{A}\cdotp\vec{A}}\vec{A}+\frac{\vec{C}\cdotp\vec{B}}{\vec{B}\cdotp\vec{B}}\vec{B}) $

next you can find the angle between $\vec{C_{proj}}$ and $\vec{A}$ with the formule from the dot product:

$\theta=\arccos (\frac{\vec{C_{proj}}\cdotp\vec{A}}{\|\vec{C_{proj}}\|\|\vec{A}\|})$

EDITED for the case where $\vec{A}$ is not perpendicular to $\vec{B}$

the general case: $\vec{C_{proj}} = \vec{C}-\frac{\vec{C}\cdotp(\vec{A}\times\vec{B})}{(\vec{A}\times\vec{B})\cdotp(\vec{A}\times\vec{B})}(\vec{A}\times\vec{B})$

note:

$(\vec{A}\times\vec{B})$ is call the cross product of $\vec{A}$ and $\vec{B}$

$(\vec{A}\cdotp\vec{B})$ is call the dot product of $\vec{A}$ and $\vec{B}$

ps: don't forget there is always two possibles answers for the angle between two vectors $\theta$ and $(360-\theta)$ and think about rad or degrees

ANOTHER SOLUTION:

using @amd resoning you can find another formula for your end goal:

Let $\vec{N}=(\vec{A}\times\vec{B})\times\vec{C}$

then $\frac{\vec{A}\cdotp\vec{N}}{\vec{A}\cdotp\vec{N}+\vec{B}\cdotp\vec{N}}\|\vec{A}-\vec{B}\|$ and $\frac{\vec{B}\cdotp\vec{N}}{\vec{A}\cdotp\vec{N}+\vec{B}\cdotp\vec{N}}\|\vec{A}-\vec{B}\|$ are how much of the longest line is on either side of the shorter line.

you can interpret "the direction of $\vec{C_{proj}}$" as "the vertical black vector", $\vec{N}$ as X , the fraction in front as the ratio between one of the rectangle(green or red) divide by both combine while $\|\vec{A}-\vec{B}\|$ is the lenght of the "longest line" as you call it.enter image description here

cheers

3
On

$cos\phi = \frac{\vec v \bullet \vec u}{|\vec v|*|\vec u|}$

You also might need to project the vectors on the same plane, and than use the formulare, if you are referring to the vectors having a "2D angle" as having a certain angle when projected onto a shared plane.

0
On

I’m glad that you mentioned the problem that you’re ultimately trying to solve because that can be worked out directly from the three vectors without resorting to computing angles or projections. Essentially, you need to find the intersection point of the line through points $A$ and $B$ with the line defined by the projection of the third vector $C$ onto the plane $P$ spanned by $A$ and $B$. This is equivalent to computing the intersection of the line $AB$ (the extension of the longer diagonal in your illustration) with the plane perpendicular to $P$ that contains $C$.

So, let $N = (A\times B)\times C$. $A\times B$ is perpendicular to the plane $P$, and $N$ is perpendicular to both this and $C$, so it is normal to the plane with which we want to intersect the line. Every point on this plane satisfies the equation $N\cdot X=0$. Expressing the line $AB$ as $Q(t) = (1-t)A+tB$, we then solve $$N\cdot Q(t) = N\cdot\left((1-t)A+tB\right) = 0,$$ so $$t = {N\cdot A\over N\cdot A-N\cdot B}.\tag1$$ As long as the projection of $C$ lies between $A$ and $B$ as you’ve pictured, the denominator won’t vanish.

Now, this parameterization has the property that $t$ is equal to ${\lvert QA\rvert\over\lvert BA\rvert}$, so it gives you the proportion of the segment $AB$ that lies on the “$A$ side” of the intersection. If you want the actual distance, you need only multiply $t$ by the distance between $A$ and $B$.

This result makes geometric sense: For any point $X$, $N\cdot X$ is proportional to its distance from the plane defined by $N$; the sign tells you which side of the plane the point is on. So, formula (1) says that the distance to the intersection along the segment $AB$ is in proportion to the perpendicular distances to $P$, which can be demonstrated with similar triangles.