Skip to content

Commit fd3f180

Browse files
authored
Merge pull request #12 from JuliaGeometry/fbot/deps
Fix deprecations
2 parents 2ed69bf + f0ba694 commit fd3f180

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

src/marching_cubes.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,9 @@ and generates fewer vertices and faces (about 1/4 as many).
286286
However it may generate non-manifold meshes, while Marching
287287
Tetrahedra guarentees a manifold mesh.
288288
"""
289-
function marching_cubes{ST,FT,M<:AbstractMesh}(sdf::SignedDistanceField{3,ST,FT},
290-
iso=0.0,
291-
MT::Type{M}=SimpleMesh{Point{3,Float64},Face{3,Int}})
289+
function marching_cubes(sdf::SignedDistanceField{3,ST,FT},
290+
iso=0.0,
291+
MT::Type{M}=SimpleMesh{Point{3,Float64},Face{3,Int}}) where {ST,FT,M<:AbstractMesh}
292292
nx, ny, nz = size(sdf)
293293
h = HyperRectangle(sdf)
294294
w = widths(h)

src/marching_tetrahedra.jl

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Voxel corner and edge indexing conventions
2121
/
2222
X
2323
"""
24-
immutable VoxelIndices{T <: Integer}
24+
struct VoxelIndices{T <: Integer}
2525
voxCrnrPos::NTuple{8,NTuple{3,T}}
2626
voxEdgeCrnrs::NTuple{19, NTuple{2,T}}
2727
voxEdgeDir::NTuple{19,T}
@@ -124,7 +124,7 @@ end
124124
Checks if a voxel has faces. Should be false for most voxels.
125125
This function should be made as fast as possible.
126126
"""
127-
function hasFaces{T<:Real}(vals::Vector{T}, iso::T)
127+
function hasFaces(vals::Vector{T}, iso::T) where T<:Real
128128
@inbounds v = vals[1]
129129
if v < iso
130130
@inbounds for i=2:8
@@ -141,7 +141,7 @@ end
141141
"""
142142
Determines which case in the triangle table we are dealing with
143143
"""
144-
function tetIx{T<:Real, IType <: Integer}(tIx::IType, vals::Vector{T}, iso::T, vxidx::VoxelIndices{IType})
144+
function tetIx(tIx::IType, vals::Vector{T}, iso::T, vxidx::VoxelIndices{IType}) where {T<:Real, IType <: Integer}
145145
@inbounds v1 = vals[vxidx.subTets[tIx][1]]
146146
@inbounds v2 = vals[vxidx.subTets[tIx][2]]
147147
@inbounds v3 = vals[vxidx.subTets[tIx][3]]
@@ -159,8 +159,8 @@ two edges get the same index) and unique (every edge gets the same ID
159159
regardless of which of its neighboring voxels is asking for it) in order
160160
for vertex sharing to be implemented properly.
161161
"""
162-
function vertId{IType <: Integer}(e::IType, x::IType, y::IType, z::IType,
163-
nx::IType, ny::IType, vxidx::VoxelIndices{IType})
162+
function vertId(e::IType, x::IType, y::IType, z::IType,
163+
nx::IType, ny::IType, vxidx::VoxelIndices{IType}) where IType <: Integer
164164
@inbounds dx, dy, dz = vxidx.voxCrnrPos[vxidx.voxEdgeCrnrs[e][1]]
165165
vxidx.voxEdgeDir[e]+7*(x-1+dx+nx*(y-1+dy+ny*(z-1+dz)))
166166
end
@@ -171,8 +171,8 @@ occurs.
171171
eps represents the "bump" factor to keep vertices away from voxel
172172
corners (thereby preventing degeneracies).
173173
"""
174-
function vertPos{T<:Real, IType <: Integer}(e::IType, x::IType, y::IType, z::IType,
175-
vals::Vector{T}, iso::T, eps::T, vxidx::VoxelIndices{IType})
174+
function vertPos(e::IType, x::IType, y::IType, z::IType,
175+
vals::Vector{T}, iso::T, eps::T, vxidx::VoxelIndices{IType}) where {T<:Real, IType <: Integer}
176176

177177
@inbounds ixs = vxidx.voxEdgeCrnrs[e]
178178
@inbounds srcVal = vals[ixs[1]]
@@ -194,11 +194,11 @@ end
194194
Gets the vertex ID, adding it to the vertex dictionary if not already
195195
present.
196196
"""
197-
function getVertId{T<:Real, IType <: Integer}(e::IType, x::IType, y::IType, z::IType,
198-
nx::IType, ny::IType,
199-
vals::Vector{T}, iso::T,
200-
vts::Dict{IType, Point{3,T}},
201-
eps::T, vxidx::VoxelIndices{IType})
197+
function getVertId(e::IType, x::IType, y::IType, z::IType,
198+
nx::IType, ny::IType,
199+
vals::Vector{T}, iso::T,
200+
vts::Dict{IType, Point{3,T}},
201+
eps::T, vxidx::VoxelIndices{IType}) where {T<:Real, IType <: Integer}
202202

203203
vId = vertId(e, x, y, z, nx, ny, vxidx)
204204
if !haskey(vts, vId)
@@ -211,7 +211,7 @@ end
211211
Given a sub-tetrahedron case and a tetrahedron edge ID, determines the
212212
corresponding voxel edge ID.
213213
"""
214-
function voxEdgeId{IType <: Integer}(subTetIx::IType, tetEdgeIx::IType, vxidx::VoxelIndices{IType})
214+
function voxEdgeId(subTetIx::IType, tetEdgeIx::IType, vxidx::VoxelIndices{IType}) where IType <: Integer
215215
@inbounds srcVoxCrnr::IType = vxidx.subTets[subTetIx][vxidx.tetEdgeCrnrs[tetEdgeIx][1]]
216216
@inbounds tgtVoxCrnr::IType = vxidx.subTets[subTetIx][vxidx.tetEdgeCrnrs[tetEdgeIx][2]]
217217
@inbounds v = vxidx.voxEdgeIx[srcVoxCrnr][tgtVoxCrnr]
@@ -222,11 +222,11 @@ end
222222
Processes a voxel, adding any new vertices and faces to the given
223223
containers as necessary.
224224
"""
225-
function procVox{T<:Real, IType <: Integer}(vals::Vector{T}, iso::T,
226-
x::IType, y::IType, z::IType,
227-
nx::IType, ny::IType,
228-
vts::Dict{IType, Point{3,T}}, fcs::Vector{Face{3,IType}},
229-
eps::T, vxidx::VoxelIndices{IType})
225+
function procVox(vals::Vector{T}, iso::T,
226+
x::IType, y::IType, z::IType,
227+
nx::IType, ny::IType,
228+
vts::Dict{IType, Point{3,T}}, fcs::Vector{Face{3,IType}},
229+
eps::T, vxidx::VoxelIndices{IType}) where {T<:Real, IType <: Integer}
230230

231231
# check each sub-tetrahedron in the voxel
232232
for i::IType = 1:6
@@ -252,7 +252,7 @@ end
252252
Given a 3D array and an isovalue, extracts a mesh represention of the
253253
an approximate isosurface by the method of marching tetrahedra.
254254
"""
255-
function marchingTetrahedra{T<:Real, IT <: Integer}(lsf::AbstractArray{T,3}, iso::T, eps::T, indextype::Type{IT})
255+
function marchingTetrahedra(lsf::AbstractArray{T,3}, iso::T, eps::T, indextype::Type{IT}) where {T<:Real, IT <: Integer}
256256
vts = Dict{indextype, Point{3,T}}()
257257
fcs = Array{Face{3,indextype}}(0)
258258
sizehint!(vts, div(length(lsf),8))
@@ -293,14 +293,14 @@ end
293293
isosurface(lsf,isoval) = isosurface(lsf,isoval, convert(eltype(lsf), 0.001))
294294

295295

296-
function (::Type{MT}){MT <: AbstractMesh, T}(volume::Array{T, 3}, iso_val::Real, eps_val=0.001)
296+
function (::Type{MT})(volume::Array{T, 3}, iso_val::Real, eps_val=0.001) where {MT <: AbstractMesh, T}
297297
iso_val = convert(T, iso_val)
298298
eps_val = convert(T, eps_val)
299299
vts, fcs = isosurface(volume, iso_val, eps_val)
300300
MT(vts, fcs)
301301
end
302302

303-
function (::Type{MT}){MT <: AbstractMesh}(df::SignedDistanceField, eps_val=0.001)
303+
function (::Type{MT})(df::SignedDistanceField, eps_val=0.001) where MT <: AbstractMesh
304304
vts, fcs = isosurface(df.data, 0.0, eps_val)
305305
MT(vts, fcs)
306306
end

0 commit comments

Comments
 (0)