-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rotating a vector is using left-multiplication. #101
Comments
I can't really comment on this.
I got the code doing what I needed it to do.
Although this is a very simple thing to do, there was very little
information I could find that wasn't either contradictory, or written in
simple english.
The internet is full of trash. The book I used as a reference for this was
incomplete.
As it stands, there are a few issues in the lib that need correction.
Unfortunately I'm both: not in a position to be able to resolve this (time
wise / job wise), and do not directly use this library anymore.
There have been some PRs but none has been complete and only add further
inconsistencies before the devs abandon their PRs.
Despite this library being used in a number of places (prideout used it in
a demo that made HN front page), no one is forth-coming with any help.
If you think you can resolve this and or any other issue, please feel free
to do so.
Simply documenting the issues (be they bugs or just lack of clarity)
through the issue tracker is great, there's no expectation of an issue
creator to fix them.
Just understand I'm not in a position to do so myself.
I would hate to see this lib disappear. But it deserves some love from
someone who has better domain knowledge than I.
…On Wed, Sep 2, 2020 at 1:57 AM kaufManu ***@***.***> wrote:
I'm not sure if this is an issue or not, but the following code snippet
just confused me a lot.
I am creating a rotation matrix that rotates around z by 90 degrees. This
means, when we rotate the x vector [1.0, 0.0, 0.0] by this rotation I
would expect to get the y vector [0.0, 1.0, 0.0]. As you can see from the
code snippet below however, using pyrr matrices and vectors, we obtain the
negative y vector, i.e. [0.0, -1.0, 0.0]. This is because pyrr is
applying the vector v from the left. So when converting a numpy rotation
matrix to pyrr.Matrix33 we should pass in its transpose to get the same
behavior.
May be this is what the documentation means by saying matrices are
row-major. But in any case, this is extremely confusing because when
printing the pyrr rotation matrix m the printout is exactly the same as
when printing the numpy rotation matrix rot.
import cv2import numpy as npfrom pyrr import Matrix33from pyrr.matrix33 import apply_to_vector
aa = np.array([0.0, 0.0, np.pi/2])rot = cv2.Rodrigues(aa)[0]
v = np.array([1.0, 0.0, 0.0])[:, np.newaxis]v_prime = np.matmul(rot, v)print('rotation matrix', rot)print('v_prime', v_prime)
m = Matrix33(rot)v_prime_pyrr = apply_to_vector(m, v.squeeze())print('rotation matrix', m)print('v_prime_pyrr', v_prime_pyrr)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#101>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJOQ5FTMG35CRWGWJW2BITSDUKWNANCNFSM4QR4NAYA>
.
|
I should also clarify. The main use case was OpenGL. Hence the matrices are
transposed.
On Wed, Sep 2, 2020 at 10:40 AM Adam Griffiths <[email protected]>
wrote:
… I can't really comment on this.
I got the code doing what I needed it to do.
Although this is a very simple thing to do, there was very little
information I could find that wasn't either contradictory, or written in
simple english.
The internet is full of trash. The book I used as a reference for this was
incomplete.
As it stands, there are a few issues in the lib that need correction.
Unfortunately I'm both: not in a position to be able to resolve this (time
wise / job wise), and do not directly use this library anymore.
There have been some PRs but none has been complete and only add further
inconsistencies before the devs abandon their PRs.
Despite this library being used in a number of places (prideout used it in
a demo that made HN front page), no one is forth-coming with any help.
If you think you can resolve this and or any other issue, please feel free
to do so.
Simply documenting the issues (be they bugs or just lack of clarity)
through the issue tracker is great, there's no expectation of an issue
creator to fix them.
Just understand I'm not in a position to do so myself.
I would hate to see this lib disappear. But it deserves some love from
someone who has better domain knowledge than I.
On Wed, Sep 2, 2020 at 1:57 AM kaufManu ***@***.***> wrote:
> I'm not sure if this is an issue or not, but the following code snippet
> just confused me a lot.
>
> I am creating a rotation matrix that rotates around z by 90 degrees. This
> means, when we rotate the x vector [1.0, 0.0, 0.0] by this rotation I
> would expect to get the y vector [0.0, 1.0, 0.0]. As you can see from
> the code snippet below however, using pyrr matrices and vectors, we obtain
> the negative y vector, i.e. [0.0, -1.0, 0.0]. This is because pyrr is
> applying the vector v from the left. So when converting a numpy rotation
> matrix to pyrr.Matrix33 we should pass in its transpose to get the same
> behavior.
>
> May be this is what the documentation means by saying matrices are
> row-major. But in any case, this is extremely confusing because when
> printing the pyrr rotation matrix m the printout is exactly the same as
> when printing the numpy rotation matrix rot.
>
> import cv2import numpy as npfrom pyrr import Matrix33from pyrr.matrix33 import apply_to_vector
> aa = np.array([0.0, 0.0, np.pi/2])rot = cv2.Rodrigues(aa)[0]
> v = np.array([1.0, 0.0, 0.0])[:, np.newaxis]v_prime = np.matmul(rot, v)print('rotation matrix', rot)print('v_prime', v_prime)
> m = Matrix33(rot)v_prime_pyrr = apply_to_vector(m, v.squeeze())print('rotation matrix', m)print('v_prime_pyrr', v_prime_pyrr)
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <#101>, or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAJOQ5FTMG35CRWGWJW2BITSDUKWNANCNFSM4QR4NAYA>
> .
>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm not sure if this is an issue or not, but the following code snippet just confused me a lot.
I am creating a rotation matrix that rotates around z by 90 degrees. This means, when we rotate the x vector
[1.0, 0.0, 0.0]
by this rotation I would expect to get the y vector[0.0, 1.0, 0.0]
. As you can see from the code snippet below however, using pyrr matrices and vectors, we obtain the negative y vector, i.e.[0.0, -1.0, 0.0]
. This is because pyrr is applying the vectorv
from the left. So when converting a numpy rotation matrix topyrr.Matrix33
we should pass in its transpose to get the same behavior.May be this is what the documentation means by saying matrices are row-major. But in any case, this is extremely confusing because when printing the pyrr rotation matrix
m
the printout is exactly the same as when printing the numpy rotation matrixrot
.The text was updated successfully, but these errors were encountered: