org.apache.batik.ext.awt.image
Class PointLight

java.lang.Object
  |
  +--org.apache.batik.ext.awt.image.PointLight
All Implemented Interfaces:
Light

public class PointLight
extends java.lang.Object
implements Light

A light source which emits a light of constant intensity in all directions.


Constructor Summary
PointLight(double lightX, double lightY, double lightZ, java.awt.Color lightColor)
           
 
Method Summary
 double[] getColor()
           
 void getLight(double x, double y, double z, double[] L)
          Computes the light vector in (x, y, z)
 double[][][] getLightMap(double x, double y, double dx, double dy, int width, int height, double[][][] z)
          Returns a light map, starting in (x, y) with dx, dy increments, a given width and height, and z elevations stored in the fourth component on the N array.
 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.
 double getLightX()
           
 double getLightY()
           
 double getLightZ()
           
 boolean isConstant()
           
 void setColor(java.awt.Color newColor)
          Sets the new light color
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PointLight

public PointLight(double lightX,
                  double lightY,
                  double lightZ,
                  java.awt.Color lightColor)
Method Detail

getLightX

public double getLightX()
Returns:
the light's x position

getLightY

public double getLightY()
Returns:
the light's y position

getLightZ

public double getLightZ()
Returns:
the light's z position

getColor

public double[] getColor()
Specified by:
getColor in interface Light
Returns:
the light's color

setColor

public void setColor(java.awt.Color newColor)
Sets the new light color
Specified by:
setColor in interface Light

isConstant

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

getLight

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

getLightMap

public double[][][] getLightMap(double x,
                                double y,
                                double dx,
                                double dy,
                                int width,
                                int height,
                                double[][][] z)
Returns a light map, starting in (x, y) with dx, dy increments, a given width and height, and z elevations stored in the fourth component on the N array.
Specified by:
getLightMap in interface Light
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
dy - delta y for computing light vectors in user space
width - number of samples to compute on the x axis
height - number of samples to compute on the y axis
z - array containing the z elevation for all the points

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
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
lightRwo - 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.


Copyright © 2001 Apache Software Foundation. All Rights Reserved.