Skip to contents

Get camera projection matrix

Usage

get_camera_projection_matrix(camera, aspect)

Arguments

camera

A camera_3d.

aspect

A number. Screen aspect ratio (width/height).

Value

A 4x4 numeric matrix.

Examples

cam <- camera_3d(c(0, 10, 10))
get_camera_projection_matrix(cam, 800 / 450)
#>           [,1]     [,2]      [,3]       [,4]
#> [1,] 0.8033332 0.000000  0.000000  0.0000000
#> [2,] 0.0000000 1.428148  0.000000  0.0000000
#> [3,] 0.0000000 0.000000 -1.000025 -0.1000013
#> [4,] 0.0000000 0.000000 -1.000000  0.0000000