Package scene.camera

Class Camera

java.lang.Object
scene.camera.Camera
All Implemented Interfaces:
java.lang.Iterable<Pixel<Ray[]>>

public class Camera
extends java.lang.Object
implements java.lang.Iterable<Pixel<Ray[]>>
The camera represents the point of view of the rendered image. Iterating over Camera will yield Rays starting from left to right, then top to bottom.
  • Field Summary

    Fields
    Modifier and Type Field Description
    scene.camera.SinglePixelGrid sensor
    The PixelGrid where all rays are shot from.
  • Constructor Summary

    Constructors
    Constructor Description
    Camera()
    Default constructor for camera.
    Camera​(CameraSettings settings)
    Constructs a camera from the given CameraSettings.
  • Method Summary

    Modifier and Type Method Description
    java.util.Iterator<Pixel<Ray[]>> iterator()  
    Point position()
    Gets the point where the camera is located.
    Resolution resolution()
    Gets the resolution of the Camera.
    Camera rotate​(double pitch, double yaw, double roll)
    Create a new camera which is a rotation of this one by the given angles pitch, yaw and roll.
    Camera shift​(NonZeroVector offset)
    Create a new camera which is shifted by the given NonZeroVector.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Field Details

    • sensor

      public final scene.camera.SinglePixelGrid sensor
      The PixelGrid where all rays are shot from.
  • Constructor Details

    • Camera

      public Camera​(CameraSettings settings)
      Constructs a camera from the given CameraSettings.
      Parameters:
      settings - The CameraSettings containing the data necessary to create the camera.
    • Camera

      public Camera()
      Default constructor for camera.
  • Method Details

    • resolution

      public Resolution resolution()
      Gets the resolution of the Camera.
      Returns:
      The resolution of the Camera.
    • position

      public Point position()
      Gets the point where the camera is located.
      Returns:
      the Point where the camera is located.
    • shift

      public Camera shift​(NonZeroVector offset)
      Create a new camera which is shifted by the given NonZeroVector.
      Parameters:
      offset - The NonZeroVector by which to shift the camera.
      Returns:
      A new Camera shifted by the given NonZeroVector.
    • rotate

      public Camera rotate​(double pitch, double yaw, double roll)
      Create a new camera which is a rotation of this one by the given angles pitch, yaw and roll.
      Parameters:
      pitch - The angle in radians to rotate about the left-right axis.
      yaw - The angle in radians to rotate about the up-down axis.
      roll - The angle in radians to rotate about the front-back axis.
      Returns:
      A new Camera rotated by the given angles.
    • iterator

      public java.util.Iterator<Pixel<Ray[]>> iterator()
      Specified by:
      iterator in interface java.lang.Iterable<Pixel<Ray[]>>