/** This tests supertoroid generation in Frink's 3D routines (notably frink.graphics.VoxelArray.makeSupertoroid ) and was used to fix the bounding box calculation problem when rx != ry It now calculates a correct minimal bounding box for all cases. Frink's 3-D routines: https://frinklang.org/3d/ (especially the VoxelArray class) For more information on supertoroids, see: https://cse.buffalo.edu/~jryde/cse673/files/superquadrics.pdf for the equation http://paulbourke.net/geometry/toroidal/ for graphs of the equation families. */ res = 254/in r = 100 // Radius of large ring rx = 10 // Radius of small ring in x direction ry = 20 // Radius of small ring in y direction rz = 45 // Radius of small ring in z direction // Eccentricities of the large and small ring. // (1=circle, 2=diamond, less than 1 is puffy rounded square, greater than 2 // is a pinched diamond. See links above for examples. ) eLarge = 1 // Eccentricity of large ring eSmall = 1 // Eccentricity of small ring. outer = callJava["frink.graphics.VoxelArray", "makeSupertoroid", [r, rx, ry, rz, eSmall, eLarge]] outer.projectX[undef].show["X"] outer.projectY[undef].show["Y"] outer.projectZ[undef].show["Z"] filename = "supertoroid.obj" print["Writing $filename..."] w = new Writer[filename] w.println[outer.toObjFormat["supertoroid", 1/(res mm)]] w.close[] println["done."]