diff --git a/src/animate.jl b/src/animate.jl index fd4694e..cbc7182 100644 --- a/src/animate.jl +++ b/src/animate.jl @@ -1,16 +1,3 @@ -""" -Interpolations.jl requires that one(::Type{T}) be defined for any data -type we want to interpolate. Rather than defining one(::Type{Vector}) here, -which might have unforeseen consequences in other packages, we'll create -a very simple wrapper type that just knows one() and * -""" -struct InterpolatableArray{A <: AbstractArray} - data::A -end - -Base.one(::Type{InterpolatableArray{A}}) where {A} = 1 -Base.:*(n::Number, a::InterpolatableArray) = n * a.data - """ animate(vis::MechanismVisualizer, times::Vector{Float64}, @@ -28,8 +15,7 @@ function animate(vis::MechanismVisualizer, @assert 0 < realtimerate < Inf state = vis.state - interp_values = [InterpolatableArray(c) for c in configurations] - interpolated_configurations = interpolate((times,), interp_values, Gridded(Linear())) + interpolated_configurations = interpolate((times,), configurations, Gridded(Linear())) t0, tf = first(times), last(times) framenum = 0 walltime0 = time() @@ -45,5 +31,5 @@ function animate(vis::MechanismVisualizer, end animate(mechanism::Mechanism, times::Vector{Float64}, - configurations::Vector{Vector{Float64}}) = - animate(Visualizer(mechanism), mechanism, times, configurations) + configurations::Vector{Vector{Float64}}; kw...) = + animate(MechanismVisualizer(mechanism), times, configurations; kw...)