-
-
Notifications
You must be signed in to change notification settings - Fork 438
Formal BBox struct #377
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
base: main
Are you sure you want to change the base?
Formal BBox struct #377
Conversation
fabd9d0
to
4e65ed6
Compare
0faf517
to
aa7a51d
Compare
Blocked on #378 |
aa7a51d
to
4776f60
Compare
src/bbox.rs
Outdated
pub fn from_str(s: &str) -> Result<Self, String> { | ||
let [min_lat, min_lng, max_lat, max_lng]: [f64; 4] = s | ||
.split(',') | ||
.map(|e| e.parse().unwrap()) |
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.
Should this return an Err
signifying parsing failure?
src/bbox.rs
Outdated
.map(|e| e.parse().unwrap()) | ||
.collect::<Vec<_>>() | ||
.try_into() | ||
.unwrap(); |
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.
Should this return an Err
? What cases will the try_into
fail?
4776f60
to
a6310f5
Compare
a6310f5
to
ad642c9
Compare
f705619
to
cbf8c53
Compare
4bb49de
to
e82b6aa
Compare
`BBox` represents a *valid* bounding box. It's only possible to have a BBox object that's valid.
e82b6aa
to
bf66730
Compare
This may or may not work with the GUI. I don't know, because I don't build or test the GUI. Soooo yeah, do with that knowledge what you will. |
My bbox code was a mess hahha! It doesn't run in GUI mode yet, but I'll take care of that and merge it! |
Alright, it's 3:30am now - let me know if this looks good to you or if I messed something up in your code! :D |
Does it sound good to represent the position data in two spaces: one real world system (in maybe 'spherical.rs' using LLPoint(the GeoCoord here) and LLBBox (the BBox here)), and a transformed mc system (in cartesian.rs currently, using XZPoint and XZBBox). This will make coordinate transformation much flexible and clearer. I just created the XZBBox struct and based the world editor on XZPoint, XZBBox, so it does not have to generate at (0,0), and I reserved the possibility to extend for more complex bbox shapes. |
Sure. You can merge this PR first and I will keep my #409 updated. These two are the components in a bigger architecture, and I will try to make them work seamlessly. |
We need a more standardized way to represent bounding boxes, as we kind of just throw the string around and parse it into the four corresponding values when we need to.
Fixes #375
To Do