/** This renders an egg with an embossed pattern on it for 3-D printing. */ use Plot3D.frink res = 254/in g = new graphics[] /* g.font["SansSerif", "bold", 10] g.text["Happy\nEaster!", 0, 0] img = g.toImage[undef, 400] img = img.gaussianBlur[3] img.show[] */ img = new image["https://frinklang.org/frinksamp/spiraleggblack.bmp"] img = img.circularBlur[15] img.show[] p = new Plot3D[] p.setBounds[-5, 5, -5, 5, -10, 0.1] p.setDoublings[9] p.setResolution[res] v = p.plot["(x^2 + y^2 + z^2)^2 <= -6 (1.5 z^3 + (1.5 - 1.1) z (y^2 + x^2))"] pixelTool = newJava["frink.graphics.VoxelArray", [0,2,0,2,0,2,true]] c = v.centerOfMass[] emboss = v.sphericalEmboss[img, c.x, c.y, c.z, 180 deg, 360 deg, 0 deg, 180 deg, 0, 200, -1.5 mm res, 0 cm res, 1.5 mm res, 0 cm res, pixelTool, 0, 0, 0] p.show[emboss] v = v.union[emboss] //v.remove[emboss] p.show[v] p.writeObj[v,"spiraleggsolid"] p.writeObj[emboss,"spiraleggshell"]