Totally remove StaticArrays

This commit is contained in:
Michael Krabbe Borregaard 2019-01-16 11:23:02 +01:00
parent 8a66930f89
commit 8be5fdaab3
4 changed files with 12 additions and 14 deletions

View File

@ -10,7 +10,7 @@
--- ---
## (current master) ## (current master)
- changed behaviour of Vectors of length-2 and length-3 StaticVectors - Removed StaticArrays dependency and changed behaviour of Vectors of length-2 and length-3 StaticVectors
## 0.22.1 ## 0.22.1
- push PlotsDisplay just after REPLDisplay - push PlotsDisplay just after REPLDisplay

View File

@ -4,7 +4,6 @@ RecipesBase 0.6.0
PlotUtils 0.4.1 PlotUtils 0.4.1
PlotThemes 0.1.3 PlotThemes 0.1.3
Reexport Reexport
StaticArrays 0.5
FixedPointNumbers 0.3 FixedPointNumbers 0.3
Measures Measures
Showoff Showoff

View File

@ -4,7 +4,6 @@ _current_plots_version = v"0.20.6"
using Reexport using Reexport
import StaticArrays
using Dates, Printf, Statistics, Base64, LinearAlgebra, Random using Dates, Printf, Statistics, Base64, LinearAlgebra, Random
import SparseArrays: findnz import SparseArrays: findnz

View File

@ -1,12 +1,12 @@
const P2 = StaticArrays.SVector{2,Float64} const P2 = NTuple{2,Float64}
const P3 = StaticArrays.SVector{3,Float64} const P3 = NTuple{3,Float64}
nanpush!(a::AbstractVector{P2}, b) = (push!(a, P2(NaN,NaN)); push!(a, b)) nanpush!(a::AbstractVector{P2}, b) = (push!(a, (NaN,NaN)); push!(a, b))
nanappend!(a::AbstractVector{P2}, b) = (push!(a, P2(NaN,NaN)); append!(a, b)) nanappend!(a::AbstractVector{P2}, b) = (push!(a, (NaN,NaN)); append!(a, b))
nanpush!(a::AbstractVector{P3}, b) = (push!(a, P3(NaN,NaN,NaN)); push!(a, b)) nanpush!(a::AbstractVector{P3}, b) = (push!(a, (NaN,NaN,NaN)); push!(a, b))
nanappend!(a::AbstractVector{P3}, b) = (push!(a, P3(NaN,NaN,NaN)); append!(a, b)) nanappend!(a::AbstractVector{P3}, b) = (push!(a, (NaN,NaN,NaN)); append!(a, b))
compute_angle(v::P2) = (angle = atan(v[2], v[1]); angle < 0 ? 2π - angle : angle) compute_angle(v::P2) = (angle = atan(v[2], v[1]); angle < 0 ? 2π - angle : angle)
# ------------------------------------------------------------- # -------------------------------------------------------------
@ -104,7 +104,7 @@ function makecross(; offset = -0.5, radius = 1.0)
end end
from_polar(angle, dist) = P2(dist*cos(angle), dist*sin(angle)) from_polar(angle, dist) = (dist*cos(angle), dist*sin(angle))
function makearrowhead(angle; h = 2.0, w = 0.4) function makearrowhead(angle; h = 2.0, w = 0.4)
tip = from_polar(angle, h) tip = from_polar(angle, h)
@ -754,17 +754,17 @@ end
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
"create a BezierCurve for plotting" "create a BezierCurve for plotting"
mutable struct BezierCurve{T <: StaticArrays.SVector} mutable struct BezierCurve{T <: Tuple}
control_points::Vector{T} control_points::Vector{T}
end end
function (bc::BezierCurve)(t::Real) function (bc::BezierCurve)(t::Real)
p = zero(P2) p = zeros(2)
n = length(bc.control_points)-1 n = length(bc.control_points)-1
for i in 0:n for i in 0:n
p += bc.control_points[i+1] * binomial(n, i) * (1-t)^(n-i) * t^i @. p += bc.control_points[i+1] * binomial(n, i) * (1-t)^(n-i) * t^i
end end
p (p...,)
end end
# mean(x::Real, y::Real) = 0.5*(x+y) #commented out as I cannot see this used anywhere and it overwrites a Base method with different functionality # mean(x::Real, y::Real) = 0.5*(x+y) #commented out as I cannot see this used anywhere and it overwrites a Base method with different functionality