Skip to content
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

Merged
merged 12 commits into from Jul 8, 2013
Merged

[WIP] Add Aabb2 #22

merged 12 commits into from Jul 8, 2013

Conversation

laszlokorte
Copy link
Contributor

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)

@johnmccutchan
Copy link
Collaborator

Do you mind if we turn this into an Aabb2 and 3 pull request?

part of vector_math;

class Aabb2 {
Vector2 _min;
Copy link
Collaborator

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

@johnmccutchan
Copy link
Collaborator

We need translate, rotate, and transform.

@laszlokorte
Copy link
Contributor Author

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:
laszlokorte@2b9ae90

@laszlokorte
Copy link
Contributor Author

Now it should be right. Yesterday I did not notice that the Matrix needs one more dimension to make translation possible.

@johnmccutchan
Copy link
Collaborator

Need tests for rotate and transform.

@johnmccutchan
Copy link
Collaborator

Are there any AABB tests included in box2d that you could port over?

@laszlokorte
Copy link
Contributor Author

Box2d has no tests at all (besides the complete examples). I will add some tests for rotate and transform.

@johnmccutchan
Copy link
Collaborator

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?

@laszlokorte
Copy link
Contributor Author

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)
void Vector2_maxToOut(Vector2 a, Vector2 b, Vector2 out)
void Matrix2_solveToOut(Matrix2 a, Vector2 b, Vector2 out)
void Matrix3_solve22ToOut(Matrix3 a, Vector2 b, Vector2 out)
void Matrix3_solve33ToOut(Matrix3 a, Vector3 b, Vector3 out)

If you would like to have any of them in your library I could create another pull request.

@johnmccutchan
Copy link
Collaborator

A pull request for the solving methods would be great!

johnmccutchan added a commit that referenced this pull request Jul 8, 2013
@johnmccutchan johnmccutchan merged commit e81adac into google:master Jul 8, 2013
@johnmccutchan
Copy link
Collaborator

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants