2D SDFs


Circle

Bases: GenericGeometry

Circle defined by its radius.

Parameters:
  • radius (float | int) –

    Radius of the circle.

radius: float | int property

Radius of the circle.

NGon

Bases: GenericGeometry

N-sided regular polygon, defined by the outer radius and the number of sides.

Parameters:
  • radius (float | int) –

    Outer radius of the regular polygon.

  • n_sides (int) –

    Number of sides of the regular polygon.

radius: float | int property

Radius of the n-gon

n_sides: int property

Number of sides in the n-gon

Rectangle

Bases: GenericGeometry

Rectangle defined by its side lengths.

Parameters:
  • a (float | int) –

    Side length along the x-axis.

  • b (float | int) –

    Side length along the y-axis.

a: float | int property

Side length along the x-axis.

b: float | int property

Side length along the y-axis.

size: np.ndarray property

2vector of side lengths (a, b).

RoundedRectangle

Bases: GenericGeometry

Rounded rectangle defined by its side lengths and rounding radii for each corner.

Parameters:
  • a (float) –

    Side length along the x-axis.

  • b (float) –

    Side length along the y-axis.

  • rounding (tuple | list | ndarray) –

    rounding radii for each corner.

a: float | int property

Side length along the x-axis.

b: float | int property

Side length along the y-axis.

size: np.ndarray property

2vector of side lengths (a, b).

round_corners: np.ndarray property

rounding on each of the corners.

Segment

Bases: GenericGeometry

Line segment defined by its end points.

Parameters:
  • a (tuple | list | ndarray) –

    Vector defining the position of the start point.

  • b (tuple | list | ndarray) –

    Vector defining the position of the end point.

point_a: np.ndarray property

Vector defining the position of the start point.

point_b: np.ndarray property

Vector defining the position of the end point.

Triangle

Bases: GenericGeometry

Triangle defined by the three vertices.

Parameters:
  • a (tuple | list | ndarray) –

    Vector defining the position of the first vertex.

  • b (tuple | list | ndarray) –

    Vector defining the position of the second vertex.

  • c (tuple | list | ndarray) –

    Vector defining the position of the third vertex.

a: np.ndarray property

Vector defining the position of the first vertex.

b: np.ndarray property

Vector defining the position of the second vertex.

c: np.ndarray property

Vector defining the position of the third vertex.

Sector

Bases: GenericGeometry

Sector defined by the radius of the circle and two angles.

Parameters:
  • radius (float | int) –

    Radius of the circle.

  • angle_1 (float | int) –

    First angle defining the sector.

  • angle_2 (float | int) –

    Second angle defining the sector.

radius: float | int property

Radius of the circle.

angle_1: float | int property

First angle defining the sector.

angle_2: float | int property

Second angle defining the sector.

InfiniteSector

Bases: GenericGeometry

Sector of infinite radius defined by two angles.

Parameters:
  • angle_1 (float | int) –

    First angle defining the sector.

  • angle_2 (float | int) –

    Second angle defining the sector.

angle_1: float | int property

First angle defining the sector.

angle_2: float | int property

Second angle defining the sector.

Arc

Bases: GenericGeometry

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

Parameters:
  • radius (float) –

    Radius of the arc.

  • start_angle (float) –

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

  • end_angle (float) –

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

radius property

Radius of the arc.

start_angle property

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

end_angle property

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

ParametricCurve

Bases: GenericGeometry

Curve connecting points on the user provided parametric curve.

Parameters:
  • parametric_curve (Callable[[ndarray, tuple], ndarray]) –

    Function defining the parametric curve with a single variable (t) and other parameters.

  • parametric_curve_parameters (tuple) –

    Parameters of the function defining the parametric curve.

  • t_range (tuple) –

    Range of the t parameter. t_range[0] - start, t_range[1] - end, t_range[2] - number of steps in between.

  • closed (bool, default: False ) –

    Is the curve closed on itself. False by default.

steps: int property

Number of points at which the curve is evaluated.

t_start: float | int property

Start value of parameter t.

t_end: float | int property

End value of parameter t.

ts: np.ndarray property

Values of parameter t.

closed: bool property

Is the segmented line closed on itself. False by default.

sdf_closed_curve()

Returns the SDF of the closed curve if parameter close==True.

Returns:
  • Callable[[ndarray, tuple], ndarray]

    Modified SDF

shape()

Converts the closed parametric curve into a shape.

Returns:
  • Callable[[ndarray, tuple], ndarray]

    Modified SDF.

SegmentedParametricCurve

Bases: GenericGeometry

Segmented line connecting the user provided points.

Parameters:
  • points (list | tuple | ndarray) –

    Points to connect.

  • t_range (tuple) –

    Range of the t parameter. t_range[0] - start, t_range[1] - end, t_range[2] - number of steps in between. t_range[1]-t_range[0] >= number of points.

  • closed (bool, default: False ) –

    Is the segmented line closed on itself. False by default.

steps: int property

Number of points at which the curve is evaluated.

t_start: float | int property

Start value of parameter t.

t_end: float | int property

End value of parameter t.

ts: np.ndarray property

Values of parameter t.

closed: bool property

Is the segmented line closed on itself. False by default.

sdf_closed_curve()

Returns the SDF of the closed curve if parameter close==True.

Returns:
  • Callable[[ndarray, tuple], ndarray]

    Modified SDF

polygon()

Converts the closed segmented line into a polygon.

Returns:
  • Callable[[ndarray, tuple], ndarray]

    Modified SDF.

SegmentedLine

Bases: GenericGeometry

Segmented line connecting the user provided points.

Parameters:
  • points (list | tuple | ndarray) –

    Points to connect.

  • closed (bool, default: False ) –

    Is the segmented line closed on itself. False by default.

closed: bool property

Is the segmented line closed on itself. False by default.

sdf_closed_curve()

Returns the SDF of the closed curve if parameter close==True.

Returns:
  • Callable[[ndarray, tuple], ndarray]

    Modified SDF

polygon()

Converts the closed segmented line into a polygon.

Returns:
  • Callable[[ndarray, tuple], ndarray]

    Modified SDF.

PointCloud2D

Bases: GenericGeometry

SDF of the point cloud.

Parameters:
  • points (list | tuple | ndarray) –

    Positions of the points in an array of shape (2, N-points).

points: np.ndarray property

Positions of the points in an array of shape (2, N-points).