warp.spatial_vector#
- warp.spatial_vector(
- dtype: Float = ...,
Return a zero 6D spatial vector.
See the overload that accepts
wandvfor an example.- Parameters:
dtype – Scalar type of the components. Defaults to
float32.- Returns:
The zero spatial vector.
- warp.spatial_vector( ) Vector[Float, Literal[6]]
Construct a 6D spatial vector from the two 3D vectors
wandv.A spatial vector can represent a twist
(angular velocity, linear velocity)or a wrench(torque, force). Warp does not distinguish these interpretations at the type level. Both vectors must have the same scalar type.- Parameters:
w – First 3D part: angular velocity for a twist or torque for a wrench.
v – Last 3D part: linear velocity for a twist or force for a wrench.
dtype – Scalar type of the components, inferred from
wandvwhen omitted.
- Returns:
The spatial vector
(w.x, w.y, w.z, v.x, v.y, v.z).
Example
@wp.kernel def make_twists(out: wp.array[wp.spatial_vector]): # spinning about the z axis while moving along x out[0] = wp.spatial_vector(wp.vec3(0.0, 0.0, 2.0), wp.vec3(1.0, 0.0, 0.0)) out[1] = wp.spatial_vector(0.0, 0.0, 2.0, 1.0, 0.0, 0.0) out = wp.empty(2, dtype=wp.spatial_vector) wp.launch(make_twists, dim=1, outputs=[out]) print(out.numpy())
[[0. 0. 2. 1. 0. 0.] [0. 0. 2. 1. 0. 0.]]
- warp.spatial_vector( ) Vector[Float, Literal[6]]
Construct a 6D spatial vector from six scalar components.
See the overload that accepts
wandvfor the twist and wrench interpretations. All values must have the same scalar type.- Parameters:
wx – First component of the first 3D part.
wy – Second component of the first 3D part.
wz – Third component of the first 3D part.
vx – First component of the last 3D part.
vy – Second component of the last 3D part.
vz – Third component of the last 3D part.
dtype – Scalar type of the components, inferred from the arguments when omitted.
- Returns:
The spatial vector
(wx, wy, wz, vx, vy, vz).
See the overload that accepts
wandvfor an example.