-
Notifications
You must be signed in to change notification settings - Fork 17
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 #78 #79
fix #78 #79
Conversation
Does anyone have time to review this? The code change is pretty small and the improvement is substantial, to put it in relative terms 😛 |
src/ellipse2d.jl
Outdated
@@ -15,16 +13,14 @@ function draw!(img::AbstractArray{T, 2}, ellipse::Ellipse, color::T) where T<:Co | |||
for j in ellipse.center.x : ellipse.center.x + ellipse.ρx | |||
val = ((i - ellipse.center.y) / ellipse.ρy) ^ 2 + ((j - ellipse.center.x) / ellipse.ρx) ^ 2 | |||
if val < 1 && val >= break_point | |||
push!(ys, i) | |||
push!(xs, j) | |||
yi = Int(i) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey yakir, please format it correctly, otherwise it looks good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh wow, I was really confused cause it looked fine in vim but off when I printed it out. Apparently some of the spaces here are tabs, which I think is discouraged (precisely for this reason).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks... but I think you used two spaces. The rest of the package uses four.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, fixed it now.
Looks good to me. The indenting looks a bit strange from my phone though. |
This file contained tab-spaces so I replaced them with (2) spaces, hope that doesn't go against the style guide of ImageDraw... |
This PR drammatically improves on performance for ellipse drawing:
before this PR:
After this PR: