warp.spatial_cross#
- warp.spatial_cross( ) Vector[Float, Literal[6]]#
Return the spatial cross product of
aandb, treating both as twists.The operation is antisymmetric:
spatial_cross(a, b) == -spatial_cross(b, a). It computes velocity-product terms used in spatial-acceleration calculations for moving coordinate frames. Usespatial_cross_dual()whenbis a wrench. Both arguments must have the same scalar type.- Parameters:
a – First spatial vector, interpreted as a twist.
b – Second spatial vector, interpreted as a twist.
- Returns:
The spatial vector
(w_a x w_b, v_a x w_b + w_a x v_b), wherea = (w_a, v_a)andb = (w_b, v_b).
Example
@wp.kernel def compute_spatial_cross( a: wp.array[wp.spatial_vector], b: wp.array[wp.spatial_vector], out: wp.array[wp.spatial_vector], ): i = wp.tid() out[i] = wp.spatial_cross(a[i], b[i]) a = wp.array([wp.spatial_vector(0.0, 0.0, 1.0, 0.0, 0.0, 0.0)], dtype=wp.spatial_vector) b = wp.array([wp.spatial_vector(0.0, 0.0, 0.0, 1.0, 0.0, 0.0)], dtype=wp.spatial_vector) out = wp.empty(1, dtype=wp.spatial_vector) wp.launch(compute_spatial_cross, dim=1, inputs=[a, b], outputs=[out]) print(out.numpy())
[[0. 0. 0. 0. 1. 0.]]