Class DistantLight

  • All Implemented Interfaces:
    Light

    public class DistantLight
    extends AbstractLight
    A light source placed at the infinity, such that the light angle is constant over the whole surface.
    Version:
    $Id: DistantLight.java 1733416 2016-03-03 07:07:13Z gadams $
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private double azimuth
      The azimuth of the distant light, i.e., the angle of the light vector on the (X, Y) plane
      private double elevation
      The elevation of the distant light, i.e., the angle of the light vector on the (X, Z) plane.
      private double Lx
      Light vector
      private double Ly
      Light vector
      private double Lz
      Light vector
    • Constructor Summary

      Constructors 
      Constructor Description
      DistantLight​(double azimuth, double elevation, java.awt.Color color)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double getAzimuth()  
      double getElevation()  
      void getLight​(double x, double y, double z, double[] L)
      Computes the light vector in (x, y)
      double[][] getLightRow​(double x, double y, double dx, int width, double[][] z, double[][] lightRow)
      Returns a row of the light map, starting at (x, y) with dx increments, a given width, and z elevations stored in the fourth component on the N array.
      boolean isConstant()  
      • Methods inherited from class java.lang.Object

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

      • azimuth

        private double azimuth
        The azimuth of the distant light, i.e., the angle of the light vector on the (X, Y) plane
      • elevation

        private double elevation
        The elevation of the distant light, i.e., the angle of the light vector on the (X, Z) plane.
      • Lx

        private double Lx
        Light vector
      • Ly

        private double Ly
        Light vector
      • Lz

        private double Lz
        Light vector
    • Constructor Detail

      • DistantLight

        public DistantLight​(double azimuth,
                            double elevation,
                            java.awt.Color color)
    • Method Detail

      • getAzimuth

        public double getAzimuth()
        Returns:
        the DistantLight's azimuth
      • getElevation

        public double getElevation()
        Returns:
        the DistantLight's elevation
      • isConstant

        public boolean isConstant()
        Specified by:
        isConstant in interface Light
        Overrides:
        isConstant in class AbstractLight
        Returns:
        true if the light is constant over the whole surface
      • getLight

        public void getLight​(double x,
                             double y,
                             double z,
                             double[] L)
        Computes the light vector in (x, y)
        Parameters:
        x - x-axis coordinate where the light should be computed
        y - y-axis coordinate where the light should be computed
        L - array of length 3 where the result is stored
        z - z-axis coordinate where the light should be computed
      • getLightRow

        public double[][] getLightRow​(double x,
                                      double y,
                                      double dx,
                                      int width,
                                      double[][] z,
                                      double[][] lightRow)
        Returns a row of the light map, starting at (x, y) with dx increments, a given width, and z elevations stored in the fourth component on the N array.
        Specified by:
        getLightRow in interface Light
        Overrides:
        getLightRow in class AbstractLight
        Parameters:
        x - x-axis coordinate where the light should be computed
        y - y-axis coordinate where the light should be computed
        dx - delta x for computing light vectors in user space
        width - number of samples to compute on the x axis
        z - array containing the z elevation for all the points
        lightRow - array to store the light info to, if null it will be allocated for you and returned.
        Returns:
        an array width columns where each element is an array of three components representing the x, y and z components of the light vector.