Package com.luciad.cameras
Class PerspectiveCamera.Builder
java.lang.Object
com.luciad.cameras.PerspectiveCamera.Builder
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
PerspectiveCamera
Factory object that can create new
PerspectiveCamera
instances.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Returns a new perspective camera.void
close()
eye
(Coordinate eye) Sets the eye the position of the new camera.protected void
finalize()
Sets the vertical field of view.look
(Camera.Look look) Sets the position and orientation of the new camera.lookAt
(Camera.LookAt lookAt) Sets the description of what the camera is looking at and the orientation of the camera.lookFrom
(Camera.LookFrom lookFrom) Sets the description of the position and orientation of the new camera.orientation
(Coordinate forward, Coordinate up) Sets the forward the viewing direction of the new camera and the camera's up direction.
-
Constructor Details
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
eye
Sets the eye the position of the new camera.- Parameters:
eye
- the position of the new camera.- Returns:
- this builder
-
orientation
@NotNull public PerspectiveCamera.Builder orientation(@NotNull Coordinate forward, @NotNull Coordinate up) Sets the forward the viewing direction of the new camera and the camera's up direction.- Parameters:
forward
- the viewing direction of the new cameraup
- the camera's up direction- Returns:
- this builder
-
look
Sets the position and orientation of the new camera.- Parameters:
look
- the position and orientation of the new camera.- Returns:
- this builder
-
lookAt
Sets the description of what the camera is looking at and the orientation of the camera.- Parameters:
lookAt
- the description of what the camera is looking at and the orientation of the camera.- Returns:
- this builder
-
lookFrom
Sets the description of the position and orientation of the new camera.- Parameters:
lookFrom
- the description of the position and orientation of the new camera.- Returns:
- this builder
-
fovY
Sets the vertical field of view.- Note
- The horizontal field of view will be derived from vertical field of view based on the aspect ratio. You can convert between horizontal and vertical field-of-view angles using the following formulae:
// Vertical -> horizontal field-of-view double aspectRatio = (double) (camera.getWidth()) / camera.getHeight(); Angle cameraFovX = Angle.fromRadians(2.0 * Math.atan(Math.tan(camera.getFovY().getRadians() / 2.0) * aspectRatio)); // Horizontal -> vertical field-of-view Angle newFovX = new Angle(60.0); Angle newFovY = Angle.fromRadians(2 * Math.atan(Math.tan(newFovX.getRadians() / 2.0) / aspectRatio));
- Parameters:
fovY
- the new vertical field of view.- Returns:
- this builder
-
build
Returns a new perspective camera.- Returns:
- a new perspective camera.
-