PIXELBANKv9.1.0
Menu

Transform Point World to Camera

Transform a 3D point from world coordinates to camera coordinates.

The transformation from world to camera frame uses a rotation matrix R and translation vector t:

Xcam=Râ‹…Xworld+tX_{cam} = R \cdot X_{world} + t

where:

  • XworldX_{world} is the point in world coordinates
  • RR is the 3×3 rotation matrix (camera orientation)
  • tt is the translation vector (camera position)
  • XcamX_{cam} is the point in camera coordinates

This is a rigid transformation - it preserves distances and angles. The camera "looks down" its Z-axis, with X pointing right and Y pointing down (typical convention).

Example:

Input:
transform_point([[1,0,0],[0,1,0],[0,0,1]], [1, 2, 3], [0, 0, 0])
Output:
[1, 2, 3]
Reasoning:

With identity rotation and translation [1,2,3]:

  • X_cam = I × [0,0,0] + [1,2,3]
    • = [0,0,0] + [1,2,3]
    • = [1,2,3]
  • When R is identity and point is origin, result equals t.

Constraints:

  • R: 3x3 rotation matrix
  • t: translation vector [tx, ty, tz]
  • point: [X, Y, Z] in world coordinates
  • Return transformed point [X', Y', Z'] in camera coordinates
🔒

Editor locked

The code editor is locked for Pro problems. It is only available for free problems. Please upgrade to gain access to the code editor for all problems.

solution.py

Test Results

0/0
Run code to see test results.
Transform Point World to Camera - Easy | PixelBank