def octant(samples, isosurface, x_offset, y_offset, z_offset, spherefactor=1): array = octant_array(samples, isosurface, x_offset, y_offset, z_offset, spherefactor=spherefactor) logging.debug("array") logging.debug(array) # Extract the 0-isosurface #return mcubes.marching_cubes(array, 0) return gts.isosurface(array,0)
def main3(): logging.info("(this might take a while...)") t = time.time() # from stl import mesh samples = 200 radius = samples / 2.0 half = radius / 2.0 array = np.ndarray((samples, samples, samples)) for x in range(samples): for y in range(samples): for z in range(samples): noise = AMPLITUDE * pnoise3(x * FREQUENCY, y * FREQUENCY, z * FREQUENCY, octaves=2) array[x, y, z] = x ** 2 + y ** 2 + z ** 2 - half ** 2 + noise logging.debug("array") logging.debug(array) # Extract the 0-isosurface #vertices, triangles = mcubes.marching_cubes(array, 0) surface = gts.isosurface(array,0) logging.info("mesh completed in %f seconds" % (time.time() - t)) print surface surface.write(open('shape.gts', 'w'))