Post Reply 
Collaborative collection of useful userRPL snippets
03-26-2018, 08:32 AM
Post: #9
RE: Collaborative collection of useful userRPL snippets
I just had a quick look and noticed that the angle between vectors snippet is using the arccosine of the dot product. This has some numeric issues. Better is this formula:

\[angle\_between(\,\vec v_1, \vec v_2) =
\begin{cases}
\pi - 2 \, arcsin \frac{\mathopen|-\vec v_2 - \vec v_1\mathclose|}{2}, &\quad \vec v_1 \boldsymbol{\cdot} \vec v_2 < 0 \\
2 \, arcsin \frac{\mathopen|\,\vec v_2 - \vec v_1\mathclose|}{2}, &\quad\text{otherwise.} \\
\end{cases}
\]
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Collaborative collection of useful userRPL snippets - Paul Dale - 03-26-2018 08:32 AM



User(s) browsing this thread: 3 Guest(s)