[ https://issues.apache.org/jira/browse/MATH-1634?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17432992#comment-17432992 ]
Alex Herbert commented on MATH-1634: ------------------------------------ The geometry code has been ported to [Commons Geometry|https://commons.apache.org/proper/commons-geometry/] Can you verify if the same issue is present in the updated library? Please see the following links: * [User Guide - Euclidean|https://commons.apache.org/proper/commons-geometry/userguide/index.html#euclidean] for examples * [Javadoc - Euclidean|https://commons.apache.org/proper/commons-geometry/commons-geometry-euclidean/apidocs/index.html] > Quaternion representation of Rotation is incorrect > -------------------------------------------------- > > Key: MATH-1634 > URL: https://issues.apache.org/jira/browse/MATH-1634 > Project: Commons Math > Issue Type: Bug > Affects Versions: 3.6 > Reporter: Piotr Gutkowski > Priority: Major > Attachments: image-2021-10-22-13-12-53-900.png > > > Rotation is internally represented using quaternions. This representation is > not correct in terms of quaternion values, though aparently the Rotation > object behave correctly when it is constructed using angles or axes. > For example, consider following rotation: > Rotation r2 = {color:#000080}new {color}Rotation({color:#000080}new > {color}Vector3D({color:#0000ff}0{color},{color:#0000ff}0{color},{color:#0000ff}1{color}), > Math.{color:#660e7a}PI{color}/{color:#0000ff}2{color}, > {color:#660e7a}VECTOR_OPERATOR{color}); > It describes a counter-clockwise rotation around Z axis by 90 degrees, > similar to the example given here: > [https://commons.apache.org/proper/commons-math/javadocs/api-3.6/org/apache/commons/math3/geometry/euclidean/threed/RotationConvention.html#VECTOR_OPERATOR] > Such rotation should transform vector (1,0,0) into (0,1,0). > The values of quaternions for this rotation are: > !image-2021-10-22-13-12-53-900.png! > (recall that 0.7071 is approximately sqrt(2)/2) > Performing the rotation using quaternion algebra, corresponds to: > p = (1,0,0) = i > f(p) = q p q^(1) = (q0 + q3*k)*i*(q0 - q3*k) = -j > -j = (0, -1, 0) > where, i, j, k are imaginary unit vectors corresponding to axes x,y,z > respectively. > You can visualize quaternions here: > [https://eater.net/quaternions/video/intro] > to see that in fact these quaternion values would produce rotation by - 90 > degrees around Z axis. -- This message was sent by Atlassian Jira (v8.3.4#803005)