Skip to content

Commit

Permalink
Merge f6e721b into ad440e9
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonDanisch committed Jul 11, 2017
2 parents ad440e9 + f6e721b commit 8c77576
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/SignedDistanceFields.jl
Expand Up @@ -57,14 +57,13 @@ function edf_sq(img)
end
end
end

df_sq
end

edf(img) = sqrt(edf_sq(img))
edf(img) = sqrt.(edf_sq(img))
edf(img, xsize, ysize=xsize) = downsample(edf(img), xsize, ysize)

sdf(img) = sqrt(edf_sq(img)) - sqrt(edf_sq(!img))
sdf(img) = sqrt.(edf_sq(img)) .- sqrt.(edf_sq(.!(img)))
sdf(img, xsize, ysize=xsize) = downsample(sdf(img), xsize, ysize)

function downsample(img, xsize, ysize=xsize)
Expand All @@ -74,7 +73,7 @@ function downsample(img, xsize, ysize=xsize)
# Make sure we're downsampling by integer amounts
@assert xrem == yrem == 0 "Downsampling by noninteger amounts is not supported"

out = Array(Float64, ysize, xsize)
out = Matrix{Float64}(ysize, xsize)
for y in 1:ysize
for x in 1:xsize
yinds = (1 + (y-1) * yscale):(y * yscale)
Expand Down

0 comments on commit 8c77576

Please sign in to comment.