Your port is using WB_IsoSurface instead of HEC_IsoSurface used by the original sketch.
I still haven’t dug why your WB_IsoSurface fails.
But I did a Python Mode port of the original using HEC_IsoSurface.
Actually I did 2 versions: A java-ish and a pythonic.
The java-ish 1 uses an actual double[][][]
array w/ a triple loop.
While the pythonic 1 uses a 3d list comprehension as you did too.
“Ref_HEC_IsoSurface_Javaish.pyde”:
"""
Ref_HEC_IsoSurface (Java-ish version) (v1.0.1)
ported by GoToLoop (2019-Feb-21)
https://Discourse.Processing.org/t/
issue-when-porting-an-example-sketch-from-the-
hemesh-library-to-python-mode/8570/2
https://GitHub.com/wblut/HE_Mesh/blob/master/examples/
hemesh/create/Ref_HEC_IsoSurface/Ref_HEC_IsoSurface.pde
"""
add_library('hemesh')
from java.lang.reflect import Array
from java.lang import Double
DIM, N = 51, .07
DRANGE = tuple(range(DIM))
BG, FG = 070, 0
FPS = 'FPS: '
def setup():
size(800, 700, P3D)
smooth(8)
creator = HEC_IsoSurface()
creator.setResolution(50, 50, 50)
creator.setSize(8, 8, 8)
creator.setIsolevel(.6)
creator.setBoundary(-200)
creator.setGamma(.3)
creator.setInvert(False)
arr3d = Array.newInstance(Double.TYPE, DIM, DIM, DIM)
creator.setValues(arr3d)
for z, arr2d in enumerate(arr3d):
for y, arr1d in enumerate(arr2d):
for x in DRANGE: arr1d[x] = noise(N*x, N*y, N*z)
global render, mesh
render, mesh = WB_Render(this), HE_Mesh(creator)
def draw():
background(BG)
lights()
translate(width>>1, height>>1)
rotateY(TAU * mouseX / width)
rotateX(TAU * mouseY / height)
noStroke()
render.drawFaces(mesh)
stroke(FG)
render.drawEdges(mesh)
this.surface.title = FPS + `this.round(frameRate)`
“Ref_HEC_IsoSurface_Pythonic.pyde”:
"""
Ref_HEC_IsoSurface (Pythonic version) (v1.0.1)
ported by GoToLoop (2019-Feb-21)
https://Discourse.Processing.org/t/
issue-when-porting-an-example-sketch-from-the-
hemesh-library-to-python-mode/8570/2
https://GitHub.com/wblut/HE_Mesh/blob/master/examples/
hemesh/create/Ref_HEC_IsoSurface/Ref_HEC_IsoSurface.pde
"""
add_library('hemesh')
DIM, N = 51, .07
DRANGE = tuple(range(DIM))
BG, FG = 070, 0
FPS = 'FPS: '
def setup():
size(800, 700, P3D)
smooth(8)
creator = HEC_IsoSurface()
creator.setResolution(50, 50, 50)
creator.setSize(8, 8, 8)
creator.setIsolevel(.6)
creator.setBoundary(-200)
creator.setGamma(.3)
creator.setInvert(False)
creator.setValues(
[[[noise(N*x, N*y, N*z) for z in DRANGE]
for y in DRANGE] for x in DRANGE]
)
global render, mesh
render, mesh = WB_Render(this), HE_Mesh(creator)
def draw():
background(BG)
lights()
translate(width>>1, height>>1)
rotateY(TAU * mouseX / width)
rotateX(TAU * mouseY / height)
noStroke()
render.drawFaces(mesh)
stroke(FG)
render.drawEdges(mesh)
this.surface.title = FPS + `this.round(frameRate)`