3D SDFs


sdf_x(co, offset)

Value of the X coordinate zeroed at some offset value.

Parameters:
  • co (array_like_type) –

    coordinates of points on which the SDF is evaluated. Shape must be (D, N), where D is the dimension of the coordinate system (D > 1), N is the number of coordinate points.

  • offset (scalar_like_type) –

    Value at which the field is zero.

Returns:
  • ndarray

    SDF, with shape (N,), evaluated at the provided coordinate points.

sdf_y(co, offset)

Value of the Y coordinate zeroed at some offset value.

Parameters:
  • co (array_like_type) –

    coordinates of points on which the SDF is evaluated. Shape must be (D, N), where D is the dimension of the coordinate system (D > 1), N is the number of coordinate points.

  • offset (scalar_like_type) –

    Value at which the field is zero.

Returns:
  • ndarray

    SDF, with shape (N,), evaluated at the provided coordinate points.

sdf_z(co, offset)

Value of the Z coordinate zeroed at some offset value.

Parameters:
  • co (array_like_type) –

    coordinates of points on which the SDF is evaluated. Shape must be (D, N), where D is the dimension of the coordinate system (D > 1), N is the number of coordinate points.

  • offset (scalar_like_type) –

    Value at which the field is zero.

Returns:
  • ndarray

    SDF, with shape (N,), evaluated at the provided coordinate points.

sdf_sphere(co, radius)

Sphere defined by its radius.

Parameters:
  • co (array_like_type) –

    coordinates of points on which the SDF is evaluated. Shape must be (D, N), where D is the dimension of the coordinate system (D > 1), N is the number of coordinate points.

  • radius (scalar_like_type) –

    Radius of the sphere.

Returns:
  • ndarray

    SDF, with shape (N,), evaluated at the provided coordinate points.

sdf_cylinder(co, radius, height)

Cylinder defined by the radius and height.

Parameters:
  • co (array_like_type) –

    coordinates of points on which the SDF is evaluated. Shape must be (D, N), where D is the dimension of the coordinate system (D > 1), N is the number of coordinate points.

  • radius (scalar_like_type) –

    Radius of the cylinder.

  • height (scalar_like_type) –

    Height of the cylinder.

Returns:
  • ndarray

    SDF, with shape (N,), evaluated at the provided coordinate points.

sdf_box(co, size)

Box defined by its side lengths.

Parameters:
  • co (array_like_type) –

    coordinates of points on which the SDF is evaluated. Shape must be (D, N), where D is the dimension of the coordinate system (D > 1), N is the number of coordinate points.

  • size (array_like_type) –

    Side lengths (a, b, c).

Returns:
  • ndarray

    SDF, with shape (N,), evaluated at the provided coordinate points.

sdf_torus(co, R, r)

Torus defined by its primary and the secondary radius.

Parameters:
  • co (array_like_type) –

    coordinates of points on which the SDF is evaluated. Shape must be (D, N), where D is the dimension of the coordinate system (D > 1), N is the number of coordinate points.

  • R (scalar_like_type) –

    Primary radius of the torus.

  • r (scalar_like_type) –

    Secondary radius of the torus.

Returns:
  • ndarray

    SDF, with shape (N,), evaluated at the provided coordinate points.

sdf_arc_3d(co, R, r, start_angle, end_angle)

Arc defined by the radius, thickness, and the angles of both ends.

Parameters:
  • co (array_like_type) –

    coordinates of points on which the SDF is evaluated. Shape must be (D, N), where D is the dimension of the coordinate system (D > 1), N is the number of coordinate points.

  • R (scalar_like_type) –

    Radius of the arc.

  • r (scalar_like_type) –

    Thickness of the arc.

  • start_angle (scalar_like_type) –

    Angle of one end with respect to the x-axis.

  • end_angle (scalar_like_type) –

    Angle of the other end with respect to the x-axis.

Returns:
  • ndarray

    SDF, with shape (N,), evaluated at the provided coordinate points.

sdf_plane(co, normal, offset)

Plane defined by its normal vector. SDF has a negative value for points below the plane.

Parameters:
  • co (array_like_type) –

    coordinates of points on which the SDF is evaluated. Shape must be (D, N), where D is the dimension of the coordinate system (D > 1), N is the number of coordinate points.

  • normal (array_like_type) –

    Normal vector of the plane.

  • offset (scalar_like_type) –

    Offset of the origin along the normal vector.

Returns:
  • ndarray

    SDF, with shape (N,), evaluated at the provided coordinate points.

sudf_plane(co, normal, thickness)

Plane defined by its normal vector.

Parameters:
  • co (array_like_type) –

    coordinates of points on which the SDF is evaluated. Shape must be (D, N), where D is the dimension of the coordinate system (D > 1), N is the number of coordinate points.

  • normal (array_like_type) –

    Normal vector of the plane.

  • thickness (scalar_like_type) –

    Thickness of the plane.

Returns:
  • ndarray

    SDF, with shape (N,), evaluated at the provided coordinate points.

sdf_segment_3d(co, a, b)

Line defined by its starting and ending points.

Parameters:
  • co (array_like_type) –

    coordinates of points on which the SDF is evaluated. Shape must be (D, N), where D is the dimension of the coordinate system (D > 1), N is the number of coordinate points.

  • a (array_like_type) –

    Vector defining the starting point.

  • b (array_like_type) –

    Vector defining the ending point.

Returns:
  • ndarray

    SDF, with shape (N,), evaluated at the provided coordinate points.

sdf_cone(co, height, angle)

Cone defined by its height and the angle of the slope. The base of the cone is moved down by: height - height_offset.

Parameters:
  • co (array_like_type) –

    coordinates of points on which the SDF is evaluated. Shape must be (D, N), where D is the dimension of the coordinate system (D > 1), N is the number of coordinate points.

  • height (scalar_like_type) –

    Height of the cone.

  • angle (scalar_like_type) –

    Angle of the slope.

Returns:
  • ndarray

    SDF, with shape (N,), evaluated at the provided coordinate points.

sdf_oriented_infinite_cone(co, angle)

Cone with infinite height defined by the angle of its slope. The tip of the cone is at the origin. Values of the SDF below the cone are negative.

Parameters:
  • co (array_like_type) –

    coordinates of points on which the SDF is evaluated. Shape must be (D, N), where D is the dimension of the coordinate system (D > 1), N is the number of coordinate points.

  • angle (scalar_like_type) –

    Angle of the slope.

Returns:
  • ndarray

    SDF, with shape (N,), evaluated at the provided coordinate points.

sdf_infinite_cone(co, angle)

Cone with infinite height defined by the angle of its slope. The tip of the cone is at the origin.

Parameters:
  • co (array_like_type) –

    coordinates of points on which the SDF is evaluated. Shape must be (D, N), where D is the dimension of the coordinate system (D > 1), N is the number of coordinate points.

  • angle (scalar_like_type) –

    Angle of the slope.

Returns:
  • ndarray

    SDF, with shape (N,), evaluated at the provided coordinate points.

sdf_solid_angle(co, radius, angle_1, angle_2)

Solid angle defined by the radius of the globe and two angles.

Parameters:
  • co (array_like_type) –

    coordinates of points on which the SDF is evaluated. Shape must be (D, N), where D is the dimension of the coordinate system (D > 1), N is the number of coordinate points.

  • radius (scalar_like_type) –

    Radius of the globe.

  • angle_1 (scalar_like_type) –

    First angle defining the sector.

  • angle_2 (scalar_like_type) –

    Second angle defining the sector.

Returns:
  • ndarray

    SDF, with shape (N,), evaluated at the provided coordinate points.

sdf_triangle_3d(co, a, b, c)

Triangle defined by its three vertices.

Parameters:
  • co (array_like_type) –

    coordinates of points on which the SDF is evaluated. Shape must be (D, N), where D is the dimension of the coordinate system (D > 1), N is the number of coordinate points.

  • a (array_like_type) –

    Vector defining the position of the first vertex.

  • b (array_like_type) –

    Vector defining the position of the second vertex.

  • c (array_like_type) –

    Vector defining the position of the third vertex.

Returns:
  • ndarray

    SDF, with shape (N,), evaluated at the provided coordinate points.

sdf_quad_3d(co, a, b, c, d)

Quadrilateral defined by its four coplanar vertices.

Parameters:
  • co (array_like_type) –

    coordinates of points on which the SDF is evaluated. Shape must be (D, N), where D is the dimension of the coordinate system (D > 1), N is the number of coordinate points.

  • a (array_like_type) –

    Vector defining the position of the first vertex.

  • b (array_like_type) –

    Vector defining the position of the second vertex.

  • c (array_like_type) –

    Vector defining the position of the third vertex.

  • d (array_like_type) –

    Vector defining the position of the fourth vertex.

Returns:
  • ndarray

    SDF, with shape (N,), evaluated at the provided coordinate points.

sdf_segmented_line_3d(co, points)

Segmented line connecting the provided points.

Parameters:
  • co (array_like_type) –

    coordinates of points on which the SDF is evaluated. Shape must be (D, N), where D is the dimension of the coordinate system (D > 1), N is the number of coordinate points.

  • points (array_like_type) –

    Points to connect (D > 1, M).

sdf_closed_segmented_line_3d(co, points)

Closed segmented line connecting the provided points.

Parameters:
  • co (array_like_type) –

    coordinates of points on which the SDF is evaluated. Shape must be (D, N), where D is the dimension of the coordinate system (D > 1), N is the number of coordinate points.

  • points (array_like_type) –

    Points to connect (D > 1, M).