Skip to content

Commit

Permalink
better merge for Centroid with vec
Browse files Browse the repository at this point in the history
  • Loading branch information
joshday committed Mar 17, 2020
1 parent 9f9f0c7 commit 2d655f7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/part.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,16 @@ Base.in(x, c::Centroid) = false
Base.isless(a::Centroid, b::Centroid) = isless(a.center, b.center)
Base.show(io::IO, c::Centroid) = print(io, "Centroid: $(c.center)")

function Base.merge!(a::Centroid, b::Centroid, astat, bstat)
function Base.merge!(a::Centroid{<:Number}, b::Centroid{<:Number}, astat, bstat)
w = nobs(bstat) / nobs(astat)
a.center = smooth(a.center, b.center, w)
a
end
function Base.merge!(a::Centroid, b::Centroid, astat, bstat)
w = nobs(bstat) / nobs(astat)
smooth!(a.center, b.center, w)
a
end

#-----------------------------------------------------------------------------# ClosedInterval
mutable struct ClosedInterval{T}
Expand Down

0 comments on commit 2d655f7

Please sign in to comment.