Skip to content

Commit 130c5a2

Browse files
committed
minor cleanups to surfacenets
1 parent 3969a98 commit 130c5a2

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/surface_nets.jl

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,14 @@ function surface_nets(data, dims,eps,scale,origin)
139139
end
140140

141141
#Interpolate vertices and add up intersections (this can be done without multiplying)
142-
j = 0
143142
k = 1
144-
while j<3
143+
for j = 1:3
145144
a = e0 & k
146-
b = e1 & k;
145+
b = e1 & k
146+
(a != 0) && (v[j] += 1.0)
147147
if a != b
148-
v[j+1] += (a != 0 ? 1.0 - t : t)
149-
else
150-
v[j+1] += (a != 0 ? 1.0 : 0)
148+
v[j] += (a != 0 ? - t : t)
151149
end
152-
j+=1
153150
k<<=1
154151
end
155152
end # edge check
@@ -162,7 +159,7 @@ function surface_nets(data, dims,eps,scale,origin)
162159

163160
#Add vertex to buffer, store pointer to vertex index in buffer
164161
buffer[m+1] = length(vertices)
165-
push!(vertices, Point{3,Float64}(v[1],v[2],v[3]));
162+
push!(vertices, Point{3,Float64}(v[1],v[2],v[3]))
166163

167164
#Now we need to add faces together, to do this we just loop over 3 basis components
168165
for i=0:2

0 commit comments

Comments
 (0)