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

Sorting the coordinates of draw.ellipse #7232

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

anamfatima1304
Copy link
Contributor

Resolves #7206

This PR sorts the coordinates of the draw.ellipse by default on the basis of angles.

@lagru lagru added the ⏩ type: Enhancement Improve existing features label Nov 8, 2023
Comment on lines +527 to +533
# sorting on the basis of angle
rr = np.array(rr, dtype=np.intp)
cc = np.array(cc, dtype=np.intp)
angle = np.argsort(np.arctan2(cc-np.mean(cc),rr-np.mean(rr)))
rr = np.take(rr, angle, axis=0)
cc = np.take(cc, angle, axis=0)

Copy link
Member

Choose a reason for hiding this comment

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

Hey @anamfatima1304, thanks for working on this! In case you are not aware, this fails because this file is written in Cython. Similar to C, the variables rr and cc were declared with cdef list rr = ... so you can't assign an array to them because it is a different type.

Instead I would propose that you move this snippet to the Python level in ellipse_perimeter.

@mkcor
Copy link
Member

mkcor commented Nov 14, 2023

Hi @anamfatima1304,

don't hesitate to reach out if you need help with this PR!

@lagru
Copy link
Member

lagru commented Feb 22, 2024

Hey @anamfatima1304, are you planning to pick this up again? If not that's totally okay and someone else could continue the work! :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal: sort draw.ellipse coordinates by default to make sure they are all contiguous
3 participants