Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd TypedBox2D. #320
Add TypedBox2D. #320
Conversation
|
r? @kvark |
src/box2d.rs, line 39 at r1 (raw file):
understanding that this is following existing logic in other modules, it seems unnecessary to have src/box2d.rs, line 47 at r1 (raw file):
I'm a little bit confused by the serialization here. Why does euclid have so much custom serialization code? Why is TypedRect serialized the same way as TypedBox2D (i.e via a tuple)? src/box2d.rs, line 62 at r1 (raw file):
All of that noise could be removed if we just say that src/box2d.rs, line 141 at r1 (raw file):
huh, it just hit me that we can get src/box2d.rs, line 171 at r1 (raw file):
nit: no need to return early if the rest of the body is so small src/box2d.rs, line 199 at r1 (raw file):
this looks inconsistent, shouldn't it be src/box2d.rs, line 212 at r1 (raw file):
This may need some clarity around negative box handling. Currently it's written as a negative box would contain an empty box src/box2d.rs, line 224 at r1 (raw file):
is it fine to be negative here? src/box2d.rs, line 265 at r1 (raw file):
could this use src/box2d.rs, line 326 at r1 (raw file):
is that really zero? is there a semantic difference between zero and a single-point box that is not zero? src/box2d.rs, line 329 at r1 (raw file):
could also be written with a src/box2d.rs, line 369 at r1 (raw file):
looks like there are too many constraints here src/box2d.rs, line 561 at r1 (raw file):
why is this written differently from src/box2d.rs, line 631 at r1 (raw file):
can we have any tests that |
I merely followed what was done with rect, so I don't know the answer for sure. The git history points to this commit: c50aa4f
I prefer to handle this in euclid at the cost of this boilerplate, although it's not a huge deal for me. That said I'd like to not make a breaking change if I can avoid it. We can always come back to this later if we feel it's worth the pain of breaking changes.
Unless I made a mistake the semantics are the same as
Good catch, fixed in the next revision.
Good point. I think that this should use
I'd say "yes", but it's up for debate. Negative rects are a thing mostly to be able to chain intersections with less overhead than if we had to juggle with the
I removed this assertion. It was there by symmetry with We could add
Sorry, my answer is again that it's the same as
I ended up removing the debug assertions you are referring to (it was only inner and outer box AFAICT). |
|
@bors-servo r+ |
|
|
Add TypedBox2D. This is the 2D equivalent of `TypedBox3D` introduced in #311. `TypedBox2D`'s endpoint representation is better suited for performing inclusion and intersection tests than `TypedRect` among other things. `TypedRect`'s origin + size representation might still be better for layout-ish things. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/euclid/320) <!-- Reviewable:end -->
|
|
nical commentedMar 5, 2019
•
edited by larsbergstrom
This is the 2D equivalent of
TypedBox3Dintroduced in #311.TypedBox2D's endpoint representation is better suited for performing inclusion and intersection tests thanTypedRectamong other things.TypedRect's origin + size representation might still be better for layout-ish things.This change is