Invert a Homogeneous Transform
Implement invert_transform(T).
Examples
A pure translation inverts to the opposite translation
- Input
- invert_transform([[1, 0, 0, 1], [0, 1, 0, 2], [0, 0, 1, 3], [0, 0, 0, 1]])
- Output
- [[1, 0, 0, -1], [0, 1, 0, -2], [0, 0, 1, -3], [0, 0, 0, 1]]
A pure rotation inverts to its transpose
- Input
- invert_transform([[0, -1, 0, 0], [1, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]])
- Output
- [[0, 1, 0, 0], [-1, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]
Rotation plus translation: the translation is rotated back, not just negated
- Input
- invert_transform([[0, -1, 0, 1], [1, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]])
- Output
- [[0, 1, 0, 0], [-1, 0, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]
Hints
Hint 1
Use a matrix product rather than nested loops, and check which operand transposes.
Hint 2
Watch for this: negated the translation without rotating it.
Requirements
: (4, 4) array with an orthogonal 3x3 rotation block
Return (4, 4) inverse transform
Constraints
Allowed library: NumPy only
Time limit: 200 ms, Memory: 64 MB
Try similar problems(4)
Industrial Robotics: Kinematics and Control · ~12 min
Industrial Robotics: Kinematics and Control · ~12 min
Industrial Robotics: Kinematics and Control · ~14 min
Industrial Robotics: Kinematics and Control · ~12 min
Where this shows up
6 employers weight this skill
4 autonomy companies, 2 defense companies. Top match scores 93.
import numpy as np
def invert_transform(T):
"""
Closed-form inverse of a 4x4 homogeneous transform.
Args:
T: (4, 4) array with an orthogonal 3x3 rotation block
Returns:
(4, 4) inverse transform
"""
# YOUR CODE HERE
pass