@@ -30,7 +30,7 @@ immutable VoxelIndices{T <: Integer}
30
30
tetEdgeCrnrs:: NTuple{6,NTuple{2,T}}
31
31
tetTri:: NTuple{16,NTuple{6,T}}
32
32
33
- function VoxelIndices ()
33
+ function VoxelIndices {T} () where {T <: Integer }
34
34
voxCrnrPos = ((0 , 0 , 0 ),
35
35
(0 , 1 , 0 ),
36
36
(1 , 1 , 0 ),
@@ -109,7 +109,7 @@ immutable VoxelIndices{T <: Integer}
109
109
(1 ,4 ,3 ,0 ,0 ,0 ),
110
110
(0 ,0 ,0 ,0 ,0 ,0 ))
111
111
112
- new (voxCrnrPos,
112
+ new {T} (voxCrnrPos,
113
113
voxEdgeCrnrs,
114
114
voxEdgeDir,
115
115
voxEdgeIx,
@@ -225,7 +225,7 @@ containers as necessary.
225
225
function procVox {T<:Real, IType <: Integer} (vals:: Vector{T} , iso:: T ,
226
226
x:: IType , y:: IType , z:: IType ,
227
227
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}} ,
229
229
eps:: T , vxidx:: VoxelIndices{IType} )
230
230
231
231
# check each sub-tetrahedron in the voxel
@@ -239,7 +239,7 @@ function procVox{T<:Real, IType <: Integer}(vals::Vector{T}, iso::T,
239
239
@inbounds e3 = vxidx. tetTri[tIx][j+ 2 ]
240
240
241
241
# add the face to the list
242
- push! (fcs, Face {3,IType,0 } (
242
+ push! (fcs, Face {3,IType} (
243
243
getVertId (voxEdgeId (i, e1, vxidx), x, y, z, nx, ny, vals, iso, vts, eps, vxidx),
244
244
getVertId (voxEdgeId (i, e2, vxidx), x, y, z, nx, ny, vals, iso, vts, eps, vxidx),
245
245
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.
254
254
"""
255
255
function marchingTetrahedra {T<:Real, IT <: Integer} (lsf:: AbstractArray{T,3} , iso:: T , eps:: T , indextype:: Type{IT} )
256
256
vts = Dict {indextype, Point{3,T}} ()
257
- fcs = Array ( Face{3 ,indextype, 0 }, 0 )
257
+ fcs = Array { Face{3,indextype}} ( 0 )
258
258
sizehint! (vts, div (length (lsf),8 ))
259
259
sizehint! (fcs, div (length (lsf),4 ))
260
260
const vxidx = VoxelIndices {indextype} ()
@@ -284,7 +284,7 @@ function isosurface(lsf, isoval, eps, indextype=Int, index_start=one(Int))
284
284
vtD[x] = k
285
285
k += one (indextype)
286
286
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]
288
288
vtAry = collect (values (vts))
289
289
290
290
(vtAry, fcAry)
0 commit comments