Skip to content

Commit a4c37c0

Browse files
committed
update docs and add default iso val of 0 for marching cubes
1 parent debc90a commit a4c37c0

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/marching_cubes.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,14 +278,16 @@ 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}}])`
282+
281283
Construct a `HomogenousMesh` from a `SignedDistanceField` using the
282284
marching cubes algorithm. This method is faster than Marching Tetrahedra
283285
and generates fewer vertices and faces (about 1/4 as many).
284286
However it may generate non-manifold meshes, while Marching
285287
Tetrahedra guarentees a manifold mesh.
286288
"""
287289
function marching_cubes{ST,FT,M<:AbstractMesh}(sdf::SignedDistanceField{3,ST,FT},
288-
iso,
290+
iso=0.0,
289291
MT::Type{M}=HomogenousMesh{Point{3,Float64},Face{3,Int,0}})
290292
nx, ny, nz = size(sdf)
291293
h = HyperRectangle(sdf)

test/runtests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ sdf = SignedDistanceField(HyperRectangle(Vec(-1,-1,-1.),Vec(2,2,2.))) do v
3838
end
3939

4040
m = marching_cubes(sdf,0)
41+
m2 = marching_cubes(sdf)
4142
@test length(vertices(m)) == 10968
4243
@test length(faces(m)) == 3656
44+
@test m == m2
4345

4446
if "--profile" in ARGS
4547
HomogenousMesh(s2)

0 commit comments

Comments
 (0)