camera

package
v0.0.0-...-62b3f6d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 30, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Camera

type Camera struct {
	// Location of the camera
	Origin r3.Vector

	// Direction that the camera is facing
	Direction r3.Vector

	// Direction of "up" for the screen, must be orthogonal to `Direction`
	Up r3.Vector

	// Field of view in the longer direction as an angle in radians
	// TODO: find bounds
	VerticalFov float64

	// Apertrue radius for depth-of-field
	Aperture float64

	// FocalDistance, exists iff `Aperture` is non-zero
	FocalDistance float64
}

func NewCamera

func NewCamera(
	from, at, up r3.Vector,
	vfov float64,
) Camera

NewCamera creates a camera placed at `from` and points towards `at`. Here, `up` specifies a vector which lies in the plane orthogonal to the view direction.

func (Camera) CastRay

func (c Camera) CastRay(s, t float64) geo.Ray

CastRay returns a Ray, where s, t in [-1, 1]

func (*Camera) Focus

func (c *Camera) Focus(focalPoint r3.Vector, aperture float64)

Focus modifies the camera to focus on a position, with depth-of-field

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL