11#ifndef PBAT_GEOMETRY_SDF_BINARYNODE_H
12#define PBAT_GEOMETRY_SDF_BINARYNODE_H
14#include "pbat/HostDevice.h"
33template <common::CArithmetic TScalar>
56template <common::CArithmetic TScalar>
69 return max(-sd2, sd1);
77template <common::CArithmetic TScalar>
98template <common::CArithmetic TScalar>
111 return max(min(sd1, sd2), -max(sd1, sd2));
119template <common::CArithmetic TScalar>
144 return min(sd1, sd2) - h * h *
ScalarType(0.25) / kk;
152template <common::CArithmetic TScalar>
176 return -U.Eval(sd2, -sd1);
184template <common::CArithmetic TScalar>
208 return -U.Eval(-sd1, -sd2);
Concepts for common types.
Namespace for signed distance functions (SDFs) and related operations.
Definition BinaryNode.cpp:3
Base struct for all binary nodes.
Definition BinaryNode.h:26
Difference operation.
Definition BinaryNode.h:58
TScalar ScalarType
Scalar type.
Definition BinaryNode.h:59
PBAT_HOST_DEVICE ScalarType Eval(ScalarType sd1, ScalarType sd2) const
Evaluate the signed distance function of the difference of two shapes.
Definition BinaryNode.h:66
Exclusive or operation.
Definition BinaryNode.h:100
PBAT_HOST_DEVICE ScalarType Eval(ScalarType sd1, ScalarType sd2) const
Evaluate the signed distance function of the exclusive or of two shapes.
Definition BinaryNode.h:108
TScalar ScalarType
Scalar type.
Definition BinaryNode.h:101
Intersection operation.
Definition BinaryNode.h:79
TScalar ScalarType
Scalar type.
Definition BinaryNode.h:80
PBAT_HOST_DEVICE ScalarType Eval(ScalarType sd1, ScalarType sd2) const
Evaluate the signed distance function of the intersection of two shapes.
Definition BinaryNode.h:87
SmoothDifference(ScalarType k_)
Construct a new Smooth Difference object.
Definition BinaryNode.h:165
TScalar ScalarType
Scalar type.
Definition BinaryNode.h:155
SmoothDifference()=default
Default constructor.
PBAT_HOST_DEVICE ScalarType Eval(ScalarType sd1, ScalarType sd2) const
Evaluate the signed distance function of the smooth difference of two shapes.
Definition BinaryNode.h:172
ScalarType k
Smoothness factor.
Definition BinaryNode.h:156
PBAT_HOST_DEVICE ScalarType Eval(ScalarType sd1, ScalarType sd2) const
Evaluate the signed distance function of the smooth intersection of two shapes.
Definition BinaryNode.h:204
SmoothIntersection(ScalarType k_)
Construct a new Smooth Intersection object.
Definition BinaryNode.h:197
ScalarType k
Smoothness factor.
Definition BinaryNode.h:188
SmoothIntersection()=default
Default constructor.
TScalar ScalarType
Scalar type.
Definition BinaryNode.h:187
Smooth union operation.
Definition BinaryNode.h:121
SmoothUnion(ScalarType k_)
Construct a new Smooth Union object.
Definition BinaryNode.h:132
SmoothUnion()=default
Default constructor.
PBAT_HOST_DEVICE ScalarType Eval(ScalarType sd1, ScalarType sd2) const
Evaluate the signed distance function of the smooth union of two shapes.
Definition BinaryNode.h:139
TScalar ScalarType
Scalar type.
Definition BinaryNode.h:122
ScalarType k
Smoothness factor.
Definition BinaryNode.h:123
Union operation.
Definition BinaryNode.h:35
TScalar ScalarType
Scalar type.
Definition BinaryNode.h:36
PBAT_HOST_DEVICE ScalarType Eval(ScalarType sd1, ScalarType sd2) const
Evaluate the signed distance function of the union of two shapes.
Definition BinaryNode.h:45