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

graphene_rect_union(): schema and implementation mismatch #49

Closed
ghost opened this issue Jan 18, 2016 · 3 comments
Closed

graphene_rect_union(): schema and implementation mismatch #49

ghost opened this issue Jan 18, 2016 · 3 comments

Comments

@ghost
Copy link

ghost commented Jan 18, 2016

I see that you've added schemas, that's nice.

But for graphene_rect_union(), the implementation doesn't do what the schema shows:

res->origin.x = MIN (ra.origin.x, rb.origin.x);
res->origin.y = MIN (ra.origin.y, rb.origin.y);

res->size.width = MAX (ra.size.width, rb.size.width);
res->size.height = MAX (ra.size.height, rb.size.height);

In other words, the schema shows the bounding rectangle, but the union() function does something else. That's why I said in the other bug that rectangle union was a strange operation to me.

@ebassi
Copy link
Owner

ebassi commented Jan 18, 2016

That's how the union works for two normalized rectangles: take the minimum of the origin coordinates, and take the maximum of the sizes.

@ebassi ebassi closed this as completed Jan 18, 2016
@ghost
Copy link
Author

ghost commented Jan 18, 2016

Note that in your schema, the blue outline is bigger than the orange rectangle.

ebassi added a commit that referenced this issue Jan 18, 2016
We need to take into consideration the origin of each rectangle when
comparing sizes.

Fixes #49.
@ebassi
Copy link
Owner

ebassi commented Jan 18, 2016

Yikes, I refactored it and completely borked, it at some point.

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

No branches or pull requests

1 participant