Rodrigues Rotation Formula Module Numerical Issues
The origin of the issues is a divide by zero problem
Resolution of these issues must apply to both the Setup() and RotVector() functions.
The divide by zero problem arises when the Norm of a vector is computed.
Given vector V the Norm(V) is given by V/ sqrt(V dot V). If the dot product is zero then a division by zero will occur. The Norm is also called the unit vector and the components of the unit vector are the direction cosines.
The Rodrigues’ formula requires four different vectors to be Normed:
The vector A an argument to the Setup(A,B) function,
The vector B an argument to the Setup(A,B) function,
The vector C an argument to the RotVector(C) function, and
The vector K used in the Setup(A,B) function.
What should the Rodrigues formula return in each case?
Zero vectors as arguments.
A zero vector has the components [0, 0, 0] and its dot product is zero.
If vectors A and/or B are zero then Setup(A,B) should return the Norm of vector A. The RotVector(C) should return the Norm of vector C.
The K vector is the cross product of vectors A and B. K is a zero vector if
Vector A and/or B is a zero vector. Return the Norm of A.
Vectors A and B point in the same direction. Return the Norm of A.
Vectors A and B point in opposite directions. Return the -Norm of A.
These modifications have been implemented in the attached Rodrigues.js file.
This update functions with the previous test program testRodrigues1.js and with a new test file TestRodrigues10jan17.js
Files attached:
//testRodrigues1.js
//TestRodrigues10jan17.js
//Rodrigues10jan17.js as module //Rodrigues.js
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Rodrigues Rotation Formula Module Numerical Issues
The origin of the issues is a divide by zero problem
Resolution of these issues must apply to both the Setup() and RotVector() functions.
The divide by zero problem arises when the Norm of a vector is computed.
Given vector V the Norm(V) is given by V/ sqrt(V dot V). If the dot product is zero then a division by zero will occur. The Norm is also called the unit vector and the components of the unit vector are the direction cosines.
The Rodrigues’ formula requires four different vectors to be Normed:
The vector K used in the Setup(A,B) function.
What should the Rodrigues formula return in each case?
Zero vectors as arguments.
A zero vector has the components [0, 0, 0] and its dot product is zero.
If vectors A and/or B are zero then Setup(A,B) should return the Norm of vector A. The RotVector(C) should return the Norm of vector C.
The K vector is the cross product of vectors A and B. K is a zero vector if
Vector A and/or B is a zero vector. Return the Norm of A.
Vectors A and B point in the same direction. Return the Norm of A.
Vectors A and B point in opposite directions. Return the -Norm of A.
These modifications have been implemented in the attached Rodrigues.js file.
This update functions with the previous test program testRodrigues1.js and with a new test file TestRodrigues10jan17.js
Files attached:
//testRodrigues1.js
//TestRodrigues10jan17.js
//Rodrigues10jan17.js as module //Rodrigues.js
3 Attachments