From 9540a3079469e03d5a2c5a78e24affb2fe9d7558 Mon Sep 17 00:00:00 2001 From: Robin Deits Date: Tue, 30 May 2017 13:54:04 -0400 Subject: [PATCH 1/4] fix compatibility with geometrytypes and julia v0.6 --- REQUIRE | 4 ++-- src/marching_cubes.jl | 8 ++++---- src/marching_tetrahedra.jl | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/REQUIRE b/REQUIRE index af3ca98..5d041c7 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,3 +1,3 @@ -julia 0.4 -GeometryTypes 0.1.6 +julia 0.6- +GeometryTypes 0.2.2 Compat 0.8.6 diff --git a/src/marching_cubes.jl b/src/marching_cubes.jl index 408332d..ee0bc05 100644 --- a/src/marching_cubes.jl +++ b/src/marching_cubes.jl @@ -278,7 +278,7 @@ const tri_table = ((-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1), (-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1)) """ -`marching_cubes(sdf::SignedDistanceField, [iso = 0.0,] [MT = HomogenousMesh{Point{3,Float64},Face{3,Int,0}}])` +`marching_cubes(sdf::SignedDistanceField, [iso = 0.0,] [MT = HomogenousMesh{Point{3,Float64},Face{3,Int}}])` Construct a `HomogenousMesh` from a `SignedDistanceField` using the marching cubes algorithm. This method is faster than Marching Tetrahedra @@ -288,7 +288,7 @@ Tetrahedra guarentees a manifold mesh. """ function marching_cubes{ST,FT,M<:AbstractMesh}(sdf::SignedDistanceField{3,ST,FT}, iso=0.0, - MT::Type{M}=SimpleMesh{Point{3,Float64},Face{3,Int,0}}) + MT::Type{M}=SimpleMesh{Point{3,Float64},Face{3,Int}}) nx, ny, nz = size(sdf) h = HyperRectangle(sdf) w = widths(h) @@ -296,7 +296,7 @@ function marching_cubes{ST,FT,M<:AbstractMesh}(sdf::SignedDistanceField{3,ST,FT} # arrays for vertices and faces vts = Point{3,Float64}[] - fcs = Face{3,Int,0}[] + fcs = Face{3,Int}[] vertlist = Vector{Point{3,Float64}}(12) @inbounds for xi = 1:nx-1, yi = 1:ny-1, zi = 1:nz-1 @@ -381,7 +381,7 @@ function marching_cubes{ST,FT,M<:AbstractMesh}(sdf::SignedDistanceField{3,ST,FT} push!(vts, vertlist[tri_table[cubeindex][i+1]]) push!(vts, vertlist[tri_table[cubeindex][i+2]]) fct = length(vts) - push!(fcs, Face{3,Int,0}(fct, fct-1, fct-2)) + push!(fcs, Face{3,Int}(fct, fct-1, fct-2)) end end MT(vts,fcs) diff --git a/src/marching_tetrahedra.jl b/src/marching_tetrahedra.jl index 127d6e5..2e72fd5 100644 --- a/src/marching_tetrahedra.jl +++ b/src/marching_tetrahedra.jl @@ -30,7 +30,7 @@ immutable VoxelIndices{T <: Integer} tetEdgeCrnrs::NTuple{6,NTuple{2,T}} tetTri::NTuple{16,NTuple{6,T}} - function VoxelIndices() + function VoxelIndices{T}() where {T <: Integer} voxCrnrPos = ((0, 0, 0), (0, 1, 0), (1, 1, 0), @@ -109,7 +109,7 @@ immutable VoxelIndices{T <: Integer} (1,4,3,0,0,0), (0,0,0,0,0,0)) - new(voxCrnrPos, + new{T}(voxCrnrPos, voxEdgeCrnrs, voxEdgeDir, voxEdgeIx, @@ -225,7 +225,7 @@ containers as necessary. function procVox{T<:Real, IType <: Integer}(vals::Vector{T}, iso::T, x::IType, y::IType, z::IType, nx::IType, ny::IType, - vts::Dict{IType, Point{3,T}}, fcs::Vector{Face{3,IType,0}}, + vts::Dict{IType, Point{3,T}}, fcs::Vector{Face{3,IType}}, eps::T, vxidx::VoxelIndices{IType}) # check each sub-tetrahedron in the voxel @@ -239,7 +239,7 @@ function procVox{T<:Real, IType <: Integer}(vals::Vector{T}, iso::T, @inbounds e3 = vxidx.tetTri[tIx][j+2] # add the face to the list - push!(fcs, Face{3,IType,0}( + push!(fcs, Face{3,IType}( getVertId(voxEdgeId(i, e1, vxidx), x, y, z, nx, ny, vals, iso, vts, eps, vxidx), getVertId(voxEdgeId(i, e2, vxidx), x, y, z, nx, ny, vals, iso, vts, eps, vxidx), 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. """ function marchingTetrahedra{T<:Real, IT <: Integer}(lsf::AbstractArray{T,3}, iso::T, eps::T, indextype::Type{IT}) vts = Dict{indextype, Point{3,T}}() - fcs = Array(Face{3,indextype,0}, 0) + fcs = Array{Face{3,indextype}}(0) sizehint!(vts, div(length(lsf),8)) sizehint!(fcs, div(length(lsf),4)) const vxidx = VoxelIndices{indextype}() @@ -284,7 +284,7 @@ function isosurface(lsf, isoval, eps, indextype=Int, index_start=one(Int)) vtD[x] = k k += one(indextype) end - 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] + fcAry = Face{3,indextype}[Face{3,indextype}(vtD[f[1]], vtD[f[2]], vtD[f[3]]) for f in fcs] vtAry = collect(values(vts)) (vtAry, fcAry) From 37fcf18a444112094fe475adb5f18646e991da0c Mon Sep 17 00:00:00 2001 From: Robin Deits Date: Wed, 31 May 2017 17:35:16 -0400 Subject: [PATCH 2/4] test 0.6 on travis --- .travis.yml | 3 +-- REQUIRE | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 07de1e6..0433b95 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,7 @@ language: julia os: - linux julia: - - 0.4 - - 0.5 + - 0.6 - nightly notifications: email: false diff --git a/REQUIRE b/REQUIRE index 5d041c7..a96298f 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,3 +1,3 @@ -julia 0.6- +julia 0.6-pre GeometryTypes 0.2.2 Compat 0.8.6 From f2be52be96d180a164bbafeb2bd90acd6f3e9f71 Mon Sep 17 00:00:00 2001 From: Robin Deits Date: Fri, 16 Jun 2017 23:22:19 -0400 Subject: [PATCH 3/4] require latest GeometryTypes; remove Compat --- REQUIRE | 3 +-- src/Meshing.jl | 1 - src/marching_tetrahedra.jl | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/REQUIRE b/REQUIRE index a96298f..87f819f 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,3 +1,2 @@ julia 0.6-pre -GeometryTypes 0.2.2 -Compat 0.8.6 +GeometryTypes 0.4 diff --git a/src/Meshing.jl b/src/Meshing.jl index e599d86..0e158a0 100644 --- a/src/Meshing.jl +++ b/src/Meshing.jl @@ -3,7 +3,6 @@ VERSION >= v"0.4.0-dev+6521" && __precompile__() module Meshing using GeometryTypes -using Compat include("marching_tetrahedra.jl") include("marching_cubes.jl") diff --git a/src/marching_tetrahedra.jl b/src/marching_tetrahedra.jl index 2e72fd5..f9c353b 100644 --- a/src/marching_tetrahedra.jl +++ b/src/marching_tetrahedra.jl @@ -293,14 +293,14 @@ end isosurface(lsf,isoval) = isosurface(lsf,isoval, convert(eltype(lsf), 0.001)) -@compat function (::Type{MT}){MT <: AbstractMesh, T}(volume::Array{T, 3}, iso_val::Real, eps_val=0.001) +function (::Type{MT}){MT <: AbstractMesh, T}(volume::Array{T, 3}, iso_val::Real, eps_val=0.001) iso_val = convert(T, iso_val) eps_val = convert(T, eps_val) vts, fcs = isosurface(volume, iso_val, eps_val) MT(vts, fcs) end -@compat function (::Type{MT}){MT <: AbstractMesh}(df::SignedDistanceField, eps_val=0.001) +function (::Type{MT}){MT <: AbstractMesh}(df::SignedDistanceField, eps_val=0.001) vts, fcs = isosurface(df.data, 0.0, eps_val) MT(vts, fcs) end From 04f280e7f43a67ff2186a8d09c9093e348f519a6 Mon Sep 17 00:00:00 2001 From: Robin Deits Date: Mon, 19 Jun 2017 19:56:35 -0400 Subject: [PATCH 4/4] require release 0.6 --- REQUIRE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/REQUIRE b/REQUIRE index 87f819f..5849e30 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,2 +1,2 @@ -julia 0.6-pre +julia 0.6 GeometryTypes 0.4