setViewpoint
Sets the Viewpoint.
The Viewpoint simulates the position of a camera looking at the scene.
Example
Usage
Named Viewpoint
const namedViewpoint = "front";
viewer3d.setViewpoint(namedViewpoint);Orthogonal Viewpoint
const orthogonalViewpoint = {
type: "orthogonal",
location: {
x: 0,
y: 0,
z: 0
}
};
viewer3d.setViewpoint(orthogonalViewpoint);Perspective Viewpoint
const perspectiveViewpoint = {
type: "perspective",
location: {
x: 0,
y: 0,
z: 0
}
};
viewer3d.setViewpoint(perspectiveViewpoint);Parameters
viewpoint
The viewpoint to set.
Type | Required |
|---|---|
String or Object | Yes |
Named Viewpoint
Valid values are:
- home
- front
- back
- left
- right
- top
- bottom
Orthogonal Viewpoint
Name | Type | Required | Description |
|---|---|---|---|
aspectRatio | Number | No | Aspect ratio of the camera |
direction | Vector3 | No | Direction of the camera |
location | Vector3 | Yes | Location of the camera |
type | String | Yes | Value must be orthogonal |
up | Vector3 | No | Normalized vector describing the camera orientation |
viewToWorldScale | Number | No | The scale factor between the camera and the scene |
Perspective Viewpoint
Name | Type | Required | Description |
|---|---|---|---|
aspectRatio | Number | No | Aspect ratio of the camera |
direction | Vector3 | No | Direction of the camera |
fov | Number | No | Field of view of the camera |
location | Vector3 | Yes | Location of the camera |
type | String | Yes | Value must be perspective |
up | Vector3 | No | Normalized vector describing the camera orientation |