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
Aabb2 rotation broken #153
Comments
Hi, It would be great if you could send a pull request with the fix and a unit test to make sure we don't regress! Thanks, |
I'd like to write a fix, I'll see what I can do with my available time. I see there is a pull request #136 for Aabb2, which presumably implements rotations differently. I have not tested that code to see if it fixes this problem. I understand that you would like to move to the center + half-extents internal representation that #136 provides, but this involves removal of the min and max setters (replaced with setMinMax()) which is a breaking change (I don't see why the min and max setters need to be removed though). What are you thoughts on accepting #136? Would it be better to develop ceronman's implementation of Aabb2? |
@ArgentiApparatus Silly question, but what behavior do you expect from the Aabb2.rotate method? As your Aabb2 is one by one in size, shouldn't it remain the same if you rotate by a multiple of 90° around the z axis? Or would you expect its center to move, then Aabb2.transform should be the right choice. Right now the behavior is the following:
This means it applies the rotation to the box with the rotation axis at the center of the box. For me it's what I would expect from the method, for more complex things I would use Aabb2.transform. |
Ah, this may be my understanding then. I expected Aabb,rotate() to implementation rotation around an arbitary point, in my example the origin, so I would expect the result:
I think I thought that because Aabb,rotate() takes a Matrix3. |
I didn't wrote the method and never used it. But that is the only explanation I have ;-) In case it's not a bug, the function still needs better documentation... |
I've looked into
I'm not entirely sure that is completely correct behavior. What if the transform included a scaling or shear transformation? Shouldn't that be applied to the half-extents vector? I note that I'm not sure what the effect of 'absolute rotation on a vector' is supposed to be. Rotate the vector then take absolute value? Rotate through angle % π/2?
If you apply this to [x, 0], [-x, 0], [0, x] or [0, -x] it applies a rotation that 'folds back' at +/- π/2, so I suppose that was what 'absolute rotation' was intended to be. The effects are weird if one coordinate is not zero though. I'd be happy to work up a pull request if we can get some questions answered:
I'd like some options for
But that would a breaking change. Perhaps a separate pull request for version 2? BTW, what are the plans for a version 2 release? |
Can I get some opinions / answers to the questions posed above? I'd really like to create PR but want to make sure I'm doing the right thing. |
I believe this is because an absolute rotation is being applied to min and max separately.
The text was updated successfully, but these errors were encountered: