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 Link icon

  • Method Details Link icon

    • finalize Link icon

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

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

      @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 Link icon

      @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 Link icon

      @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 Link icon

      @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 Link icon

      @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 Link icon

      @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 Link icon

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