signedAngleTwoVecto​rs

versión 3.0 (3.11 KB) por Seth Wagenman
Returns signed angle between two 3-D vectors in plane spanning them with direction determined either by the right hand rule or specification

175 descargas

Actualizada 2 Jul 2021

Ver licencia

Calculate the angle (in radians) between two three-D vectors defined as the angle from startVec to endVec in the plane defined by its normal vector being either the cross product or negation of startVec x endVec. Pass 1 for 'oneCaseFlag' if you are not passing matrices of row vectors.
Usage details for the 'rotateVec' argument are as follows: rotateVec is a user-specified (normal) vector pointing from the side of the plane that startVec and endVec lie in, which points in the direction about which the angle is measured. If you do not know what this normal vector is, then pass an empty vector and the function will substitute their cross product, but in this case the angles will always be positive, so the user must employ some other test external to the function to determine when the angle should be positive or negative based on the directions of input vectors startVec and endVec, and adjust accordingly.
For derivation of the implemented formulas, see StackOverflow answer at:
https://stackoverflow.com/a/33920320/12763497 or search for the term "signed angle between two 3D vectors with the same origin within the same plane" in the search bar and look for the 2015 answer by Adrian Leonhard. That proof is the basis of the corresponding post in math.stackexchange:
https://math.stackexchange.com/a/3759166/747468, which explains how to calculate the four-quadrant arctangent based on Adrian Leonhard's proof.

Citar como

Seth Wagenman (2022). signedAngleTwoVectors (https://www.mathworks.com/matlabcentral/fileexchange/78300-signedangletwovectors), MATLAB Central File Exchange. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2019b
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!