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

draw_polygon does not fill in a square as I would expect #73

Open
AngledLuffa opened this issue Apr 19, 2016 · 2 comments
Open

draw_polygon does not fill in a square as I would expect #73

AngledLuffa opened this issue Apr 19, 2016 · 2 comments

Comments

@AngledLuffa
Copy link

If I call draw_polygon with a square, it leaves the top row unfilled. Here is a small example:

>>> offset_simplex = numpy.array([[0, 4], [4, 4], [4, 0], [0, 0]])
>>> canvas = numpy.zeros((5, 5))
>>> mahotas.polygon.fill_polygon(offset_simplex, canvas)
>>> print canvas
[[ 0.  0.  0.  0.  0.]
 [ 1.  1.  1.  1.  1.]
 [ 1.  1.  1.  1.  1.]
 [ 1.  1.  1.  1.  1.]
 [ 1.  1.  1.  1.  1.]]

I would expect the top row to be filled. Certainly one cannot fix this by setting the coordinates to -1, as then nothing gets drawn.

Thanks!

@luispedro
Copy link
Owner

I see what you mean, but I'm not too sure what to do about it. The definition of a polygon that mahotas uses does not include those points, but the API certainly is confusing. I am a bit weary of just changing the code to fix this case as it's not too clear what other things it implies. I'll have to read up on it/think about it.

@AngledLuffa
Copy link
Author

It's not clear in the documentation what definition is used or why it
wouldn't include the top. It's a little confusing that it would not
include the top, but does include the bottom, left, and right.

Thanks for looking!

On Wed, Apr 20, 2016 at 11:43 AM, Luis Pedro Coelho <
[email protected]> wrote:

I see what you mean, but I'm not too sure what to do about it. The
definition of a polygon that mahotas uses does not include those points,
but the API certainly is confusing. I am a bit weary of just changing the
code to fix this case as it's not too clear what other things it implies.
I'll have to read up on it/think about it.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#73 (comment)

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

No branches or pull requests

2 participants