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
[WIP] Add Aabb2 #22
[WIP] Add Aabb2 #22
Conversation
Do you mind if we turn this into an Aabb2 and 3 pull request? |
part of vector_math; | ||
|
||
class Aabb2 { | ||
Vector2 _min; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you mark these final?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
We need translate, rotate, and transform. |
I have made the fields final and renamed setFromCombination to hull. Regarding the transformation and rotation I think I need some help. I am not quite sure if this is correct: |
Now it should be right. Yesterday I did not notice that the Matrix needs one more dimension to make translation possible. |
Need tests for rotate and transform. |
Are there any AABB tests included in box2d that you could port over? |
Box2d has no tests at all (besides the complete examples). I will add some tests for rotate and transform. |
Cool. Once you have those tests this LGTM. Thanks again! Anything else you need to help you finish the port of box2d to vector_math? |
I have added some tests. There are some other methods box2d uses. For me it is just fine to keep them as functions in box2d as some of them are just called 2 or 3 times and I am not sure how useful they are in other projects: void Vector2_minToOut(Vector2 a, Vector2 b, Vector2 out) If you would like to have any of them in your library I could create another pull request. |
A pull request for the solving methods would be great! |
Thanks! |
This adds an Aabb2 class to the library.
Currently it has no transform and rotate methods because I am not quite sure what exactly the difference between absoluteRotate and transform are and why the Aabb3 class takes an Matrix4 instead of Matrix3.
But the Aabb2 class has the following three methods, which could also be added to the Aabb3 class:
void setFromCombination(Aabb2 a, Aabb2 b)
bool contains(Aabb2 other)
bool intersectsWith(Aabb2 other)