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

Don't restrict transformed point dim to input point dim in poly_convert #4584

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/basic_recipes/poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ function poly_convert(polygon::Polygon, transform_func=identity)
outer = coordinates(polygon.exterior)
# TODO consider applying f32 convert here too. We would need to identify this though...
PT = float_type(outer)
points = Vector{PT}[apply_transform(transform_func, outer)]
# Note that this should not be coerced to be a `Vector{PT}`,
# since `apply_transform` can change points from e.g 2D to 3D.
points = [apply_transform(transform_func, outer)]
points_flat = PT[outer;]
for inner in polygon.interiors
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some tests would be nice.
What about the PT[outer;]?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is fine, since points_flat contains the original points.

Will add some tests!

inner_points = coordinates(inner)
Expand Down
Loading