Tree — composition#
Transforms, boolean CSG, and other composition operators.
Transforms and warps#
-
class Identity : public Unary#
- #include <identity.h>
A pass-through identity node that implements no transformations or operations of its own.
This node operates identically to the base Unary node. Its primary use case is to act as an attachment point for AttributeModifiers without affecting the global coordinate space of the attributes, which is useful when its child node contains an arbitrary transformation.
Public Functions
-
inline virtual Node::DiagramFamily diagram_family() const override#
See also
-
inline virtual std::string diagram_label() const override#
See also
-
Identity() = default#
Default constructor.
Constructor with child.
- Parameters:
child – The child node
-
inline virtual Node::DiagramFamily diagram_family() const override#
-
class Rotate : public Unary#
- #include <rotate.h>
Rotates a child node around the child’s bounding box center.
The rotation is specified by pitch, yaw, and roll (Euler angles in degrees).
The rotation order is roll, then yaw, then pitch. The rotation center is the child’s bounding box center. This is available before prepare() so bounding_box() is safe before prepare(), but you must still call prepare() before evaluate() or sample(). To apply the rotation, the sample point in evaluate() and sample() is transformed by the inverse of the rotation matrix around that center.
Public Functions
-
inline virtual Node::DiagramFamily diagram_family() const override#
See also
-
inline virtual std::string diagram_label() const override#
See also
-
virtual std::optional<double> evaluate(double x, double y, double z) final#
See also
-
Rotate() = default#
Default constructor. Defaults to no rotation.
-
Rotate(double pitch, double yaw, double roll)#
Constructor.
- Parameters:
pitch – Pitch angle in degrees
yaw – Yaw angle in degrees
roll – Roll angle in degrees
Constructor with child.
- Parameters:
pitch – Pitch angle in degrees
yaw – Yaw angle in degrees
roll – Roll angle in degrees
child – Child node
-
Rotate(glm::vec3 rotation_angles)#
Constructor.
- Parameters:
rotation_angles – Euler angles in degrees (pitch, yaw, roll)
Constructor with child.
- Parameters:
rotation_angles – Euler angles in degrees (pitch, yaw, roll)
child – Child node
-
virtual TreeSample sample(double x, double y, double z) final#
See also
-
inline virtual Node::DiagramFamily diagram_family() const override#
-
class Scale : public Unary#
- #include <scale.h>
Scale a child by a factor in each dimension.
This node is unary, therefore can only have one child.
The Scale class is a node that scales a node by a factor in each dimension. This node is unary, therefore can only have one child. The scale is actually applied when evaluate() is called and performs the inverse of the scaling on the supplied point.
Public Functions
-
inline virtual Node::DiagramFamily diagram_family() const override#
See also
-
inline virtual std::string diagram_label() const override#
See also
-
virtual std::optional<double> evaluate(double x, double y, double z) final#
See also
-
virtual TreeSample sample(double x, double y, double z) final#
See also
-
Scale() = default#
Default constructor. Sets the scale to 1.0 in each dimension.
-
Scale(double x, double y, double z)#
Constructor.
Sets the scale to the supplied values.
- Parameters:
x – The scale in the x dimension.
y – The scale in the y dimension.
z – The scale in the z dimension.
Constructor with child.
Sets the scale to the supplied values.
- Parameters:
x – The scale in the x dimension.
y – The scale in the y dimension.
z – The scale in the z dimension.
child – The child node.
Private Functions
-
virtual void prepare_bounding_box() override#
-
inline virtual Node::DiagramFamily diagram_family() const override#
-
class Translate : public Unary#
- #include <translate.h>
Translate a child in cartesian space by a given amount.
This node is unary, so it may only have one child.
This node performs the inverse translation on the coordinates sampled in material() and evaluate().
Public Functions
-
inline virtual Node::DiagramFamily diagram_family() const override#
See also
-
inline virtual std::string diagram_label() const override#
See also
-
virtual std::optional<double> evaluate(double x, double y, double z) final#
See also
-
virtual TreeSample sample(double x, double y, double z) final#
See also
-
Translate() = default#
Default constructor. Sets the translation to 0, 0, 0.
-
Translate(double x, double y, double z)#
Constructor.
Sets the translation to the given values.
- Parameters:
x – The amount to translate in the x direction.
y – The amount to translate in the y direction.
z – The amount to translate in the z direction.
Constructor.
Sets the translation to the given values and sets the child.
- Parameters:
x – The amount to translate in the x direction.
y – The amount to translate in the y direction.
z – The amount to translate in the z direction.
child – The child to set.
Private Functions
-
virtual void prepare_bounding_box() override#
-
inline virtual Node::DiagramFamily diagram_family() const override#
-
class Offset : public Unary#
- #include <offset.h>
Shifts the signed distance reported by its child by a constant offset.
Public Functions
-
inline virtual Node::DiagramFamily diagram_family() const override#
See also
-
inline virtual std::string diagram_label() const override#
See also
-
virtual std::optional<double> evaluate(double x, double y, double z) final#
See also
-
Offset() = default#
Default constructor with zero offset.
-
explicit Offset(double offset)#
Constructor with offset.
Constructor with offset and child.
-
virtual void prepare(const glm::vec3 &voxel_size, double bandwidth) final#
See also
-
virtual void prepare_bounding_box() override#
See also
-
virtual TreeSample sample(double x, double y, double z) override#
See also
Private Members
-
double m_offset = 0.0#
-
inline virtual Node::DiagramFamily diagram_family() const override#
-
class Shell : public Unary#
- #include <shell.h>
Computes an inward shell of a child node by subtracting an inward offset from the original.
The shell is obtained as Difference(child, Offset(child)).
Public Functions
-
inline virtual Node::DiagramFamily diagram_family() const override#
See also
-
inline virtual std::string diagram_label() const override#
See also
-
virtual std::optional<double> evaluate(double x, double y, double z) final#
See also
-
virtual void prepare(const glm::vec3 &voxel_size, double bandwidth) final#
See also
-
virtual void prepare_bounding_box() override#
See also
-
virtual Node::TreeSample sample(double x, double y, double z) final#
See also
-
Shell() = default#
-
explicit Shell(double thickness)#
Constructor with shell thickness. Thickness must be positive.
Constructor with shell thickness and child.
Private Functions
-
void build_subtree()#
-
inline virtual Node::DiagramFamily diagram_family() const override#
-
class ConformalMap : public Binary#
- #include <conformal_map.h>
Maps a pattern node onto the surface of a base node by warping coordinates.
Builds a local frame from the base surface, transports the anchor frame to the query by shortest rotation, and computes (u,v) from a rotation vector (axis*angle). Angle->length is auto-calibrated at the anchor during prepare() to preserve expected pattern scale without precompute.
Public Functions
-
ConformalMap() = default#
-
inline virtual std::vector<Node::DiagramChildLink> diagram_child_links() const override#
See also
-
inline virtual Node::DiagramFamily diagram_family() const override#
See also
-
inline virtual std::string diagram_label() const override#
See also
-
virtual std::optional<double> evaluate(double x, double y, double z) override#
See also
-
virtual void prepare(const glm::vec3 &voxel_size, double bandwidth) override#
See also
-
virtual void prepare_bounding_box() override#
See also
-
virtual Node::TreeSample sample(double x, double y, double z) override#
See also
-
inline void setArcScale(float s)#
Set angle->length scale (units per radian) uniformly.
- Parameters:
s – The arc scale to apply to both U and V patterns.
-
inline void setArcScale(float su, float sv)#
Set angle->length scale (units per radian) separately.
- Parameters:
su – The arc scale for U.
sv – The arc scale for V.
-
ConformalMap() = default#
-
class Map : public Leaf#
- #include <map.h>
Maps an existing object onto a parameterizer coordinate system.
Public Functions
-
inline virtual Node::DiagramFamily diagram_family() const override#
See also
-
inline virtual std::string diagram_label() const override#
See also
-
virtual std::optional<double> evaluate(double x, double y, double z) override#
See also
-
Map(const std::string &surface_path, const std::string &closed_mesh_path)#
-
virtual void prepare_bounding_box() override#
See also
-
virtual TreeSample sample(double x, double y, double z) override#
See also
Private Members
-
std::shared_ptr<SurfaceParamerterizer> m_paramerterizer#
-
inline virtual Node::DiagramFamily diagram_family() const override#
N-ary composition#
-
class Sum : public N_ary#
- #include <sum.h>
A sum node.
The sum is taken as the sum of all child SDFs.
Public Functions
-
inline virtual Node::DiagramFamily diagram_family() const override#
See also
-
inline virtual std::string diagram_label() const override#
See also
-
virtual std::optional<double> evaluate(double x, double y, double z) final#
See also
-
virtual TreeSample sample(double x, double y, double z) final#
See also
-
Sum() = default#
Default constructor.
-
Sum(double iso_value)#
Constructor.
- Parameters:
iso_value – The iso value of the sum.
Constructor.
- Parameters:
iso_value – The iso value of the sum.
children – The children of the sum.
Private Functions
-
virtual void prepare_bounding_box() override#
See also
Private Members
-
double m_iso_value = 0.0#
-
inline virtual Node::DiagramFamily diagram_family() const override#
-
class Tile : public Unary#
- #include <tile.h>
A tile is a unary operator that repeats a geometry as a pattern in a grid.
Public Functions
-
inline virtual Node::DiagramFamily diagram_family() const override#
See also
-
inline virtual std::string diagram_label() const override#
See also
-
virtual std::optional<double> evaluate(double x, double y, double z) final#
See also
-
virtual void prepare(const glm::vec3 &voxel_size, double bandwidth) final#
See also
-
virtual Node::TreeSample sample(double x, double y, double z) final#
See also
-
Tile() = default#
Default Constructor.
Note
The cell dimensions will be calculated from the child node when prepare is called
Constructor.
Note
The cell dimensions will be calculated from the child node
- Parameters:
child – The child node
-
Tile(double cell_x, double cell_y, double cell_z)#
Constructor.
Note
The child node’s size will be ignored and the supplied cell dimensions will be used instead
- Parameters:
cell_x – The x dimension of a cell the grid
cell_y – The y dimension of a cell the grid
cell_z – The z dimension of a cell the grid
Constructor.
- Parameters:
cell_x – The x dimension of a cell the grid
cell_y – The y dimension of a cell the grid
cell_z – The z dimension of a cell the grid
child – The child node
Private Functions
-
virtual void prepare_bounding_box() override#
-
std::tuple<double, double, double> world_to_cell_coords(double x, double y, double z) const#
Converts world coordinates to cell coordinates.
This takes the modulus of the world coordinates
- Parameters:
x – coord in world space
y – coord in world space
z – coord in world space
- Returns:
a tuple of x,y,z coordinates in cell space
-
inline virtual Node::DiagramFamily diagram_family() const override#
Boolean CSG#
-
class Difference : public Binary#
- #include <difference.h>
A difference binary node.
The difference is taken as the left child minus the right child.
Supports an optional smooth blending radius
k. Whenk > 0, the difference uses smooth subtraction to produce rounded transitions.Public Functions
-
inline virtual std::vector<Node::DiagramChildLink> diagram_child_links() const override#
See also
-
inline virtual Node::DiagramFamily diagram_family() const override#
See also
-
inline virtual std::string diagram_label() const override#
See also
-
Difference() = default#
Default constructor.
-
explicit Difference(double k)#
Constructor for smooth difference.
- Parameters:
k – The smoothing radius. When k > 0, produces a smooth subtraction.
Constructor for smooth difference with children.
- Parameters:
k – The smoothing radius.
left – The left child node.
right – The right child node.
-
virtual std::optional<double> evaluate(double x, double y, double z) final#
See also
-
virtual TreeSample sample(double x, double y, double z) final#
See also
Private Functions
-
virtual void prepare_bounding_box() override#
Private Members
-
double m_smooth_k = 0.0#
The smoothing radius for smooth difference. 0 = sharp (default).
Private Static Functions
-
static std::optional<double> DifferenceSDFImpl(std::optional<double> lhs, std::optional<double> rhs, double smooth_k)#
-
inline virtual std::vector<Node::DiagramChildLink> diagram_child_links() const override#
-
class Intersection : public N_ary#
- #include <intersection.h>
Intersection of two or more nodes.
Supports an optional smooth blending radius
k. Whenk > 0, the intersection uses smooth intersection to produce rounded transitions.Public Functions
-
inline virtual Node::DiagramFamily diagram_family() const override#
See also
-
inline virtual std::string diagram_label() const override#
See also
-
virtual std::optional<double> evaluate(double x, double y, double z) final#
See also
-
Intersection()#
Default constructor.
Constructor with children.
- Parameters:
lhs – Left child node
rhs – Right child node
-
explicit Intersection(double k)#
Constructor for smooth intersection.
- Parameters:
k – The smoothing radius. When k > 0, produces a smooth blend.
Constructor for smooth intersection with children.
- Parameters:
k – The smoothing radius.
children – The children nodes.
-
virtual TreeSample sample(double x, double y, double z) final#
See also
Private Functions
-
virtual void prepare_bounding_box() final#
See also
Private Members
-
double m_smooth_k = 0.0#
The smoothing radius for smooth intersection. 0 = sharp (default).
-
inline virtual Node::DiagramFamily diagram_family() const override#
-
class BBoxIntersection : public N_ary#
- #include <bbox_intersection.h>
An accelerated n-ary boolean intersection node utilizing an internal Axis-Aligned Bounding Box (AABB) tree.
This node drastically improves performance when sampling intersections of many spatially distinct children by only evaluating children whose bounding boxes overlap the sample point.
Public Functions
See also
-
BBoxIntersection()#
-
inline virtual Node::DiagramFamily diagram_family() const override#
See also
-
inline virtual std::string diagram_label() const override#
See also
-
virtual std::optional<double> evaluate(double x, double y, double z) override#
See also
-
virtual void prepare(const glm::vec3 &voxel_size, double bandwidth) override#
See also
-
virtual void prepare_bounding_box() override#
See also
-
virtual TreeSample sample(double x, double y, double z) override#
See also
Private Members
-
std::shared_ptr<AABBVCADTree> m_aabb_tree#
-
double m_bandwidth = 1.0#
-
std::unordered_map<VCADNodeBBoxPrimitive::Id, size_t> m_node_added_order#
-
class Union : public N_ary#
- #include <union.h>
Supports an optional smooth blending radius
k. Whenk > 0, the union uses a quadratic smooth-min to produce rounded transitions between children.Public Functions
-
inline virtual Node::DiagramFamily diagram_family() const override#
See also
-
inline virtual std::string diagram_label() const override#
See also
-
virtual std::optional<double> evaluate(double x, double y, double z) final#
See also
-
virtual TreeSample sample(double x, double y, double z) final#
See also
-
Union()#
Default constructor.
Constructor with children.
- Parameters:
lhs – Left child node
rhs – Right child node
-
explicit Union(double k)#
Constructor for smooth union.
- Parameters:
k – The smoothing radius. When k > 0, produces a smooth blend between children.
Constructor for smooth union with children.
- Parameters:
k – The smoothing radius.
children – The children nodes.
Private Functions
-
virtual void prepare_bounding_box() final#
See also
Private Members
-
double m_smooth_k = 0.0#
The smoothing radius for smooth union. 0 = sharp (default).
-
inline virtual Node::DiagramFamily diagram_family() const override#
-
class BBoxUnion : public N_ary#
- #include <bbox_union.h>
An accelerated n-ary boolean union node utilizing an internal Axis-Aligned Bounding Box (AABB) tree.
This node drastically improves performance when sampling unions of many spatially distinct children by only evaluating children whose bounding boxes overlap the sample point.
Public Functions
See also
-
BBoxUnion()#
-
inline virtual Node::DiagramFamily diagram_family() const override#
See also
-
inline virtual std::string diagram_label() const override#
See also
-
virtual std::optional<double> evaluate(double x, double y, double z) override#
See also
-
virtual void prepare(const glm::vec3 &voxel_size, double bandwidth) override#
See also
-
virtual void prepare_bounding_box() override#
See also
-
virtual TreeSample sample(double x, double y, double z) override#
See also
Private Members
-
std::shared_ptr<AABBVCADTree> m_aabb_tree#
-
double m_bandwidth = 1.0#
-
std::unordered_map<VCADNodeBBoxPrimitive::Id, size_t> m_node_added_order#