/** This program makes chopsticks with polygonal sides for 3-D printing. A Japanese TV show said that 5-sided or 7-sided chopsticks were more comfortable in the hand. This basiclaly tests the extrusion of a tapered polygon for 3D printing. */ polygon = newJava["frink.graphics.Point2DFloatList"] sides = 5 sideAngle = circle/sides angle = 90 deg // Point at top outerRadius = 9 mm / 2 tipRadius = 3.4 mm / 2 length = 9 in res = 254/in for i = 1 to sides { x = outerRadius cos[angle] res y = outerRadius sin[angle] res polygon.addPoint[x,y] angle = angle + sideAngle } v = callJava["frink.graphics.VoxelArray", "extrudeZTapered", [polygon, 0 in res, length res, outerRadius/outerRadius, tipRadius/outerRadius]] v.projectX[undef].show["X"] v.projectY[undef].show["Y"] v.projectZ[undef].show["Z"] filename = "Chopsticks${sides}x" + format[length, in, 1] + "od" + format[2 outerRadius, mm, 1] + "id" + format[2 tipRadius, mm, 1] + ".obj" print["Writing $filename..."] w = new Writer[filename] w.println[v.toObjFormat["chopsticks", 1/(res mm)]] w.close[] println["done."]