# IBM Visualization Data Explorer Programmer's Reference

[ Bottom of Page | Previous Page | Next Page | Table of Contents | Partial Table of Contents | Index ]

### DXSetPerspective, DXGetPerspective

Function

Set or retrieve a perspective view.

Syntax
`
#include <dx/dx.h>
`

Camera DXSetPerspective(Camera c, double fov, double aspect)
Camera DXGetPerspective(Camera c, float *fov, float *aspect)

Functional Details

A camera defines the position and orientation of the viewer, the volume of interest of the Object being viewed, and the size of the image to contain the resulting view.

`DXSetPerspective` defines the volume of interest of a perspective camera `c`. This is a pyramid with an apex at the `from` position, and a base centered on `to` point, perpendicular to the `to`-`from` vector. The width of the base is defined by the angle formed by the sides of the pyramid at the apex and the distance between the `to` and `from` points. This angle is also known as the "field of view" and is specified by the `fov` parameter.

The `fov` is defined as twice the tangent of half the angle (e.g, for a 90-degree sweep, the `fov` setting should be 2 * tan(45-degrees), or 2.0). The `fov` can also be thought of as the ratio of the width of the base to the distance from the viewer (e.g., for a view of a 20-meter wide area from a distance of 10 meters, the `fov` setting should be 20/10, or 2.0). The height is defined by width of the base times the `aspect`. With a perspective camera, objects appear smaller with increasing distance.

`DXGetPerspective` returns the `fov` and `aspect` parameters of a perspective camera `c`. If `fov` is not `NULL`, returns the camera fov in `*fov`. If `aspect` is not `NULL`, returns the camera aspect ratio in `*aspect`.

Return Value

`DXSetPerspective` returns the camera or returns `NULL` and sets an error code.

`DXGetPerspective` returns as follows:

- `If the object is a perspective camera:` returns the camera and the camera parameters.
- `If the object is not a perspective camera:` returns `NULL` without setting an error code.
- `If the object is not a valid camera:` returns `NULL` and sets an error code.

See Also

`DXGetCameraMatrix, DXGetCameraRotation, DXGetCameraMatrixWithFuzz, DXNewCamera, DXRender, DXSetOrthographic, DXGetOrthographic, DXSetResolution, DXGetCameraResolution, DXSetView, DXGetView`

16.7 , "Camera Class".

[ Top of Page | Previous Page | Next Page | Table of Contents | Partial Table of Contents | Index ]
[Data Explorer Documentation | QuickStart Guide | User's Guide | User's Reference | Programmer's Reference | Installation and Configuration Guide ]

[Data Explorer Home Page]

[IBM Home Page | Order | Search | Contact IBM | Legal ]