In robotics / graphics / 3D vision, a 4×4 homogeneous transform encodes rotation + translation. Given a transform matrix T and 3D point(s), convert each point to homogeneous coordinates, apply the transform, and return the spatial coordinates.
Homogeneous Transform:
T=[R0t1]where R∈R3×3(rotation), t∈R3 (translation)
Transformation Process:
Convert point to homogeneous: ph=(x,y,z,1)
Apply transform: ph′=Tph
Extract spatial part: p′=(x′,y′,z′)
Input: T = [[1,0,0,1],[0,1,0,2],[0,0,1,3],[0,0,0,1]], points = [0,0,0]
Output: [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,1,0], [0,0,0]]
Handle single point by reshaping to (1,3), process, then reshape back to (3,).
Use np.hstack() to append 1s, then (T @ points_h.T).T for matrix multiplication.
Sign in to take notes on this problem
Accepts: array
Accepts: array
In robotics / graphics / 3D vision, a 4×4 homogeneous transform encodes rotation + translation. Given a transform matrix T and 3D point(s), convert each point to homogeneous coordinates, apply the transform, and return the spatial coordinates.
Homogeneous Transform:
T=[R0t1]where R∈R3×3(rotation), t∈R3 (translation)
Transformation Process:
Convert point to homogeneous: ph=(x,y,z,1)
Apply transform: ph′=Tph
Extract spatial part: p′=(x′,y′,z′)
Input: T = [[1,0,0,1],[0,1,0,2],[0,0,1,3],[0,0,0,1]], points = [0,0,0]
Output: [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,1,0], [0,0,0]]
Handle single point by reshaping to (1,3), process, then reshape back to (3,).
Use np.hstack() to append 1s, then (T @ points_h.T).T for matrix multiplication.
Sign in to take notes on this problem
Accepts: array
Accepts: array