Class CameraPlane


  • public class CameraPlane
    extends java.lang.Object
    The plane that the camera appears on and rotates around.
    Since:
    18246
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static double HALF_PI  
      private int height
      The height of the image
      (package private) static double PANORAMA_FOV
      The field of view for the panorama at 0 zoom
      private Vector3D rotation  
      static double TWO_PI  
      private Vector3D[][] vectors  
      private int width
      The width of the image
      private static byte YAW_DIRECTION
      This determines the yaw direction.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        CameraPlane​(int width, int height)
      Create a new CameraPlane with the default FOV (110 degrees).
      private CameraPlane​(int width, int height, double distance)
      Create a new CameraPlane
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void commonFastByteMapping​(java.awt.image.BufferedImage sourceImage, java.awt.image.BufferedImage targetImage, java.awt.Rectangle visibleRect)  
      int getHeight()
      Get the height of the image
      java.awt.Point getPoint​(Vector3D vector)
      Get the point for a vector
      Vector3D getRotation()  
      Vector3D getVector3D​(double x, double y)
      Convert a point to a 3D vector.
      Vector3D getVector3D​(int x, int y)
      Convert a point to a 3D vector (vectors are cached)
      Vector3D getVector3D​(java.awt.Point p)
      Convert a point to a 3D vector
      int getWidth()
      Get the width of the image
      void mapping​(java.awt.image.BufferedImage sourceImage, java.awt.image.BufferedImage targetImage, java.awt.Rectangle visibleRect)
      Maps a panoramic view of sourceImage into targetImage based on current configuration of Camera Plane
      java.awt.geom.Point2D.Double mapPoint​(double x, double y)
      Map a real point to the displayed point.
      java.awt.geom.Point2D.Double mapPoint​(int x, int y)
      Map a real point to the displayed point.
      private Vector3D rotate​(Vector3D vec)
      Rotate a vector using the current rotation
      (package private) void setRotation​(double azimuthalAngle, double polarAngle)  
      void setRotation​(java.awt.Point p)
      Set camera plane rotation by current plane position.
      void setRotation​(Vector3D vec)
      Set camera plane rotation by spherical vector.
      void setRotationFromDelta​(java.awt.Point from, java.awt.Point to)
      Set the rotation from the difference of two points
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CameraPlane

        public CameraPlane​(int width,
                           int height)
        Create a new CameraPlane with the default FOV (110 degrees).
        Parameters:
        width - The width of the image
        height - The height of the image
      • CameraPlane

        private CameraPlane​(int width,
                            int height,
                            double distance)
        Create a new CameraPlane
        Parameters:
        width - The width of the image
        height - The height of the image
        distance - The radial distance of the photosphere
    • Method Detail

      • getWidth

        public int getWidth()
        Get the width of the image
        Returns:
        The width of the image
      • getHeight

        public int getHeight()
        Get the height of the image
        Returns:
        The height of the image
      • getPoint

        @Nullable
        public java.awt.Point getPoint​(Vector3D vector)
        Get the point for a vector
        Parameters:
        vector - the vector for which the corresponding point on the camera plane will be returned
        Returns:
        the point on the camera plane to which the given vector is mapped, nullable
      • getVector3D

        public Vector3D getVector3D​(java.awt.Point p)
        Convert a point to a 3D vector
        Parameters:
        p - The point to convert
        Returns:
        The vector
      • getVector3D

        public Vector3D getVector3D​(int x,
                                    int y)
        Convert a point to a 3D vector (vectors are cached)
        Parameters:
        x - The x coordinate
        y - The y coordinate
        Returns:
        The vector
      • getVector3D

        public Vector3D getVector3D​(double x,
                                    double y)
        Convert a point to a 3D vector. Warning: This method does not cache.
        Parameters:
        x - The x coordinate
        y - The y coordinate
        Returns:
        The vector (the middle of the image is 0, 0)
      • setRotation

        public void setRotation​(java.awt.Point p)
        Set camera plane rotation by current plane position.
        Parameters:
        p - Point within current plane.
      • setRotationFromDelta

        public void setRotationFromDelta​(java.awt.Point from,
                                         java.awt.Point to)
        Set the rotation from the difference of two points
        Parameters:
        from - The originating point
        to - The new point
      • setRotation

        public void setRotation​(Vector3D vec)
        Set camera plane rotation by spherical vector.
        Parameters:
        vec - vector pointing new view position.
      • setRotation

        void setRotation​(double azimuthalAngle,
                         double polarAngle)
      • rotate

        private Vector3D rotate​(Vector3D vec)
        Rotate a vector using the current rotation
        Parameters:
        vec - The vector to rotate
        Returns:
        A rotated vector
      • mapping

        public void mapping​(java.awt.image.BufferedImage sourceImage,
                            java.awt.image.BufferedImage targetImage,
                            java.awt.Rectangle visibleRect)
        Maps a panoramic view of sourceImage into targetImage based on current configuration of Camera Plane
        Parameters:
        sourceImage - The image to paint
        targetImage - The target image
        visibleRect - The part of target image which will be visible
      • commonFastByteMapping

        private void commonFastByteMapping​(java.awt.image.BufferedImage sourceImage,
                                           java.awt.image.BufferedImage targetImage,
                                           java.awt.Rectangle visibleRect)
      • mapPoint

        public final java.awt.geom.Point2D.Double mapPoint​(int x,
                                                           int y)
        Map a real point to the displayed point. This method uses cached vectors.
        Parameters:
        x - The original x coordinate
        y - The original y coordinate
        Returns:
        The scaled (0-1) point in the image. Use p.x * (image.getWidth() - 1) or p.y * image.getHeight() - 1.
      • mapPoint

        public final java.awt.geom.Point2D.Double mapPoint​(double x,
                                                           double y)
        Map a real point to the displayed point. This function does not use cached vectors.
        Parameters:
        x - The original x coordinate
        y - The original y coordinate
        Returns:
        The scaled (0-1) point in the image. Use p.x * (image.getWidth() - 1) or p.y * image.getHeight() - 1.