Rotate a 3D point (or points) around the Z-axis by angle θ (radians). For each point p=(x,y,z), compute p′=Rz(θ)p
Z-Axis Rotation Matrix:
Rz(θ)=cosθsinθ0−sinθcosθ0001Transformation:
x′=xcosθ−ysinθy′=xsinθ+ycosθz′=zInput: points = [1, 0, 0], theta = π/2
Output: [0, 1, 0]
Input: points = [[1, 0, 0], [0, 1, 2]], theta = π/2
Output: [[0, 1, 0], [-1, 0, 2]] (approx)
Handle single point by reshaping to (1,3), process, then reshape back to (3,)
Extract x, y, z columns and apply rotation formulas vectorized across all points.
np.ndarray)Sign in to take notes on this problem
Accepts: array
Accepts: number
Rotate a 3D point (or points) around the Z-axis by angle θ (radians). For each point p=(x,y,z), compute p′=Rz(θ)p
Z-Axis Rotation Matrix:
Rz(θ)=cosθsinθ0−sinθcosθ0001Transformation:
x′=xcosθ−ysinθy′=xsinθ+ycosθz′=zInput: points = [1, 0, 0], theta = π/2
Output: [0, 1, 0]
Input: points = [[1, 0, 0], [0, 1, 2]], theta = π/2
Output: [[0, 1, 0], [-1, 0, 2]] (approx)
Handle single point by reshaping to (1,3), process, then reshape back to (3,)
Extract x, y, z columns and apply rotation formulas vectorized across all points.
np.ndarray)Sign in to take notes on this problem
Accepts: array
Accepts: number