Instance Method

projectionMatrix(for:viewportSize:zNear:zFar:)

Returns a transform matrix appropriate for rendering 3D content to match the image captured by the camera, using the specified parameters.

Declaration

func projectionMatrix(for orientation: UIInterfaceOrientation, viewportSize: CGSize, zNear: CGFloat, zFar: CGFloat) -> simd_float4x4

Parameters

orientation

The orientation in which the camera image is to be presented.

viewportSize

The size, in points, of the view in which the camera image is to be presented.

zNear

The distance from the camera to the near clipping plane.

zFar

The distance from the camera to the far clipping plane.

Return Value

A projection matrix that provides an aspect fill and rotation for the provided viewport size and orientation.

Discussion

This method has no effect on ARKit, and the zNear and zFar parameters have no relationships to ARKit camera state. Instead, this method uses those parameters as well as the camera's state to construct a projection matrix for use in your own rendering code.

See Also

Applying Camera Geometry

var projectionMatrix: simd_float4x4

A transform matrix appropriate for rendering 3D content to match the image captured by the camera.

func viewMatrix(for: UIInterfaceOrientation) -> simd_float4x4

Returns a transform matrix for converting from world space to camera space.

func projectPoint(simd_float3, orientation: UIInterfaceOrientation, viewportSize: CGSize) -> CGPoint

Returns the projection of a point from the 3D world space detected by ARKit into the 2D space of a view rendering the scene.

func unprojectPoint(CGPoint, ontoPlane: simd_float4x4, orientation: UIInterfaceOrientation, viewportSize: CGSize) -> simd_float3?

Returns the projection of a point from the 2D space of a view rendering the scene onto a plane in the 3D world space detected by ARKit.