Skip to content

Commit

Permalink
Revert vector model moves/refactors.
Browse files Browse the repository at this point in the history
I'm noticing analysis snapshot mismatches related to 0 vs. 0.0. Maybe this will help. If it doesn't, at least the diff will have been reduced.
  • Loading branch information
SyntaxColoring committed Dec 12, 2024
1 parent a17012f commit fe5005e
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 96 deletions.
34 changes: 29 additions & 5 deletions api/src/opentrons/protocol_engine/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@
# convenience re-export of LabwareUri type
LabwareUri as LabwareUri,
)

from opentrons_shared_data.labware import models as lw_models
from opentrons_shared_data.types import Vec3f as SD_Vec3f
from opentrons_shared_data.module.types import ModuleType as SharedDataModuleType


Expand Down Expand Up @@ -560,7 +557,12 @@ class ModuleDimensions(BaseModel):
lidHeight: Optional[float] = None


Vec3f = SD_Vec3f[float]
class Vec3f(BaseModel):
"""A 3D vector of floats."""

x: float
y: float
z: float


# TODO(mm, 2022-11-07): Deduplicate with Vec3f.
Expand All @@ -572,7 +574,29 @@ class ModuleCalibrationPoint(BaseModel):
z: float


LabwareOffsetVector = lw_models.OffsetVector
# TODO(mm, 2022-11-07): Deduplicate with Vec3f.
class LabwareOffsetVector(BaseModel):
"""Offset, in deck coordinates from nominal to actual position."""

x: float
y: float
z: float

def __add__(self, other: Any) -> LabwareOffsetVector:
"""Adds two vectors together."""
if not isinstance(other, LabwareOffsetVector):
return NotImplemented
return LabwareOffsetVector(
x=self.x + other.x, y=self.y + other.y, z=self.z + other.z
)

def __sub__(self, other: Any) -> LabwareOffsetVector:
"""Subtracts two vectors."""
if not isinstance(other, LabwareOffsetVector):
return NotImplemented
return LabwareOffsetVector(
x=self.x - other.x, y=self.y - other.y, z=self.z - other.z
)


# TODO(mm, 2022-11-07): Deduplicate with Vec3f.
Expand Down
Loading

0 comments on commit fe5005e

Please sign in to comment.