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

Rect constructor should enforce (min.x < max.x) and (min.y < max.y) #359

Closed
frewsxcv opened this issue May 6, 2019 · 2 comments
Closed

Comments

@frewsxcv
Copy link
Member

frewsxcv commented May 6, 2019

See Use case 1 in #354

bors bot added a commit that referenced this issue May 26, 2019
360: Adding Rect constructor to address issue #359:  r=frewsxcv a=Chopinsky

To address the issue #359 of lacking a Rect geo-type constructor that can perform coordinates validations, I've made the following changes: 
1. Add a `new` constructor to the Rect geo-type.
2. Update all internal use of the Rect struct literals to the new constructor.

However, existing use of the Rect struct literals in unit tests are left alone.

Co-authored-by: Jacob Zuo <[email protected]>
@rmanoka
Copy link
Contributor

rmanoka commented Jan 23, 2020

Please consider swapping the coords to enforce the constraint, rather than panic-ing if it is not true.

Use case: for instance, GDAL libraries use an inverted coord. system for the pixel vs world. That is, pixel (0,0) is top-left of raster in accordance with usual CV notion, while the min in true world coords (such as long, lat or other projected coords) occurs at bottom-left of the raster.

It is intuitive to provide a point-wise transform function, which is expected to work on all shapes. Unfortunately, it breaks down with Rect due to the aforementioned panic.

Can provide a PR if this makes sense to you.

@michaelkirk
Copy link
Member

Looks like this was resolved with #360

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

3 participants