-
Notifications
You must be signed in to change notification settings - Fork 28
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 by radians ? #61
Comments
Both rotate and shear functions could support an additional |
An alternative is to have
Should there be a way to set the snap distance / disable snapping ? |
Whatever is simplest. I'd figure adding an argument would be an easy approach. Keep in mind that the vast majority of users will be using degrees, so I'd prefer to keep this interface simple to see/learn/debug.
The "snapping" that I mention is to avoid values that are near 0, e.g. these values should all be snapped to zero: >>> import numpy as np
>>> np.sin(np.pi)
1.2246467991473532e-16
>>> np.sin(2*np.pi)
-2.4492935982947064e-16
>>> np.cos(np.pi/2)
6.123233995736766e-17
>>> np.cos(3*np.pi/2)
-1.8369701987210297e-16 |
That makes sense.
Oh, I see - I thought this was about angles close to multiples of 90 degrees. |
These are! 90=pi/2, 180=pi, 270=3pi/2, 360=2pi |
My fault for not staring at the numbers enough :) I can imagine an image editor might even want 45 degrees, but this may be YAGNI as I'm not making one right at this moment. |
Hmm, looking around the unit circle there are potentially other angle snap opportunities: >>> import numpy as np
>>> np.sqrt(2)/2 # exact 45
0.70710678118654757
>>> np.sin(np.pi/4)
0.70710678118654746
>>> np.cos(np.pi/4)
0.70710678118654757
>>> np.sin(np.pi/6)
0.49999999999999994 however, where does it end? I'm not sure how much benefit there could be, so I'm inclined to not do too much snapping. The biggest gain is identifying zero from sin/cos at the 90 degree intervals, otherwise very small coefficient values can creep in affine matrices. |
The In PERCENT the value is 0.0 to 1.0. |
While affine would be more consistent with Python's math module if it took radians instead of degrees, I'm 👎 on accepting both. For applications that are based on radians there is very little extra cost in writing |
In Affine, rotations are always in degrees, but it can sometimes be useful to expose radians.
If you are considering changing the API, would you consider exposing an API that works in radians ?
The text was updated successfully, but these errors were encountered: