-
-
Notifications
You must be signed in to change notification settings - Fork 351
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
Get rid of geom::Polygon union operations. They always produced invalid #981
Conversation
.zorder(1) | ||
.draw(main_route.draw) | ||
.build(ctx); | ||
if self.waypoints.get_waypoints().len() > 1 { |
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.
self.body | ||
.to_thick_boundary(CAR_WIDTH, OUTLINE_THICKNESS) | ||
.unwrap_or_else(|| self.body_polygon.clone()) | ||
fn get_outline(&self, _: &Map) -> Tessellation { |
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.
fn contains_pt(&self, pt: Pt2D, map: &Map) -> bool { | ||
self.get_outline(map).contains_pt(pt) | ||
} | ||
fn get_outline(&self, map: &Map) -> Tessellation; |
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.
Necessary because some buildings have holes. Polygon::to_outline
returns a Tessellation
now to handle that case. Returning a Vec<Polygon>
(one for exterior, one for each hole) is another option, but it's a gross API. For the callers that want Polygon
outlines for each individual ring, they can still do that themselves
self | ||
} | ||
|
||
/// Specifies the geometry of the object as a multipolygon. |
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.
The change here is to let something in a World
have multiple polygons as the hitbox. If more places in the code wind up needing something like this, then a MultiPolygon
type becomes useful. :)
@@ -38,10 +38,13 @@ impl ColorLegend { | |||
.map(|(idx, color)| ((idx as f64) / ((n - 1) as f64), *color)) | |||
.collect(), | |||
}), | |||
Polygon::union_all( | |||
Tessellation::union_all( |
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.
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.
LGTM
polygons. a-b-street/geom#2
CC @michaelkirk