/** This is a test of cylindrical embossing for 3-D printing. */ res = 254/inch h = 1 inch r = 1 inch // Test on a cylinder // v = callJava["frink.graphics.VoxelArray", "makeCylinder", [0,0,h/2 res,0,0,-h/2 res, r res]] // Test on a cuboid /*v = callJava["frink.graphics.VoxelArray", "cube", [-r/2 res, r/2 res, -r/2 res, r/2 res, -h/2 res, h/2 res, true]] */ // Or a sphere v = callJava["frink.graphics.VoxelArray", "makeSphere", [r res]] // Load an image //img = new image["file:Frink100.png"] //img = new image["file:aiFabric-knitPattern_depth2.jpg"] img = new image["https://frinklang.org/frinksamp/FrinkRules.png"] // Or create one from text /*g = new graphics g.font["SansSerif", "bold", 10] g.text["Frink Rules!",0,0] img = g.toImage[undef, 200] img.show[] */ // 2-pixel cube tool for testing pixelTool = newJava["frink.graphics.VoxelArray", [0,2,0,2,0,2,true]] //emboss = v.sphericalEmboss[img, 0,0,0, 180 deg, 360 deg, 0 deg, 90 deg, 0, 192, -.2 cm res, 0 cm res, .5 cm res, 0 cm res, pixelTool, 0, 0, 0] emboss = v.sphericalEmboss[img, 0,0,0, 180 deg, 360 deg, 0 deg, 180 deg, 0, 255, 0 cm res, 0 cm res, 0 cm res, -.5 cm res, pixelTool, 0, 0, 0] // Comment in one of these lines to test various uses of the embossed data. //v.remove[emboss] // Test removal v = v.union[emboss] // Test addition //v = emboss // Just show embossing. v.projectX[undef].show["X"] v.projectY[undef].show["Y"] v.projectZ[undef].show["Z"] filename = "sphericalEmbossGray.obj" print["Writing $filename..."] w = new Writer[filename] w.println[v.toObjFormat["v", 1/(res mm)]] w.close[] println["done."]