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

Fix polygonize with LinRange #190

Closed
wants to merge 2 commits into from
Closed

Fix polygonize with LinRange #190

wants to merge 2 commits into from

Conversation

asinghvi17
Copy link
Member

Fix #187

@asinghvi17 asinghvi17 requested a review from rafaqz July 30, 2024 03:55
@rafaqz
Copy link
Member

rafaqz commented Jul 30, 2024

Did you load OffsetArrays.jl and see if that still works?

@rafaqz
Copy link
Member

rafaqz commented Jul 30, 2024

I think we should get rid of similar and just define the undef vector

@asinghvi17
Copy link
Member Author

asinghvi17 commented Jul 30, 2024

Yes, this seems to work with and without OffsetArrays loaded, but I'll add a test anyway

@@ -121,8 +121,8 @@ function _polygonize(f::Base.Callable, xs::AbstractRange, ys::AbstractRange, A::
ybounds = first(ys) - yhalf : step(ys) : last(ys) + yhalf
Tx = eltype(xbounds)
Ty = eltype(ybounds)
xvec = similar(Vector{Tuple{Tx,Tx}}, xs)
yvec = similar(Vector{Tuple{Ty,Ty}}, ys)
xvec = similar(Vector{Tuple{Tx,Tx}}, axes(xs))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
xvec = similar(Vector{Tuple{Tx,Tx}}, axes(xs))
xvec = Vector{Vector{Tuple{Tx,Tx}}}(undef, length(axes(xs)))

Wont something like this work and skip the complexity of similar?

@tiemvanderdeure
Copy link
Contributor

Now that #202 is merged we should close this

@rafaqz rafaqz closed this Sep 6, 2024
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

Successfully merging this pull request may close these issues.

Polygonize example is broken
3 participants