warp.transform\_inverse ======================= .. currentmodule:: warp._src.lang .. function:: transform_inverse(xform: Transformation[Float]) -> Transformation[Float] .. wp-function-tags:: :kernel: true :python: true :differentiable: true Return the inverse of ``xform``. The inverse maps points transformed by ``xform`` back to their original coordinate frame. Because :func:`~warp.quat_inverse` returns the conjugate, ``xform.q`` must have unit length; normalize it first if needed. :param xform: Transformation to invert. Its rotation quaternion must have unit length. :returns: The inverse transformation, with rotation ``quat_inverse(xform.q)`` and translation ``-quat_rotate(quat_inverse(xform.q), xform.p)``. .. rubric:: Example .. testcode:: @wp.kernel def to_local( xform: wp.transform, points: wp.array[wp.vec3], out: wp.array[wp.vec3] ): i = wp.tid() out[i] = wp.transform_point(wp.transform_inverse(xform), points[i]) xform = wp.transform(wp.vec3(0.0, 0.0, 5.0), wp.quat_rpy(0.0, 0.0, wp.pi / 2.0)) points = wp.array([wp.vec3(-2.0, 1.0, 8.0)], dtype=wp.vec3) out = wp.empty(1, dtype=wp.vec3) wp.launch(to_local, dim=1, inputs=[xform, points], outputs=[out]) print(np.round(out.numpy(), 3)) .. testoutput:: [[1. 2. 3.]]