/** This is a test of cylindrical embossing for 3-D printing. */ res = 254/inch h = 1 inch r = .5 inch // Test on a cylinder v = callJava["frink.graphics.VoxelArray", "makeCylinder", [0,0,h/2 res,0,0,-h/2 res, r res]] // Or load an image. This one is blurred to give depth. //img = new image["file:treehouseLogoBlur2.png"] // Load the blurred image remotely img = new image["https://frinklang.org/frinksamp/treehouseLogoBlur2.png"] // 2-pixel cube tool for carving pixelTool = newJava["frink.graphics.VoxelArray", [0,2,0,2,0,2,true]] emboss = v.cylindricalEmboss[img, 0,0,0, 180 deg, 2 radians, .95 h res, 20, 255, 0 cm res, 0 cm res, 0 cm res, .2 cm res, pixelTool, 0, 0, 0] emboss2 = v.cylindricalEmboss[img, 0,0,0, 0 deg, 2 radians, .95 h res, 20, 255, 0 cm res, 0 cm res, 0 cm res, -.2 cm res, pixelTool, 0, 0, 0] v.remove[emboss] // Test removal v = v.union[emboss2] // Test addition //v = emboss // Just show embossing. v.projectX[undef].show["X"] v.projectY[undef].show["Y"] v.projectZ[undef].show["Z"] filename = "treehouseRollingPin.obj" print["Writing $filename..."] w = new Writer[filename] w.println[v.toObjFormat["v", 1/(res mm)]] w.close[] println["done."]