PIXELBANKv8.2.1
Menu

Orthographic Projection

Implement an orthographic projection to transform a 3D point into a 2D point. This process involves projecting a 3D point onto a 2D plane using parallel lines, which is essential in computer vision and image formation.

The concept of orthographic projection is crucial in preserving the shape and size of objects in 2D representations, particularly in CAD designs and engineering drawings. Mathematically, this can be represented as a transformation from a 3D coordinate system (X,Y,Z)(X, Y, Z) to a 2D coordinate system (X,Y)(X, Y).

To achieve this, follow these steps:

  1. Identify the 3D point to be projected.
  2. Apply the projection formula to obtain the 2D point.
X=XX' = X Y=YY' = Y

This technique is widely used in technical drawing and architecture.

Example:

Input:
orthographic([10, 20, 5])
Output:
[10, 20]
Reasoning:
  • Start with the 3D point [X,Y,Z]=[10,20,5][X, Y, Z] = [10, 20, 5].
  • Orthographic projection to the image plane simply drops the z-coordinate: (X,Y,Z)(X,Y)(X, Y, Z) \rightarrow (X, Y).
  • So we keep X=10X = 10 and Y=20Y = 20, ignore Z=5Z = 5, and get the 2D point [10,20][10, 20].

Constraints:

  • Return [x, y] from the 3D point
Editor

Test Results

0/0
Run code to see test results.