Created
April 12, 2020 22:54
-
-
Save eborghi10/da82c476c155660815461fc491759379 to your computer and use it in GitHub Desktop.
Tf example with numpy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import numpy as np | |
# Define the position of the frame B w.r.t. A | |
a_T_b = np.array([[2, -1, 1]]).transpose() | |
# Define the orientation of the frame B w.r.t. A | |
theta = np.radians(-90) | |
c, s = np.cos(theta), np.sin(theta) | |
a_R_b = np.array(((c, -s), (s, c), (0, 0))) | |
# Homogeneous matrix between A and B | |
a_H_b = np.concatenate((a_R_b, a_T_b), axis=1) | |
# The point 'p' in the frame B | |
b_p = np.array([[1, 1, 1]]).transpose() | |
# Get the resulting point w.r.t the frame A | |
a_p = a_H_b.dot(b_p)[0:2] | |
print(a_p) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment