VoxelRotatedPolygonTest.frink

Download or view VoxelRotatedPolygonTest.frink in plain text format


/** This program tests the extrusion of a tapered polygon for 3D printing. */

sides = 7
angle = 90 deg  // Point at top
outerRadius = .5 in

res = 254/in

polygon = callJava["frink.graphics.Point2DFloatList", "makeRegularPolygon", [sides, outerRadius res, angle]]

v = callJava["frink.graphics.VoxelArray", "makeSphere", [1 in res]]

sides = [-1, 0, 1]
multifor [x, y, z] = [sides, sides, sides]
{
   println[[x,y,z]]
   v = v.union[callJava["frink.graphics.VoxelArray", "extrudeTapered", [polygon, x res in, y res in, z res in, 2x res in, 2y res in, 2z res in, 0, 0, 0, 1, 0 deg]]]
}

v.projectX[undef].show["X"]
v.projectY[undef].show["Y"]
v.projectZ[undef].show["Z"]

filename = "VoxelRotatedPolygonTest.obj"
print["Writing $filename..."]
w = new Writer[filename]
w.println[v.toObjFormat["rotate"]]
w.close[]
println["done."]


Download or view VoxelRotatedPolygonTest.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 20139 days, 6 hours, 53 minutes ago.