Package org.apache.batik.ext.awt.image
Class SpotLight
- java.lang.Object
-
- org.apache.batik.ext.awt.image.AbstractLight
-
- org.apache.batik.ext.awt.image.SpotLight
-
- All Implemented Interfaces:
Light
public class SpotLight extends AbstractLight
A light source which emits a light of constant intensity in all directions.- Version:
- $Id: SpotLight.java 1733416 2016-03-03 07:07:13Z gadams $
-
-
Field Summary
Fields Modifier and Type Field Description private double
lightX
The light position, in user spaceprivate double
lightY
The light position, in user spaceprivate double
lightZ
The light position, in user spaceprivate double
limitingConeAngle
Limiting cone angleprivate double
limitingCos
Limiting cone angleprivate double
pointAtX
Point where the light points toprivate double
pointAtY
Point where the light points toprivate double
pointAtZ
Point where the light points toprivate double[]
S
Light direction vectorprivate double
specularExponent
Specular exponent (light focus)
-
Constructor Summary
Constructors Constructor Description SpotLight(double lightX, double lightY, double lightZ, double pointAtX, double pointAtY, double pointAtZ, double specularExponent, double limitingConeAngle, java.awt.Color lightColor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
getLight(double x, double y, double z, double[] L)
Computes the light vector in (x, y, z)void
getLight4(double x, double y, double z, double[] L)
computes light vector in (x, y, z).double
getLightBase(double x, double y, double z, double[] L)
Computes the light vector in (x, y, z)double[][]
getLightRow4(double x, double y, double dx, int width, double[][] z, double[][] lightRow)
double
getLightX()
double
getLightY()
double
getLightZ()
double
getLimitingConeAngle()
double
getPointAtX()
double
getPointAtY()
double
getPointAtZ()
double
getSpecularExponent()
boolean
isConstant()
-
Methods inherited from class org.apache.batik.ext.awt.image.AbstractLight
getColor, getLightMap, getLightRow, setColor, sRGBToLsRGB
-
-
-
-
Field Detail
-
lightX
private double lightX
The light position, in user space
-
lightY
private double lightY
The light position, in user space
-
lightZ
private double lightZ
The light position, in user space
-
pointAtX
private double pointAtX
Point where the light points to
-
pointAtY
private double pointAtY
Point where the light points to
-
pointAtZ
private double pointAtZ
Point where the light points to
-
specularExponent
private double specularExponent
Specular exponent (light focus)
-
limitingConeAngle
private double limitingConeAngle
Limiting cone angle
-
limitingCos
private double limitingCos
Limiting cone angle
-
S
private final double[] S
Light direction vector
-
-
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
-
getPointAtX
public double getPointAtX()
- Returns:
- x-axis coordinate where the light points to
-
getPointAtY
public double getPointAtY()
- Returns:
- y-axis coordinate where the light points to
-
getPointAtZ
public double getPointAtZ()
- Returns:
- z-axis coordinate where the light points to
-
getSpecularExponent
public double getSpecularExponent()
- Returns:
- light's specular exponent (focus)
-
getLimitingConeAngle
public double getLimitingConeAngle()
- Returns:
- light's limiting cone angle
-
isConstant
public boolean isConstant()
- Specified by:
isConstant
in interfaceLight
- Overrides:
isConstant
in classAbstractLight
- Returns:
- true if the light is constant over the whole surface
-
getLightBase
public final double getLightBase(double x, double y, double z, double[] L)
Computes the light vector in (x, y, z)- Parameters:
x
- x-axis coordinate where the light should be computedy
- y-axis coordinate where the light should be computedz
- z-axis coordinate where the light should be computedL
- array of length 3 where the result is stored- Returns:
- the intensity factor for this light vector.
-
getLight
public final void getLight(double x, double y, double z, double[] L)
Computes the light vector in (x, y, z)- Parameters:
x
- x-axis coordinate where the light should be computedy
- y-axis coordinate where the light should be computedz
- z-axis coordinate where the light should be computedL
- array of length 3 where the result is stored, x,y,z are scaled by light intensity.
-
getLight4
public final void getLight4(double x, double y, double z, double[] L)
computes light vector in (x, y, z).- Parameters:
x
- x-axis coordinate where the light should be computedy
- y-axis coordinate where the light should be computedz
- z-axis coordinate where the light should be computedL
- array of length 4 where result is stored. 0,1,2 are x,y,z respectively of light vector (normalized). 3 is the intensity of the light at this point.
-
getLightRow4
public double[][] getLightRow4(double x, double y, double dx, int width, double[][] z, double[][] lightRow)
-
-