Collection of functions for generating various shapes. Each of these
methods creates a shape generator function; that is, a function
which takes x
, y
, and z
coordinates and returns true
or false
.
To use these functions in the Add/Remove voxel tool, you need to simply enter a function call, like this:
cuboid 7, 4, 3, 10, 10, 10
The call to cuboid
will return a function that will be called on each
voxel position (each x
,y
, and z
in the lattice), returning true
if the position is on the shape, or false
otherwise.
Call methods with.name()
,.name(arguments)
or just .name arguments
.
r
, cx
, cy
, cz
)
-> Function
#Builds a generator function to make cubes
Number
Radius (in voxels) = width = height = depth
Number
Center X lattice position
Number
Center Y lattice position
Number
Center Z lattice position
Function
generator Generator function to make the cube
w
, h
, d
, cx
, cy
, cz
, [hollow]
)
-> Function
#Builds a generator function to make cuboids (rectangular prisms)
Number
Width (in voxels)
Number
Height (in voxels)
Number
Depth (in voxels)
Number
Center X lattice position
Number
Center Y lattice position
Number
Center Z lattice position
Boolean
True to create a hollow cuboid
(Optional; defaults tofalse
)Function
generator Generator function to make the cuboid
funcs
)
-> Function
#Returns a new shape generator function that is the intersection (overlapping part) of several other shape generator functions.
Example: overlap between a sphere and a cuboid:
intersect(
cuboid(4,5,7, 10,10,10),
sphere(5, 10,10,15)
)
Note that generator functions need not be builtin:
intersect(
cuboid(4,5,7, 10,10,10),
(x, y, z) -> x % 2 is 0
)
Function[]
... Pass any number of shape generator functions as arguments
Function
generator New union shape generator function
funcs
)
-> Function
#Returns a new shape generator function that is the negation of another shape generator function
Example: Hollow a sphere out of the lattice
negate sphereoid(4,5,7, 10,10,10)
Function[]
... Pass any number of shape generator functions as arguments
Function
generator New union shape generator function
r
, cx
, cy
, cz
)
-> Function
#Builds a generator function to make spheres
Number
Radius (in voxels) = width = height = depth
Number
Center X lattice position
Number
Center Y lattice position
Number
Center Z lattice position
Function
generator Generator function to make the sphere
w
, h
, d
, cx
, cy
, cz
, [hollow]
)
-> Function
#Builds a generator function to make sphereoids/ellipsoids
Number
Width (in voxels) = X diameter
Number
Height (in voxels) = Y diameter
Number
Depth (in voxels) = Z diameter
Number
Center X lattice position
Number
Center Y lattice position
Number
Center Z lattice position
Boolean
True to create a hollow sphereoid
(Optional; defaults tofalse
)Function
generator Generator function to make the sphereoid
funcs
)
-> Function
#Returns a new shape generator function that is the union of several other shape generator functions.
Example: union of a sphere and a cuboid:
union(
cuboid(4,5,7, 10,10,10),
sphere(5, 10,10,15)
)
Note that generator functions need not be builtin:
union(
cuboid(4,5,7, 10,10,10),
(x, y, z) -> x % 2 is 0
)
Function[]
... Pass any number of shape generator functions as arguments
Function
generator New union shape generator function