Composition Nodes - MacCurdyLab/OpenVCAD-Public GitHub Wiki
Composition nodes modify the geometry of their children. They can be used to combine multiple geometric primitives into a single object, transform shapes, and subtract volumes. Composition nodes can be nested to create complex objects. Depending on the node, they support different number of children.
The translate
node translates the geometry of children node by the specified amount in X,Y,Z.
translate
can have any number of children.
translate(x_value, y_value, z_value){ <child node(s)> }
, where x,y, & z values are the translation amounts in each direction.
translate(3, 0, 0){ sphere(3, "red"); }
translates the sphere by 3 in the x direction.
translate(3, 2, 1)
{
sphere(3, "red");
sphere(10, "blue");
}
Translates two spheres in X,Y & Z
The rotate
node rotates the geometry of children node by the specified amount using pitch, yaw, and roll.
rotate
can have any number of children.
rotate(pitch, yaw, roll){ <child node(s)> }
, where pitch, yaw, & roll are the rotation amounts in each direction.
rotate(0, 0, 90){ sphere(3, "red"); }
rotates the sphere by 90 degrees in the z direction.
rotate(0, 90, 45)
{
sphere(3, "red");
sphere(10, "blue");
}
The scale
node scales the geometry of children node by the specified amount in X,Y,Z.
scale
can have any number of children.
scale(x_value, y_value, z_value){ <child node(s)> }
, where x,y, & z values are the scale amounts in each direction.
scale(3, 0, 0){ sphere(3, "red"); }
scales the sphere by 3 in the x direction.
scale(3, 2, 1)
{
sphere(3, "red");
sphere(10, "blue");
}
The union
node combines the geometry of its children into a single object.
union
can have any number of children.
union(){ <child node>; <child node>; ... }
union()
{
sphere(3, "red");
sphere(10, "blue");
}
The difference
node subtracts the geometry of its second child from the first child.
difference
must have exactly two children.
difference(){ <left hand side child>; <right hand side child>; }
difference()
{
sphere(3, "red");
sphere(10, "blue");
}
The intersection
node computes regions of child geometry that overlap.
intersection
can have any number of children.
intersection(){ <child node>; <child node>; ... }
intersection()
{
sphere(3, "red");
sphere(10, "blue");
}
The not
node inverts the geometry of its child.
not
must only have one child.
not(){ <child node>; }
not
can have at most one child.
not()
{
sphere(3, "blue");
}