A homogeneous transformation combines a three-dimensional linear transformation and a translation in one 4×4 matrix:
T=[R0t1]Here, R is a 3×3 matrix and t is a three-dimensional translation vector. For a point p=(x,y,z), form its homogeneous coordinate:
ph=[xyz1]TApply the transformation:
ph′=TphReturn the first three coordinates of every transformed point. A single input point must produce an array of shape (3,), while a batch must produce an array of shape (N,3).
Input: T = [[1, 0, 0, 1], [0, 1, 0, 2], [0, 0, 1, 3], [0, 0, 0, 1]], points = [0, 0, 0]
Output: [1.0, 2.0, 3.0]
Explanation: Appending 1 allows the last column of T to translate the point by (1, 2, 3).
Input: T = [[0, -1, 0, 1], [1, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]], points = [[1, 0, 0], [0, 1, 0]]
Output: [[1.0, 1.0, 0.0], [0.0, 0.0, 0.0]]
np.ones((points.shape[0], 1)) creates the homogeneous coordinate for a batch.
(T @ points_h.T).T applies one transform to every point at once.
Sign in to take notes on this problem
Accepts: array
Accepts: array
A homogeneous transformation combines a three-dimensional linear transformation and a translation in one 4×4 matrix:
T=[R0t1]Here, R is a 3×3 matrix and t is a three-dimensional translation vector. For a point p=(x,y,z), form its homogeneous coordinate:
ph=[xyz1]TApply the transformation:
ph′=TphReturn the first three coordinates of every transformed point. A single input point must produce an array of shape (3,), while a batch must produce an array of shape (N,3).
Input: T = [[1, 0, 0, 1], [0, 1, 0, 2], [0, 0, 1, 3], [0, 0, 0, 1]], points = [0, 0, 0]
Output: [1.0, 2.0, 3.0]
Explanation: Appending 1 allows the last column of T to translate the point by (1, 2, 3).
Input: T = [[0, -1, 0, 1], [1, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]], points = [[1, 0, 0], [0, 1, 0]]
Output: [[1.0, 1.0, 0.0], [0.0, 0.0, 0.0]]
np.ones((points.shape[0], 1)) creates the homogeneous coordinate for a batch.
(T @ points_h.T).T applies one transform to every point at once.
Sign in to take notes on this problem
Accepts: array
Accepts: array