(breaking) vec3: Rename angle_to -> angle_between#80
(breaking) vec3: Rename angle_to -> angle_between#80idbrii wants to merge 1 commit intoexcessive:masterfrom
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()).