Skip to content
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

rotate command can not handle floats and is in radians instead of degrees #3

Open
DanielBalog86 opened this issue Nov 19, 2019 · 1 comment

Comments

@DanielBalog86
Copy link

The --rotate[xyz] command states that it rotates a mesh in degrees around a specified axis.

Doing some experiments I have drawn 2 conclusions:

  1. This is actually RADIANS
  2. I can not pass a floating point number (like 0.234) to the command. It only seems to parse integers.

I have worked around this issue by using the nearest multiple of 2*PI that resulted in a rough round number. This worked, which seems to confirm my suspicion.

@puzzud
Copy link

puzzud commented Jul 11, 2022

Due to the keen observation of @DanielBalog86 concerning radians instead of degrees, an easy fix is possible. In obj-magic.cpp, add radians function calls around the 2nd parameter for the calls to rotate, like the following:
if (rotangles.x != 0.0f) temprot = rotate(temprot, radians(rotangles.x), vec3(1,0,0));
if (rotangles.y != 0.0f) temprot = rotate(temprot, radians(rotangles.y), vec3(0,1,0));
if (rotangles.z != 0.0f) temprot = rotate(temprot, radians(rotangles.z), vec3(0,0,1));

However, I do not observe that floating point numbers cannot be properly used as input. Instead, I noticed that negative numbers cannot be used properly, similar to #5. If I supply -90, it's using -9. Fortunately, for rotation degrees, 270 can be used instead of -90. For translation, not so much.

In summary, this issue should be resolved with the fix above, leaving the float vs integers portion to another issue. From what I can tell, resolving #5 would improve things a bit if not fix any input parsing related issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants