Skip to content

Commit

Permalink
add Volume
Browse files Browse the repository at this point in the history
  • Loading branch information
BeastyBlacksmith committed Mar 15, 2020
1 parent e7ce8b0 commit 1614aed
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions RecipesPipeline/src/default_recipes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,31 @@ for f in (:length, :size)
end
Base.copy(surf::Surface) = Surface(copy(surf.surf))
Base.eltype(surf::Surface{T}) where {T} = eltype(T)
#---
struct Volume{T}
v::Array{T,3}
x_extents::Tuple{T,T}
y_extents::Tuple{T,T}
z_extents::Tuple{T,T}
end

default_extents(::Type{T}) where {T} = (zero(T), one(T))

function Volume(v::Array{T,3},
x_extents = default_extents(T),
y_extents = default_extents(T),
z_extents = default_extents(T)) where T
Volume(v, x_extents, y_extents, z_extents)
end

Base.Array(vol::Volume) = vol.v
for f in (:length, :size)
@eval Base.$f(vol::Volume, args...) = $f(vol.v, args...)
end
Base.copy(vol::Volume{T}) where {T} = Volume{T}(copy(vol.v), vol.x_extents, vol.y_extents, vol.z_extents)
Base.eltype(vol::Volume{T}) where {T} = T

# -----------------------------------------------------------------------
# the catch-all recipes
RecipesBase.@recipe function f(::Type{SliceIt}, x, y, z)

Expand Down Expand Up @@ -57,8 +82,6 @@ RecipesBase.@recipe function f(::Type{SliceIt}, x, y, z)
ribbons = process_ribbon(rib, plotattributes)
mr = length(ribbons)

# @show zs

mx = length(xs)
my = length(ys)
mz = length(zs)
Expand Down

0 comments on commit 1614aed

Please sign in to comment.