v3d.custom_transform#
- visu3d.custom_transform(fn: Callable[[DcT, _T], _T]) Callable[[DcT], CustomTransform[DcT, _T]] [source]#
Custom transformation decorator.
This decorator is a wrapper around custom transformations method to allow composing custom transformations with
v3d.Transform
.Usage:
class MyObject(v3d.DataclassArray): @property @v3d.custom_transform def my_transform(self, points: _T) -> _T: ... # Custom transform implementation return points obj = MyObject() # The custom transform can be composed with other points = obj.my_transform @ points points = obj.my_transform @ cam.world_from_px @ px_coords
Note: The decorated method is automatically vectorized. See dca.vectorize_method.
- Parameters:
fn – Method to decorate
- Returns:
The decorated function (which is should be decorated with @property).