A Camera3d is a perspective or orthographic camera in 3D, encapsulating
the camera's viewpoint and projection matrix as well as the dimensions of the
screen the camera renders to. This module contains functions for:
Create a perspective camera from a viewpoint and a vertical field of view.
perspectiveCamera =
Camera3d.perspective
{ viewpoint = cameraViewpoint
, verticalFieldOfView = Angle.degrees 30
}Create an orthographic camera from a viewpoint and the height of the orthographic viewport: this is the height in 3D world units of the section of the model to be rendered.
orthographicCamera =
Camera3d.orthographic
{ viewpoint = cameraViewpoint
, viewportHeight = Length.meters 5
}Get the viewpoint defining the position and orientation of a camera.
Given a camera, a rectangle defining the shape and size of a screen, and a
2D point within that screen, calculate the corresponding 3D ray as an Axis3d.
Conceptually, the ray will pass through the given point on the screen and will
have direction equal to the viewing direction at that point.
For a perspective camera, the origin of the ray will be constant (always equal to the camera's eye point) and the direction will vary depending on the 2D screen point. For an orthographic camera, the direction of the ray will be constant (the view direction of the camera) but the origin will vary depending on the 2D screen point.