Class PerspectiveCamera.Builder

java.lang.Object
com.luciad.cameras.PerspectiveCamera.Builder
All Implemented Interfaces:
AutoCloseable
Enclosing class:
PerspectiveCamera

public static final class PerspectiveCamera.Builder extends Object implements AutoCloseable
Factory object that can create new PerspectiveCamera instances.
  • Constructor Details

  • Method Details

    • finalize

      protected void finalize()
      Overrides:
      finalize in class Object
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • eye

      @NotNull public PerspectiveCamera.Builder eye(@NotNull Coordinate 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 camera
      up - the camera's up direction
      Returns:
      this builder
    • look

      @NotNull public PerspectiveCamera.Builder look(@NotNull Camera.Look look)
      Sets the position and orientation of the new camera.
      Parameters:
      look - the position and orientation of the new camera.
      Returns:
      this builder
    • lookAt

      @NotNull public PerspectiveCamera.Builder lookAt(@NotNull Camera.LookAt 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

      @NotNull public PerspectiveCamera.Builder lookFrom(@NotNull Camera.LookFrom 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

      @NotNull public PerspectiveCamera.Builder fovY(@NotNull Angle 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

      @NotNull public PerspectiveCamera build()
      Returns a new perspective camera.
      Returns:
      a new perspective camera.