Skip to content

Commit 2ed69bf

Browse files
authored
Merge pull request #8 from rdeits/v0.6-compat
fix compatibility with geometrytypes and julia v0.6
2 parents 5c4be5b + 04f280e commit 2ed69bf

File tree

5 files changed

+15
-18
lines changed

5 files changed

+15
-18
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ language: julia
33
os:
44
- linux
55
julia:
6-
- 0.4
7-
- 0.5
6+
- 0.6
87
- nightly
98
notifications:
109
email: false

REQUIRE

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
julia 0.4
2-
GeometryTypes 0.1.6
3-
Compat 0.8.6
1+
julia 0.6
2+
GeometryTypes 0.4

src/Meshing.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ VERSION >= v"0.4.0-dev+6521" && __precompile__()
33
module Meshing
44

55
using GeometryTypes
6-
using Compat
76

87
include("marching_tetrahedra.jl")
98
include("marching_cubes.jl")

src/marching_cubes.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ const tri_table = ((-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1),
278278
(-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1))
279279

280280
"""
281-
`marching_cubes(sdf::SignedDistanceField, [iso = 0.0,] [MT = HomogenousMesh{Point{3,Float64},Face{3,Int,0}}])`
281+
`marching_cubes(sdf::SignedDistanceField, [iso = 0.0,] [MT = HomogenousMesh{Point{3,Float64},Face{3,Int}}])`
282282
283283
Construct a `HomogenousMesh` from a `SignedDistanceField` using the
284284
marching cubes algorithm. This method is faster than Marching Tetrahedra
@@ -288,15 +288,15 @@ Tetrahedra guarentees a manifold mesh.
288288
"""
289289
function marching_cubes{ST,FT,M<:AbstractMesh}(sdf::SignedDistanceField{3,ST,FT},
290290
iso=0.0,
291-
MT::Type{M}=SimpleMesh{Point{3,Float64},Face{3,Int,0}})
291+
MT::Type{M}=SimpleMesh{Point{3,Float64},Face{3,Int}})
292292
nx, ny, nz = size(sdf)
293293
h = HyperRectangle(sdf)
294294
w = widths(h)
295295
s = Point{3,Float64}(w[1]/nx, w[2]/ny, w[3]/nz)
296296

297297
# arrays for vertices and faces
298298
vts = Point{3,Float64}[]
299-
fcs = Face{3,Int,0}[]
299+
fcs = Face{3,Int}[]
300300
vertlist = Vector{Point{3,Float64}}(12)
301301
@inbounds for xi = 1:nx-1, yi = 1:ny-1, zi = 1:nz-1
302302

@@ -381,7 +381,7 @@ function marching_cubes{ST,FT,M<:AbstractMesh}(sdf::SignedDistanceField{3,ST,FT}
381381
push!(vts, vertlist[tri_table[cubeindex][i+1]])
382382
push!(vts, vertlist[tri_table[cubeindex][i+2]])
383383
fct = length(vts)
384-
push!(fcs, Face{3,Int,0}(fct, fct-1, fct-2))
384+
push!(fcs, Face{3,Int}(fct, fct-1, fct-2))
385385
end
386386
end
387387
MT(vts,fcs)

src/marching_tetrahedra.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ immutable VoxelIndices{T <: Integer}
3030
tetEdgeCrnrs::NTuple{6,NTuple{2,T}}
3131
tetTri::NTuple{16,NTuple{6,T}}
3232

33-
function VoxelIndices()
33+
function VoxelIndices{T}() where {T <: Integer}
3434
voxCrnrPos = ((0, 0, 0),
3535
(0, 1, 0),
3636
(1, 1, 0),
@@ -109,7 +109,7 @@ immutable VoxelIndices{T <: Integer}
109109
(1,4,3,0,0,0),
110110
(0,0,0,0,0,0))
111111

112-
new(voxCrnrPos,
112+
new{T}(voxCrnrPos,
113113
voxEdgeCrnrs,
114114
voxEdgeDir,
115115
voxEdgeIx,
@@ -225,7 +225,7 @@ containers as necessary.
225225
function procVox{T<:Real, IType <: Integer}(vals::Vector{T}, iso::T,
226226
x::IType, y::IType, z::IType,
227227
nx::IType, ny::IType,
228-
vts::Dict{IType, Point{3,T}}, fcs::Vector{Face{3,IType,0}},
228+
vts::Dict{IType, Point{3,T}}, fcs::Vector{Face{3,IType}},
229229
eps::T, vxidx::VoxelIndices{IType})
230230

231231
# check each sub-tetrahedron in the voxel
@@ -239,7 +239,7 @@ function procVox{T<:Real, IType <: Integer}(vals::Vector{T}, iso::T,
239239
@inbounds e3 = vxidx.tetTri[tIx][j+2]
240240

241241
# add the face to the list
242-
push!(fcs, Face{3,IType,0}(
242+
push!(fcs, Face{3,IType}(
243243
getVertId(voxEdgeId(i, e1, vxidx), x, y, z, nx, ny, vals, iso, vts, eps, vxidx),
244244
getVertId(voxEdgeId(i, e2, vxidx), x, y, z, nx, ny, vals, iso, vts, eps, vxidx),
245245
getVertId(voxEdgeId(i, e3, vxidx), x, y, z, nx, ny, vals, iso, vts, eps, vxidx)))
@@ -254,7 +254,7 @@ an approximate isosurface by the method of marching tetrahedra.
254254
"""
255255
function marchingTetrahedra{T<:Real, IT <: Integer}(lsf::AbstractArray{T,3}, iso::T, eps::T, indextype::Type{IT})
256256
vts = Dict{indextype, Point{3,T}}()
257-
fcs = Array(Face{3,indextype,0}, 0)
257+
fcs = Array{Face{3,indextype}}(0)
258258
sizehint!(vts, div(length(lsf),8))
259259
sizehint!(fcs, div(length(lsf),4))
260260
const vxidx = VoxelIndices{indextype}()
@@ -284,7 +284,7 @@ function isosurface(lsf, isoval, eps, indextype=Int, index_start=one(Int))
284284
vtD[x] = k
285285
k += one(indextype)
286286
end
287-
fcAry = Face{3,indextype, index_start-1}[Face{3,indextype, index_start-1}(vtD[f[1]], vtD[f[2]], vtD[f[3]]) for f in fcs]
287+
fcAry = Face{3,indextype}[Face{3,indextype}(vtD[f[1]], vtD[f[2]], vtD[f[3]]) for f in fcs]
288288
vtAry = collect(values(vts))
289289

290290
(vtAry, fcAry)
@@ -293,14 +293,14 @@ end
293293
isosurface(lsf,isoval) = isosurface(lsf,isoval, convert(eltype(lsf), 0.001))
294294

295295

296-
@compat function (::Type{MT}){MT <: AbstractMesh, T}(volume::Array{T, 3}, iso_val::Real, eps_val=0.001)
296+
function (::Type{MT}){MT <: AbstractMesh, T}(volume::Array{T, 3}, iso_val::Real, eps_val=0.001)
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-
@compat function (::Type{MT}){MT <: AbstractMesh}(df::SignedDistanceField, eps_val=0.001)
303+
function (::Type{MT}){MT <: AbstractMesh}(df::SignedDistanceField, eps_val=0.001)
304304
vts, fcs = isosurface(df.data, 0.0, eps_val)
305305
MT(vts, fcs)
306306
end

0 commit comments

Comments
 (0)