Point (inherits from NamedTuple)
Description
Represents a point in the Jubilee 3D coordinate system. A lightweight immutable object holding x, y, and z coordinates. Provides basic arithmetic operations like addition, subtraction, scalar multiplication, and absolute value computation.
Constructor
python
Point(x: float = 0.0, y: float = 0.0, z: float = 0.0)Initializes a Point at the given x, y, z coordinates.
| Parameter | Type | Description |
|---|---|---|
x | float | X-coordinate (default 0.0). |
y | float | Y-coordinate (default 0.0). |
z | float | Z-coordinate (default 0.0). |
Properties
(No additional explicit properties — x, y, and z are public fields.)
Methods
| Method | Returns | Description |
|---|---|---|
add(other: Point) | Point | Returns a new Point by adding two points coordinate-wise. |
substract(other: Point) | Point | Returns a new Point by subtracting two points coordinate-wise. |
multiply(other: Union[int, float]) | Point | Returns a new Point scaled by a scalar multiplier. |
absolute() | Point | Returns a new Point with absolute coordinate values. |
__repr__() | str | Returns a human-readable string representation of the point coordinates. |
Short Example
python
# Create two points
p1 = Point(x=10, y=5, z=0)
p2 = Point(x=3, y=7, z=1)
# Add points
p3 = p1.add(p2) # Point(x=13, y=12, z=1)
# Subtract points
p4 = p1.substract(p2) # Point(x=7, y=-2, z=-1)
# Scale point
p5 = p1.multiply(2) # Point(x=20, y=10, z=0)
# Absolute value
p6 = p4.absolute() # Point(x=7, y=2, z=1)
print(p3)Important Notes
Pointis immutable: operations return new Point objects instead of modifying existing ones.add()andsubstract()require the other object to also be aPoint.multiply()only accepts scalar values (intorfloat).- Naming follows conventions adapted from the Opentrons API for compatibility and readability.
- Although spelled
substract()in code (rather thansubtract()), it operates correctly (be aware during usage).