Skip to content

Geometry

Some helpful code for building Shapes for your patterns

Shape

Bases: ABC

Shape Contains a shape

A shape to be used for geometry

Parameters:

Name Type Description Default
ABC ABC

An abstract class

required

does_draw(pixel) abstractmethod

does_draw T.B.D

Parameters:

Name Type Description Default
pixel Pixel

T.B.D

required

Returns:

Type Description
Optional[Color]

Optional[Color]: T.B.D

Sphere(pos, radius, color)

Bases: Shape

Sphere a 3D circle 😉

Represents a spherical object

Parameters:

Name Type Description Default
Shape Shape

Must be an instance of Shape

required

init Create a sphere

Create an instance of Sphere

Parameters:

Name Type Description Default
pos tuple[float, float, float]

The center point of the sphere [x, y, z]

required
radius float

The radius of the sphere

required
color Color

The color of the sphere

required

Line(a, b, stroke, color)

Bases: Shape

Line A line

Has a starting point, end point, color, and a stroke

Parameters:

Name Type Description Default
Shape Shape

Must be an instance of Shape

required

init Create a line

Create a new instance of Line

Parameters:

Name Type Description Default
a tuple[float, float, float]

The start position of the line [x, y, z]

required
b tuple[float, float, float]

The end position of the line [x, y, z]

required
stroke float

The width of the line

required
color Color

The color of the line

required