PositiveShift#

class PositiveShift[source]#

Bases: object

Translate coord so its minimum corner sits at the origin.

Subtracts the per-axis minimum of coord in place, so all coordinates become non-negative (the bounding-box min moves to (0, 0, 0)). The same shift is applied to v3 vertex metadata to keep it aligned. Requires coord; a no-op if coord is absent. Registered as PositiveShift – use this string as the type in a transform=[...] config list.

Note

Takes no constructor arguments.

Example

>>> import numpy as np
>>> from pimm.datasets.transform import PositiveShift
>>> data = {"coord": np.array([[2., -1., 5.], [4., 3., 5.]], dtype="f4")}
>>> out = PositiveShift()(data)  # subtract per-axis min -> bbox min at origin
>>> out["coord"]
array([[0., 0., 0.],
       [2., 4., 0.]], dtype=float32)