net.sf.j3d.threeD.raytracer.lighting
Class PointLight

java.lang.Object
  extended by net.sf.j3d.threeD.raytracer.lighting.PointLight
All Implemented Interfaces:
Light

public class PointLight
extends Object
implements Light

An PointLight object represents a light which has its source at a point in the scene. The color and intensity of the light may by specified, but by default it is white light. Also, coefficients for distance attenuation may be specified also, but by default are 0.0, 0.0, and 1.0 (no attenuation).


Field Summary
 
Fields inherited from interface net.sf.j3d.threeD.raytracer.lighting.Light
castShadows
 
Constructor Summary
PointLight()
          Constructs a PointLight object with the default intensity and color at the origin.
PointLight(double intensity)
          Constructs a PointLight object with the specified intensity and default color at the origin.
PointLight(double intensity, RGB color)
          Constructs a PointLight object with the specified intensity and color at the origin.
PointLight(Vector location)
          Constructs a PointLight object with the specified location and default intensity and color.
PointLight(Vector location, double intensity, RGB color)
          Constructs a PointLight object with the specified location, intensity, and color.
 
Method Summary
 double[] getAttenuationCoefficients()
          Returns the coefficients a, b, and c for the quadratic function used for distance attenuation of the light represented by this PointLight object as an array of double values.
 RGB getColor()
          Returns the color of this PointLight object as an RGB object.
 RGB getColorAt(Vector point)
          Returns the color of the light represented by this PointLight object at the specified point as an RGB object.
 double getIntensity()
          Returns the intensity of this PointLight object as a double value.
 Vector getLocation()
          Returns the location of this PointLight object as a Vector object.
 void setAttenuationCoefficients(double a, double b, double c)
          Sets the coefficients a, b, and c for the quadratic function used for distance attenuation of the light represented by this PointLight object to the specified double values.
 void setColor(RGB color)
          Sets the color of this PointLight object to the color represented by the specified RGB object.
 void setIntensity(double intensity)
          Sets the intensity of this PointLight object to the specified double value.
 void setLocation(Vector location)
          Sets the location of this PointLight object to the location represented by the specified Vector object.
 String toString()
          Returns "Point Light".
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PointLight

public PointLight()
Constructs a PointLight object with the default intensity and color at the origin.


PointLight

public PointLight(Vector location)
Constructs a PointLight object with the specified location and default intensity and color.


PointLight

public PointLight(double intensity)
Constructs a PointLight object with the specified intensity and default color at the origin.


PointLight

public PointLight(double intensity,
                  RGB color)
Constructs a PointLight object with the specified intensity and color at the origin.


PointLight

public PointLight(Vector location,
                  double intensity,
                  RGB color)
Constructs a PointLight object with the specified location, intensity, and color.

Method Detail

setIntensity

public void setIntensity(double intensity)
Sets the intensity of this PointLight object to the specified double value.

Specified by:
setIntensity in interface Light

setColor

public void setColor(RGB color)
Sets the color of this PointLight object to the color represented by the specified RGB object.

Specified by:
setColor in interface Light

setLocation

public void setLocation(Vector location)
Sets the location of this PointLight object to the location represented by the specified Vector object.


setAttenuationCoefficients

public void setAttenuationCoefficients(double a,
                                       double b,
                                       double c)
Sets the coefficients a, b, and c for the quadratic function used for distance attenuation of the light represented by this PointLight object to the specified double values.


getIntensity

public double getIntensity()
Returns the intensity of this PointLight object as a double value.

Specified by:
getIntensity in interface Light

getColor

public RGB getColor()
Returns the color of this PointLight object as an RGB object.

Specified by:
getColor in interface Light

getColorAt

public RGB getColorAt(Vector point)
Returns the color of the light represented by this PointLight object at the specified point as an RGB object.

Specified by:
getColorAt in interface Light

getLocation

public Vector getLocation()
Returns the location of this PointLight object as a Vector object.


getAttenuationCoefficients

public double[] getAttenuationCoefficients()
Returns the coefficients a, b, and c for the quadratic function used for distance attenuation of the light represented by this PointLight object as an array of double values.


toString

public String toString()
Returns "Point Light".

Overrides:
toString in class Object