implement type-safe spatial transformations