# CameraModel

VisIt has four different camera models:

- Three dimensional camera model
- Two dimensional camera model
- Curve (one dimensional) camera model
- Axis array (parallel coordinates) camera model

This page should be fleshed out to further describe these models.

## Contents

## Commonalities between the camera models

- All of the camera models can be accessed under "Controls->View" in the main GUI.
- All of the camera models can be accessed through the CLI
- GetView3D() / GetView2D() / GetViewAxisArray() / GetViewCurve()
- Plus SetView3D(), etc

## Three dimensional camera model

VisIt's three dimensional camera model has the following fields:

- viewNormal: the direction from the camera location to the focal point
- focus: the focal point
- viewUp: specifies the axis that goes along the height of the screen
- viewAngle: specifies the "view angle", meaning the "angle" of the pyramid that defines the view frustum
- parallelScale: scales how far the camera is located along the viewNormal from the focal point, which affects the scale of the data set in the screen.
- nearPlane: specifies where the pyramid of the view frustum is truncated on the near side. This is denoted relative to the focal point, meaning values are often negative
- farPlane: specifies where the pyramid of the view frustum is truncated on the near side. This is denoted relative to the focal point.
- imagePan: allows the image to be translated without affecting the view frustum definition
- imageZoom: allows the image to be zoomed in on without affected the view frustum definition
- perspective: a Boolean. 1 for perspective projection, 0 for orthographic
- eyeAngle: specifies the angle of the eye for stereo viewing.
- centerOfRotationSet: specifies whether or not rotations occur around the focal point (value of 0) or another specified point (value of 1)
- centerOfRotation: the place to rotate around if we are not using the focal point
- axis3DScaleFlag: specifies whether or not the axes are scaled by a scale factor
- axis3DScales: scale factor for each axis (x, y, z)
- shear: Shear is necessary to support oblique projections, such as "cabinet" and "cavalier". It takes the form of a 3-vector, defaulting to the value "0 0 1", which disables any shear. The shear setting is most useful in orthographic mode (i.e. where the "Perspective" option is turned off); in this setting, the Z component should remain at its default value of 1. The X and Y components are the image-space horizontal and vertical offsets to apply for each unit of depth, respectively. For example, a "cabinet projection" has an angle of 30 degrees and a scale-factor of one-half; to achieve this effect, set the shear vector to <0.433 0.25 1> and disable perspective projection.

### Where the camera is located

Camera position = normalized(viewNormal) * (parallelScale / tan(pi * viewAngle / 360)) + focus.

If you have the camera position, a focus or lookat point, and a view angle, you can get the parallelScale with this formula: parallelScale = length(lookat - camera) * tan(viewAngle* pi / 360.0)

## Two dimensional camera model

VisIt's two-dimensional camera model has the following fields:

- windowCoords: this defines what data is visible. It is a 4-tuple of the form (x-min, x-max, y-min, y-max)
- viewportCoords: this defines what portion of the larger window the data is visible in. The default is (0.2, 0.95, 0.15, 0.95). This means data is starts being visible at 20% of the distance from the left hand side and stops being visible at 95% of the distance from the left (or 5% from the right hand side). Similarly, data is visible at 15% from the bottom going to 95% from the bottom (or 5% from the top)
- fullFrameActivationMode: this allows the data to be stretched so that it fills the screen, which is useful for very thin data. The default is "auto", which means VisIt will detect when to stretch and when not to. (It only stretches for extreme aspect ratios.)
- xScale: choose between linear and log scaling in X
- yScale: choose between linear and log scaling in Y