-
Notifications
You must be signed in to change notification settings - Fork 41
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
(breaking) vec3: Rename angle_to -> angle_between #80
base: master
Are you sure you want to change the base?
Conversation
Nice. vec3.angle_to has a bug for same vec3. use
|
|
@xiejiangzhi I guess you mean the old code that I removed had that bug? I can add that test and ensure it passes:
I don't think angle_between should check for zero length vectors. At this low level, the user should be required to pass in valid inputs. There are very few asserts here and cpml doesn't have a way to strip asserts in production builds. Also, we have no correct result for (Also not sure how lua5.4 changes anything?) |
0 / 0 and acos(v) v > 1 will get nan. maybe same case make v > 1 in mycode. |
I found that in some cases I think it's because of floating point issues, |
506c8fd
to
179e717
Compare
In vec2, angle_to is signed and angle_between is unsigned. We only have the unsigned version in vec3, so use the corresponding name. Remove the vec3 implementation from vec2 and use vec2's style implementation. It doesn't allocate new vectors and works even if you somehow call vec3.angle_between(vec2(), vec2()).
179e717
to
19e54cf
Compare
Updated doc to mention nonzero inputs. I think handling @shakesoda How does it look? |
In vec2, angle_to is signed and angle_between is unsigned. We only have
the unsigned version in vec3, so use the corresponding name.
Remove the vec3 implementation from vec2 and use vec2's style
implementation. It doesn't allocate new vectors and works even if you
somehow call vec3.angle_between(vec2(), vec2()).