Shapes
Every built-in shape, with a call to copy and the names of its parts. Arguments come in the order shown, then
by name (radius = 0.5); a vector is (x, y, z) and an angle is in degrees. A shape’s parts are the
pieces of its surface it tells apart, which .label(part = "name") names one by one (see
Writing a model); a shape listed with one surface is labeled as a whole, .label("name").
Every shape below is used once in Studio/Models/gallery/model.ebg, laid out as in the figure: open it with
ebgstudio Models/gallery/model.ebg from Studio/ (see ebgstudio), or copy a line from it.
Fig. 20 Studio/Models/gallery: the bounded shapes (the two front rows), the unbounded ones inside a cube and a mesh (the
third row), then the operations of Operations (the rows behind).
Each shape is a C++ class of the library, and its name and parameters follow the class’s: the class name
without SDF, in snake_case (RoundedBoxSDF is rounded_box), and the constructor’s parameters in
order, without their a_ prefix.
Bounded shapes
Shape |
A call |
Parts |
|---|---|---|
|
|
one surface |
|
|
xmin, xmax, ymin, ymax, zmin, zmax |
|
|
xmin, xmax, ymin, ymax, zmin, zmax |
|
|
one surface |
|
|
tube, end1, end2 |
|
|
side, cap1, cap2 |
|
|
side, cap1 (at -y), cap2 (at +y) |
|
|
side, tip1, tip2 |
|
|
side, base |
|
|
side, cap1, cap2 |
|
|
side, end1, end2 |
|
|
one surface |
|
|
side0 … side(n-1), cap1, cap2 |
|
|
outer, inner, end1, end2 |
|
|
sphere, cut |
|
|
shell, rim |
Unbounded shapes
These reach to infinity. Used as a model’s object they would fill the scene, so they are cut by a bounded shape
(intersection(box(...), plane(...))), or used to cut one.
Shape |
A call |
Parts |
|---|---|---|
|
|
one surface |
|
|
one surface |
|
|
one surface |
|
|
xmin, xmax |
|
|
one surface |
Meshes
Shape |
A call |
Parts |
|---|---|---|
|
|
its file’s face groups |
|
|
each mesh’s own (a list of meshes) |
A mesh reads its file (STL, PLY, OBJ, VTK) relative to the file it is written in, once per model however often it
is used. "triangles" makes a TriMeshSDF, "polygons" a
MeshSDF. With groups = true its face groups (an OBJ’s g and
o, …) are its parts, each labeled by its group’s name. A mesh with a topology defect (an edge shared by more than
two faces, faces folding back onto each other) is read with a warning, its distance’s sign unreliable near the defect;
on_defect = "throw" makes it an error. A face that visits a vertex twice is an error either way.
meshes reads every file whose name matches a pattern, for an assembly kept as one file per part: * stands for
any characters and ? for one, in the file’s name only (the folder is written out). The files are read in natural
order (part-2 before part-10), each as mesh reads one, and give a list (see Assemblies: lists of meshes).
A pattern that matches no file is an error.