From de3de68d949f53744bc05ef8e5e93dd8f10428b6 Mon Sep 17 00:00:00 2001 From: Allen Goodman Date: Mon, 8 Apr 2024 12:43:37 -0400 Subject: [PATCH] rotation --- .../_rotations/_compose_rotation_quaternion.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/beignet/ops/_geometry/_transformations/_rotations/_compose_rotation_quaternion.py b/src/beignet/ops/_geometry/_transformations/_rotations/_compose_rotation_quaternion.py index 6b52a5d2f4..444e299c57 100644 --- a/src/beignet/ops/_geometry/_transformations/_rotations/_compose_rotation_quaternion.py +++ b/src/beignet/ops/_geometry/_transformations/_rotations/_compose_rotation_quaternion.py @@ -39,20 +39,10 @@ def compose_rotation_quaternion( ) for j in range(max(input.shape[0], other.shape[0])): - a = input[j, 0] - b = input[j, 1] - d = input[j, 2] - s = input[j, 3] - - t = other[j, 0] - u = other[j, 1] - c = other[j, 2] - w = other[j, 3] - - output[j, 0] = s * t + w * a + b * c - d * u - output[j, 1] = s * u + w * b + d * t - a * c - output[j, 2] = s * c + w * d + a * u - b * t - output[j, 3] = s * w - a * t - b * u - d * c + output[j, 0] = input[j, 3] * other[j, 0] + other[j, 3] * input[j, 0] + input[j, 1] * other[j, 2] - input[j, 2] * other[j, 1] # fmt: skip + output[j, 1] = input[j, 3] * other[j, 1] + other[j, 3] * input[j, 1] + input[j, 2] * other[j, 0] - input[j, 0] * other[j, 2] # fmt: skip + output[j, 2] = input[j, 3] * other[j, 2] + other[j, 3] * input[j, 2] + input[j, 0] * other[j, 1] - input[j, 1] * other[j, 0] # fmt: skip + output[j, 3] = input[j, 3] * other[j, 3] - input[j, 0] * other[j, 0] - input[j, 1] * other[j, 1] - input[j, 2] * other[j, 2] # fmt: skip x = torch.sqrt(output[j, 0] ** 2.0 + output[j, 1] ** 2.0 + output[j, 2] ** 2.0 + output[j, 3] ** 2.0) # fmt: skip