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

Polygon filling API - Boundary Fill #57

Merged
merged 14 commits into from
May 13, 2021

Conversation

ashwani-rathee
Copy link
Member

Initial setup of the Polygon filling API

src/polygonfill2d.jl Outdated Show resolved Hide resolved
src/polygonfill2d.jl Outdated Show resolved Hide resolved
src/core.jl Outdated Show resolved Hide resolved
src/ImageDraw.jl Outdated Show resolved Hide resolved
Copy link
Member

@johnnychen94 johnnychen94 left a comment

Choose a reason for hiding this comment

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

Don't rush, be patient, do less copy. Be careful about your format. Try to read, analyze and find out what the real issue is before asking for help.

I'm asking this because I hope I can spend more time reviewing and discussing more PR-related issues instead of those trivial things that you could have fixed by yourself.

src/core.jl Outdated Show resolved Hide resolved
test/polygon2d.jl Outdated Show resolved Hide resolved
src/core.jl Outdated Show resolved Hide resolved
src/polygonfill2d.jl Outdated Show resolved Hide resolved
src/polygonfill2d.jl Outdated Show resolved Hide resolved
src/polygonfill2d.jl Outdated Show resolved Hide resolved
src/core.jl Outdated Show resolved Hide resolved
src/core.jl Outdated Show resolved Hide resolved
src/core.jl Outdated Show resolved Hide resolved
@ashwani-rathee ashwani-rathee changed the title Polygon filling API Polygon filling API - Boundary Fill Apr 26, 2021
Copy link
Member

@johnnychen94 johnnychen94 left a comment

Choose a reason for hiding this comment

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

The test failure on Julia 1.0 should be fixed by #59 It's because pkg resolving in old Julia versions are not smart enough in some cases. (You can run git rebase master to update your branch)

Mostly it looks good to me now. Hopefully, this is the last round review.

If you're not confident about the implementation, you can always add more tests to make sure of it.

src/core.jl Show resolved Hide resolved
src/core.jl Outdated Show resolved Hide resolved
src/core.jl Outdated Show resolved Hide resolved
src/core.jl Outdated Show resolved Hide resolved
src/polygonfill2d.jl Outdated Show resolved Hide resolved
src/polygonfill2d.jl Outdated Show resolved Hide resolved
src/polygonfill2d.jl Outdated Show resolved Hide resolved
@johnnychen94
Copy link
Member

@ashwani-rathee This PR a little bit long and old. Would you mind summarizing a little bit so that we can move forward quicker?

@ashwani-rathee
Copy link
Member Author

ashwani-rathee commented May 12, 2021

@johnnychen94 In the latest improvements( 2 days back, before that were git rebase master changes), 12 tests were added and methods for cartesian index, point were added and bounds check was added for vertices and seed point.

Copy link
Member

@johnnychen94 johnnychen94 left a comment

Choose a reason for hiding this comment

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

If I don't miss anything from previous comments, this should be the last round of review. Once it's fixed/answered, it should be good to merge.

You're starting to write good tests, that's good news 🎉 Do keep in mind: all reliable functionality is supported by more lines of codes of test cases.

src/polygonfill2d.jl Outdated Show resolved Hide resolved
src/core.jl Outdated Show resolved Hide resolved
src/core.jl Outdated Show resolved Hide resolved
@@ -56,11 +56,10 @@ function draw!(
) where N

# Boundscheck for verts
@boundscheck a = map(x -> (checkbounds(Bool, img, x[1], x[2]) ? nothing : throw(DomainError(x, "Vertice $x outside the image array domain"))), verts)

@boundscheck map(x -> (checkbounds(Bool, img, x[1], x[2]) ? nothing : throw(DomainError(x, "Vertice $x outside the image array domain"))), verts)
Copy link
Member

Choose a reason for hiding this comment

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

Oh boy, you can also change this to

Suggested change
@boundscheck map(x -> (checkbounds(Bool, img, x[1], x[2]) ? nothing : throw(DomainError(x, "Vertice $x outside the image array domain"))), verts)
@boundscheck foreach(x->checkbounds(img, x), verts)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I could have done that but that doesn't give information(in a concise way) to user what to correct 😕
Current expected error looks far more informative in my understanding I think.

    Expected: DomainError(CartesianIndex(0, 6), "Vertice CartesianIndex(0, 6) outside the image array domain")
      Thrown: BoundsError(ColorTypes.RGB[RGB{N0f8}(0.0,0.0,0.0) RGB{N0f8}(0.0,0.0,0.0) RGB{N0f8}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)], (CartesianIndex(0, 6),))
Stacktrace:

@johnnychen94 johnnychen94 merged commit 90d7279 into JuliaImages:master May 13, 2021
@ashwani-rathee ashwani-rathee deleted the boundary-fill branch May 14, 2021 03:19
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.

None yet

2 participants