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

java.lang.Object
  extended by net.sf.j3d.threeD.raytracer.engine.AbstractSurface
      extended by net.sf.j3d.threeD.raytracer.primitives.Plane
          extended by net.sf.j3d.threeD.raytracer.lighting.RectangularLight
All Implemented Interfaces:
ParticleGroup, Surface, Light, SurfaceLight

public class RectangularLight
extends Plane
implements SurfaceLight

A RectangularLight object provides PointLight samples that are randomly distributed across the a plane surface. The location of the plane is used for the upper left corner of the area to sample.

Author:
Mike Murray

Field Summary
 
Fields inherited from class net.sf.j3d.threeD.raytracer.primitives.Plane
XY, XZ, YZ
 
Fields inherited from interface net.sf.j3d.threeD.raytracer.lighting.Light
castShadows
 
Constructor Summary
RectangularLight()
          Constructs a new RectangularLight object.
RectangularLight(double width, double height)
          Constructs a new RectangularLight object.
 
Method Summary
 double getHeight()
           
 double getIntensity()
          Returns the intensity of this Light object as a double value.
 int getSampleCount()
           
 Light[] getSamples()
           
 Light[] getSamples(int total)
           
 double getWidth()
           
 void setHeight(double height)
          Sets the height of the rectangular area of this RectangularLight object.
 void setIntensity(double intensity)
          Sets the intensity of this Light object.
 void setSampleCount(int samples)
          Sets the number of samples to use for this RectangularLight object.
 void setWidth(double width)
          Sets the width of the rectangular area of this RectangularLight object.
 String toString()
           
 
Methods inherited from class net.sf.j3d.threeD.raytracer.primitives.Plane
getNormalAt, getParticleVertices, getType, intersect, intersectAt, setType
 
Methods inherited from class net.sf.j3d.threeD.raytracer.engine.AbstractSurface
addShader, addTexture, addTransform, calculateTransform, getColor, getColorAt, getColorAt, getIndexOfRefraction, getIndexOfRefraction, getLocation, getParent, getReflectedPercentage, getReflectedPercentage, getRefractedPercentage, getRefractedPercentage, getRotationCoefficients, getScaleCoefficients, getShadeBack, getShadeFront, getShaderSet, getSize, getTexture, getTextures, getTextureSet, getTransform, getTransform, getTransforms, removeTexture, removeTransform, setColor, setIndexOfRefraction, setLocation, setParent, setReflectedPercentage, setRefractedPercentage, setRotationCoefficients, setScaleCoefficients, setShadeBack, setShadeFront, setShaders, setShaders, setSize, setTexture, setTextures, setTransform, setTransforms, shade, triangulate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.j3d.threeD.raytracer.lighting.Light
getColor, getColorAt, setColor
 

Constructor Detail

RectangularLight

public RectangularLight()
Constructs a new RectangularLight object.


RectangularLight

public RectangularLight(double width,
                        double height)
Constructs a new RectangularLight object.

Parameters:
width - Width of rectangle.
height - Hieght of rectangle.
Method Detail

setSampleCount

public void setSampleCount(int samples)
Sets the number of samples to use for this RectangularLight object.

Parameters:
samples -

getSampleCount

public int getSampleCount()
Returns:
The number of samples to use for this RectangularLight object.

getSamples

public Light[] getSamples(int total)
Specified by:
getSamples in interface SurfaceLight
Parameters:
total - Total number of samples to return.
Returns:
An array containing samples for this SurfaceLight instance.
See Also:
SurfaceLight.getSamples(int)

getSamples

public Light[] getSamples()
Specified by:
getSamples in interface SurfaceLight
Returns:
An array containing samples for this SurfaceLight instance.
See Also:
SurfaceLight.getSamples()

setWidth

public void setWidth(double width)
Sets the width of the rectangular area of this RectangularLight object.


setHeight

public void setHeight(double height)
Sets the height of the rectangular area of this RectangularLight object.


getWidth

public double getWidth()
Returns:
The width of the rectangular area of this RectangularLight object.

getHeight

public double getHeight()
Returns:
The width of the rectangular area of this RectangularLight object.

setIntensity

public void setIntensity(double intensity)
Description copied from interface: Light
Sets the intensity of this Light object.

Specified by:
setIntensity in interface Light
See Also:
Light.setIntensity(double)

getIntensity

public double getIntensity()
Description copied from interface: Light
Returns the intensity of this Light object as a double value.

Specified by:
getIntensity in interface Light
See Also:
Light.getIntensity()

toString

public String toString()
Overrides:
toString in class Object
Returns:
"Rectangular Light".