Modifications


elongation(function_, elongate_vector)

Elongates the geometry along a certain vector by the length of the vector in each respective direction.

Parameters:
  • function_ (function_like_type) –

    Original SDF.

  • elongate_vector (array_like_type) –

    A vector, with shape (3,), by which the shape is elongated.

Returns:
  • function_like_type

    Modified SDF.

rounding(function_, rounding_radius)

Rounds off the geometry - effectively thickening it by the rounding radius.

Parameters:
  • function_ (function_like_type) –

    Original SDF.

  • rounding_radius (scalar_like_type) –

    Radius by which the edges are rounded and the object thickened.

Returns:
  • function_like_type

    Modified SDF.

rounding_cs(function_, rounding_radius, bb_size)

Rounds off the geometry, but the geometry will be contained in its bounding box. Bounding box size must be specified.

Parameters:
  • function_ (function_like_type) –

    Original SDF.

  • rounding_radius (scalar_like_type) –

    Radius by which the edges are rounded.

  • bb_size (scalar_like_type) –

    Size of the bounding box. Typically, the largest dimension of the object.

Returns:
  • function_like_type

    Modified SDF.

boundary(function_)

Get the boundary of the SDF.

Parameters:
  • function_ (function_like_type) –

    Original SDF.

Returns:
  • function_like_type

    Modified SDF.

invert(function_)

Inverts the sign of the SDF.

Parameters:
  • function_ (function_like_type) –

    Original SDF.

Returns:
  • function_like_type

    Modified SDF.

sign(function_)

Get the sign of the SDF.

Parameters:
  • function_ (function_like_type) –

    Original SDF.

Returns:
  • function_like_type

    Modified SDF.

define_volume(function_, interior, interior_parameters)

Defines the interior of the SDF if with a function.

Parameters:
  • function_ (function_like_type) –

    Original SDF.

  • interior (function_like_type) –

    Function defining the interior (-1) and exterior (1) of an SDF.

  • interior_parameters (tuple) –

    Parameters of the function defining the interior of the SDF.

Returns:
  • function_like_type

    Modified SDF.

onion(function_, thickness)

Transforms the geometry into a surface with some thickness.

Parameters:
  • function_ (function_like_type) –

    Original SDF.

  • thickness (scalar_like_type) –

    Thickness of the resulting shape.

Returns:
  • function_like_type

    Modified SDF.

concentric(function_, width)

Transforms an isosurface into two concentric isosurfaces which are apart by the value of width parameter. Transforms a volume into an isosurface and rounds it by width/2.

Parameters:
  • function_ (function_like_type) –

    Original SDF.

  • width (scalar_like_type) –

    Thickness of the resulting shape.

Returns:
  • function_like_type

    Modified SDF.

revolution(function_, radius)

Revolves a 2D shape around the y-axis to generate a 3D shape. First the 2D shape is translated along the x-axis by the radius of revolution, then it is revolved around the y-axis.

Parameters:
  • function_ (function_like_type) –

    Original SDF.

  • radius (scalar_like_type) –

    Radius of revolution.

Returns:
  • function_like_type

    Modified SDF.

axis_revolution(function_, radius, angle)

Revolves a 2D shape around an axis to generate a 3D shape. First the 2D shape is translated along the x-axis by the radius of revolution, and then revolved around the axis of revolution. The axis of revolution is angled by the specified angle with respect to the y-axis.

Parameters:
  • function_ (function_like_type) –

    Original SDF.

  • radius (scalar_like_type) –

    Radius of revolution.

  • angle (scalar_like_type) –

    Angle between the axis of revolution and the y-axis.

Returns:
  • function_like_type

    Modified SDF.

extrusion(function_, distance)

Extrudes a 2D shape along the z-axis so that the height of the object is equal to the specified distance.

Parameters:
  • function_ (function_like_type) –

    Original SDF.

  • distance (scalar_like_type) –

    Final height of the object - distance of extrusion.

Returns:
  • function_like_type

    Modified SDF.

twist(function_, pitch)

Twists the geometry around the z-axis based on the position along the z-axis and the pitch.

Parameters:
  • function_ (function_like_type) –

    Original SDF.

  • pitch (scalar_like_type) –

    rad/unit length.

Returns:
  • function_like_type

    Modified SDF.

bend(function_, radius, angle)

Bends the geometry around the z-axis, based on the specified bending radius and angle. The length of the bent section is radius*angle.

Parameters:
  • function_ (function_like_type) –

    Original SDF.

  • radius (scalar_like_type) –

    Bending radius.

  • angle (scalar_like_type) –

    Bending angle.

Returns:
  • function_like_type

    Modified SDF.

shear_xz(function_, angle)

Displaces the points parallel to the x-axis of the coordinate system around the z-axis by the specified angle.

Parameters:
  • function_ (function_like_type) –

    Original SDF.

  • angle (scalar_like_type) –

    Shearing angle - the shear factor is given as tan(angle).

Returns:
  • function_like_type

    Modified SDF.

shear_yz(function_, angle)

Displaces the points parallel to the y-axis of the coordinate system around the z-axis by the specified angle.

Parameters:
  • function_ (function_like_type) –

    Original SDF.

  • angle (scalar_like_type) –

    Shearing angle - the shear factor is given as tan(angle).

Returns:
  • function_like_type

    Modified SDF.

shear_xy(function_, angle)

Displaces the points parallel to the x-axis of the coordinate system around the y-axis by the specified angle.

Parameters:
  • function_ (function_like_type) –

    Original SDF.

  • angle (scalar_like_type) –

    Shearing angle - the shear factor is given as tan(angle).

Returns:
  • function_like_type

    Modified SDF.

shear_zy(function_, angle)

Displaces the points parallel to the z-axis of the coordinate system around the y-axis by the specified angle.

Parameters:
  • function_ (function_like_type) –

    Original SDF.

  • angle (scalar_like_type) –

    Shearing angle - the shear factor is given as tan(angle).

Returns:
  • function_like_type

    Modified SDF.

shear_yx(function_, angle)

Displaces the points parallel to the y-axis of the coordinate system around the x-axis by the specified angle.

Parameters:
  • function_ (function_like_type) –

    Original SDF.

  • angle (scalar_like_type) –

    Shearing angle - the shear factor is given as tan(angle).

Returns:
  • function_like_type

    Modified SDF.

shear_zx(function_, angle)

Displaces the points parallel to the z-axis of the coordinate system around the x-axis by the specified angle.

Parameters:
  • function_ (function_like_type) –

    Original SDF.

  • angle (scalar_like_type) –

    Shearing angle - the shear factor is given as tan(angle).

Returns:
  • function_like_type

    Modified SDF.

displacement(function_, displacement_function, displacement_function_parameters)

Displaces the surface of an object based on the values of the displacement function. Should be applied last.

Parameters:
  • function_ (function_like_type) –

    Original SDF.

  • displacement_function (function_like_type) –

    Function which takes an array of coordinates with shape (D, N) and a tuple of parameters. D - number of dimensions (2 or 3); N - number of points in the point cloud.

  • displacement_function_parameters (tuple) –

    Parameters of the displacement function.

Returns:
  • function_like_type

    Modified SDF.

infinite_repetition(function_, distances)

Infinitely repeats geometry in space on a cubic lattice.

Parameters:
  • function_ (function_like_type) –

    Original SDF.

  • distances (array_like_type) –

    A vector, with shape (3,), determining the distances between instances along each axis.

Returns:
  • function_like_type

    Modified SDF.

finite_repetition(function_, size, repetitions)

Repeats the geometry finite amount of times along each axis within a defined bounding box.

Parameters:
  • function_ (function_like_type) –

    Original SDF.

  • size (array_like_type) –

    Size of the bounding box along each axis in which the geometry is repeated.

  • repetitions (array_like_type) –

    Number of repetitions along each axis inside the bounding box.

Returns:
  • function_like_type

    Modified SDF.

finite_repetition_rescaled(function_, size, repetitions, instance_size, padding)

Repeats the geometry finite amount of times along each axis within a defined bounding box. The geometry is rescaled based on the provided geometry bounding box size and padding along each axis. Args: function_: Original SDF. size: Size of the bounding box along each axis in which the geometry is repeated. repetitions: Number of repetitions along each axis inside the bounding box. instance_size: Size of the bounding box around one instance of geometry along each axis. padding: Padding around each instance along each axis.

Returns:
  • function_like_type

    Modified SDF.

symmetry(function_, axis)

Applies symmetry along an axis of the object.

Parameters:
  • function_ (function_like_type) –

    Original SDF.

  • axis (int) –

    Index of the axis along which the symmetry is applied.

Returns:
  • function_like_type

    Modified SDF.

mirror(function_, a, b)

Applies mirroring along an axis connecting the two specified points.

Parameters:
  • function_ (function_like_type) –

    Original SDF.

  • a (array_like_type) –

    Position of the object's mirror image.

  • b (array_like_type) –

    Position of the object.

Returns:
  • function_like_type

    Modified SDF.

rotational_symmetry(function_, n, radius, phase)

Applies n-fold rotational symmetry to the object.

Parameters:
  • function_ (function_like_type) –

    Original SDF.

  • n (int) –

    Order of the symmetry.

  • radius (scalar_like_type) –

    By how much the geometry is moved from the centre.

  • phase (scalar_like_type) –

    Angle by which the circular pattern is rotated by.

Returns:
  • function_like_type

    Modified SDF.

linear_instancing(function_, n, a, b)

Instances the geometry n-times along the length of a segment defined by two points.

Parameters:
  • function_ (function_like_type) –

    Original SDF.

  • n (int) –

    Number of instances along the segment.

  • a (array_like_type) –

    Starting point of the segment.

  • b (array_like_type) –

    Ending point of the segment.

Returns:
  • function_like_type

    Modified SDF.

custom_modification(function_, modification, modification_parameters)

Applies a custom user-specified modification to a function defining a scalar field (Signed Distance Function).

Parameters:
  • function_ (function_like_type) –

    A function defining a scalar field (Signed Distance Function).

  • modification (Callable[[function_like_type, array_like_type, tuple, tuple], ndarray]) –

    A custom modification which takes the SDF as a first argument, point cloud of coordinates at which the SDF is evaluated as the second argument, parameters of the SDF as the third argument, and the custom modification parameters as the fourth argument.

  • modification_parameters (tuple) –

    Parameters of the custom modification.

Returns:
  • function_like_type

    Modified Scalar Field.

sigmoid_falloff(function_, amplitude, width)

Applies a sigmoid to a function defining a scalar field (Signed Distance Function).

Parameters:
  • function_ (function_like_type) –

    A function defining a scalar field (Signed Distance Function).

  • amplitude (scalar_like_type) –

    Maximum value of the transformed scalar field.

  • width (scalar_like_type) –

    Width of the sigmoid.

Returns:
  • function_like_type

    Modified Scalar Field.

positive_sigmoid_falloff(function_, amplitude, width)

Applies a sigmoid to a function defining a scalar field (Signed Distance Function). The sigmoid is shifted towards the positive values by the value of the width parameter.

Parameters:
  • function_ (function_like_type) –

    A function defining a scalar field (Signed Distance Function).

  • amplitude (scalar_like_type) –

    Maximum value of the transformed scalar field.

  • width (scalar_like_type) –

    Width of the sigmoid.

Returns:
  • function_like_type

    Modified Scalar Field.

capped_exponential(function_, amplitude, width)

Applies the Capped Exponential function to a function defining a scalar field (Signed Distance Function).

Parameters:
  • function_ (function_like_type) –

    A function defining a scalar field (Signed Distance Function).

  • amplitude (scalar_like_type) –

    Maximum value of the transformed scalar field.

  • width (scalar_like_type) –

    Range at which the value of the transformed scalar field drops to almost zero.

Returns:
  • function_like_type

    Modified Scalar Field.

hard_binarization(function_, threshold)

Binarizes the output of a function defining a scalar field (Signed Distance Function). Values below the threshold are 1 and values above are 0.

Parameters:
  • function_ (function_like_type) –

    A function defining a scalar field (Signed Distance Function).

  • threshold (float) –

    Binarization threshold.

Returns:
  • function_like_type

    Modified Scalar Field.

linear_falloff(function_, amplitude, width)

Applies a decreasing linear function to a function defining a scalar field (Signed Distance Function).

Parameters:
  • function_ (function_like_type) –

    A function defining a scalar field (Signed Distance Function).

  • amplitude (scalar_like_type) –

    Maximum value of the transformed scalar field.

  • width (scalar_like_type) –

    Range at which the value of the transformed scalar field drops to zero.

Returns:
  • function_like_type

    Modified Scalar Field.

relu(function_, width)

Applies the ReLU function to a function defining a scalar field (Signed Distance Function).

Parameters:
  • function_ (function_like_type) –

    A function defining a scalar field (Signed Distance Function).

  • width (scalar_like_type) –

    Range at which the value of the transformed field reaches one.

Returns:
  • function_like_type

    Modified Scalar Field.

smooth_relu(function_, smooth_width, width=1.0, threshold=0.01)

Applies the "squareplus" function to a function defining a scalar field (Signed Distance Function). https://en.wikipedia.org/wiki/Rectifier_(neural_networks)

Parameters:
  • function_ (function_like_type) –

    A function defining a scalar field (Signed Distance Function).

  • smooth_width (scalar_like_type) –

    Distance from the origin at which the Smooth ReLU function is greater than ReLU for less than the value of the threshold parameter.

  • width (scalar_like_type, default: 1.0 ) –

    Range at which the value of the transformed field reaches one.

  • threshold (int | float, default: 0.01 ) –

    At smooth_width distance from the origin the value of the Smooth ReLU function is greater than ReLU for the value of the threshold parameter. at smooth_width distance from the origin.

Returns:
  • function_like_type

    Transformed scalar field.

slowstart(function_, smooth_width, width=1, threshold=0.01, ground=True)

Applies the SlowStart function to a function defining a scalar field (Signed Distance Function).

Parameters:
  • function_ (function_like_type) –

    A function defining a scalar field (Signed Distance Function).

  • smooth_width (scalar_like_type) –

    Distance from the origin at which the SlowStart function is greater than ReLU for less than the value of the threshold parameter.

  • width (scalar_like_type, default: 1 ) –

    Range at which the value of the transformed field reaches one.

  • threshold (int | float, default: 0.01 ) –

    At smooth_width distance from the origin the value of the SlowStart function is greater than ReLU for the value of the threshold parameter.

  • ground (bool, default: True ) –

    if True the value of the function is zero at zero.

Returns:
  • function_like_type

    Transformed scalar field.

gaussian_boundary(function_, amplitude, width)

Applies the Gaussian function to a function defining a scalar field (Signed Distance Function).

Parameters:
  • function_ (function_like_type) –

    A function defining a scalar field (Signed Distance Function).

  • amplitude (scalar_like_type) –

    Maximum value of the transformed scalar field.

  • width (scalar_like_type) –

    Range at which the value of the transformed scalar field drops to almost zero.

Returns:
  • function_like_type

    Modified Scalar Field.

gaussian_falloff(function_, amplitude, width)

Applies the Gaussian Falloff function to a function defining a scalar field (Signed Distance Function).

Parameters:
  • function_ (function_like_type) –

    A function defining a scalar field (Signed Distance Function).

  • amplitude (scalar_like_type) –

    Maximum value of the transformed scalar field (and points at which the scalar field was < 0).

  • width (scalar_like_type) –

    Range at which the value of the transformed scalar field drops to almost zero.

Returns:
  • function_like_type

    Modified Scalar Field.

conv_averaging(function_, kernel_size, iterations, co_resolution)

Averages the field using an averaging convolutional kernel of the specified size.

Parameters:
  • function_ (function_like_type) –

    A function defining a scalar field (Signed Distance Function).

  • kernel_size (array_like_type) –

    Size of the averaging kernel. Must be a tuple/array of the same dimension as the scaler field.

  • iterations (int) –

    Number of times the convolutional averaging is applied to the input scalar field.

  • co_resolution (tuple) –

    Resolution of the coordinate system.

Returns:
  • function_like_type

    Modified Scalar Field.

conv_edge_detection(function_, co_resolution)

Edge detection with a 3x3 convolutional kernel.

Parameters:
  • function_ (function_like_type) –

    A function defining a scalar field (Signed Distance Function).

  • co_resolution (tuple) –

    Resolution of the coordinate system.

Returns:
  • function_like_type

    Modified Scalar Field.

custom_post_process(function_, function, parameters)

Applies a custom user-specified post-processing function to a scalar (Signed Distance Function) field.

Parameters:
  • function_ (function_like_type) –

    A function defining a scalar field (Signed Distance Function).

  • function (function_like_type) –

    A custom post-processing function which takes the SDF as a first argument and the parameters of the function as the next arguments.

  • parameters (tuple) –

    Parameters of the custom post-processing function.

Returns:
  • function_like_type

    Modified Scalar Field.