com.xj.anylogic.engine.presentation
Class Light3DSpot

java.lang.Object
  extended by com.xj.anylogic.engine.presentation.Light3D
      extended by com.xj.anylogic.engine.presentation.Light3DSpot
All Implemented Interfaces:
com.xj.anylogic.engine.internal.Child, com.xj.anylogic.engine.internal.presentation.Accessor3D_xjal, com.xj.anylogic.engine.internal.presentation.WorldObject3D_xjal, java.io.Serializable, java.lang.Cloneable

public class Light3DSpot
extends Light3D

3D spot light, may be added to 3D groups for scene lighting
Spot source of light is a particular case of a point light. Spot source creates a beam of light that gradually becomes wider and makes a cone of light (with cut-off angle and drop-off rate). You can think of a spot source of light as a searchlight or a car headlight.
Lighting is performed along the given direction which is specified using 2 angles: orientation around X and Z axes.
You can define attenuation coefficients for this kind of source of light.

Author:
XJ Technologies Company Ltd. www.anylogic.com
See Also:
Light3D, Serialized Form

Constructor Summary
Light3DSpot(boolean ispublic, double x, double y, double z, double angleX, double angleZ, double cutOffAngle, double dropOffRate, double constantAttenuation, double linearAttenuation, double quadraticAttenuation, java.awt.Color diffuseColor, java.awt.Color specularColor, java.awt.Color ambientColor, boolean global)
          Creates new 3D spot light
 
Method Summary
 Light3DSpot clone()
          Creates and returns a copy of this light (i.e. new light instance).
 Element3D_xjal get3DElement_xjal()
          This method is internal and shouldn't be accessed by user.
 float getAngleX()
          Returns the orientation of the light around X axis (CW, from +Y to +Z).
 float getAngleZ()
          Returns the orientation of the light around Z axis (CW, from +X to +Y).
 float getConstantAttenuation()
          Returns the constant attenuation factor of the light
 float getCutOffAngle()
          Returns the cut-off angle of light source.
 float getDropOffRate()
          Returns the value of the exponent that is used to control how the light intensity drops off from the center to the cut off angle.
 float getLinearAttenuation()
          Returns the linear attenuation factor of the light
 float getQuadraticAttenuation()
          Returns the quadratic attenuation factor of the light
 float getX()
          Returns the x coordinate of the light source position
 float getY()
          Retunrs the y coordinate of the light source position
 float getZ()
          Returns the z coordinate of the light source position
 void restoreOwner(java.lang.Object owner)
          This method normally should not be called by user
This method restores owner of this object
The method is used in snapshot saving/loading
 void set3DElement_xjal(Element3D_xjal element3D)
          This method is internal and shouldn't be accessed by user.
 void setAngleX(double angleX)
          Sets the orientation of the light around X axis (CW, from +Y to +Z).
 void setAngleZ(double angleZ)
          Sets the orientation of the light around Z axis (CW, from +X to +Y).
 void setAttenuation(double constantAttenuation, double linearAttenuation, double quadraticAttenuation)
          Sets the attenuation factors of the light fading with the distance.
 void setConstantAttenuation(double constantAttenuation)
          Sets the constant attenuation factor of the light
 void setContextReference_xjal(Presentable contextReference)
          This method is internal and shouldn't be accessed by user.
 void setCutOffAngle(double cutOffAngle)
          Sets the cut-off angle of light source.
 void setDropOffRate(double dropOffRate)
          Sets the value of the exponent that can be used to control how the light intensity drops off from the center to the cut off angle.
 void setLinearAttenuation(double linearAttenuation)
          Sets the linear attenuation factor of the light
 void setPos(double x, double y, double z)
          Sets the light source position
 void setQuadraticAttenuation(double quadraticAttenuation)
          Sets the quadratic attenuation factor of the light
 void setX(double x)
          Sets the x coordinate of the light source position
 void setY(double y)
          Sets the y coordinate of the light source position
 void setZ(double z)
          Sets the z coordinate of the light source position
 
Methods inherited from class com.xj.anylogic.engine.presentation.Light3D
getAmbientColor, getDiffuseColor, getGroup, getName, getPresentable, getSpecularColor, isEnabled, isGlobal, setAmbientColor, setDiffuseColor, setEnabled, setGlobal, setSpecularColor, update
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Light3DSpot

public Light3DSpot(boolean ispublic,
                   double x,
                   double y,
                   double z,
                   double angleX,
                   double angleZ,
                   double cutOffAngle,
                   double dropOffRate,
                   double constantAttenuation,
                   double linearAttenuation,
                   double quadraticAttenuation,
                   java.awt.Color diffuseColor,
                   java.awt.Color specularColor,
                   java.awt.Color ambientColor,
                   boolean global)
Creates new 3D spot light

Parameters:
ispublic - if true, the light persists on container's presentation
x - the x coordinate of light source location
y - the y coordinate of light source location
z - the z coordinate of light source location
angleX - the orientation around X axis (CW, from +Y to +Z), in radians
angleZ - the orientation around Z axis (CW, from +X to +Y), in radians
cutOffAngle - the cut-off angle in radians [0, PI/2]
dropOffRate - the value of the light intensity drop off exponent
constantAttenuation - the constant attenuation factor
linearAttenuation - the linear attenuation factor
quadraticAttenuation - the quadraticAttenuation attenuation factor
diffuseColor - the diffuse color component
specularColor - the specular color component
ambientColor - the ambient color component
global - if true, the light affects shapes outside the group the light is placed in
Method Detail

getX

public float getX()
Returns the x coordinate of the light source position

Returns:
the x coordinate of the light source position

setX

public void setX(double x)
Sets the x coordinate of the light source position

Parameters:
x - the x coordinate of the light source position

getY

public float getY()
Retunrs the y coordinate of the light source position

Returns:
the y coordinate of the light source position

setY

public void setY(double y)
Sets the y coordinate of the light source position

Parameters:
y - the y coordinate of the light source position

getZ

public float getZ()
Returns the z coordinate of the light source position

Returns:
the z coordinate of the light source position

setZ

public void setZ(double z)
Sets the z coordinate of the light source position

Parameters:
z - the z coordinate of the light source position

setPos

public void setPos(double x,
                   double y,
                   double z)
Sets the light source position

Parameters:
x - the x coordinate of the light source position
y - the y coordinate of the light source position
z - the z coordinate of the light source position

getConstantAttenuation

public float getConstantAttenuation()
Returns the constant attenuation factor of the light

Returns:
the constant attenuation factor of the light

setConstantAttenuation

public void setConstantAttenuation(double constantAttenuation)
Sets the constant attenuation factor of the light

Parameters:
constantAttenuation - the constant attenuation factor of the light

getLinearAttenuation

public float getLinearAttenuation()
Returns the linear attenuation factor of the light

Returns:
the linear attenuation factor of the light

setLinearAttenuation

public void setLinearAttenuation(double linearAttenuation)
Sets the linear attenuation factor of the light

Parameters:
linearAttenuation - the linear attenuation factor of the light

getQuadraticAttenuation

public float getQuadraticAttenuation()
Returns the quadratic attenuation factor of the light

Returns:
the quadratic attenuation factor of the light

setQuadraticAttenuation

public void setQuadraticAttenuation(double quadraticAttenuation)
Sets the quadratic attenuation factor of the light

Parameters:
quadraticAttenuation - the quadratic attenuation factor of the light

setAttenuation

public void setAttenuation(double constantAttenuation,
                           double linearAttenuation,
                           double quadraticAttenuation)
Sets the attenuation factors of the light fading with the distance.
Light attenuation is calculated using this factor (where d is a distance from the light source):
attenuation factor = 1 / (kC + kLd + kQd2)
If all of provided factors are set to zero, then the light isn't faded.

Parameters:
constantAttenuation - constant attenuation factor: kC
linearAttenuation - linear attenuation factor: kL
quadraticAttenuation - quadratic attenuation factor: kQ

getAngleZ

public float getAngleZ()
Returns the orientation of the light around Z axis (CW, from +X to +Y).
Zero angle value corresponds to orientation of the light towards -Y direction (to the North).

Returns:
the orientation around Z axis (CW, from +X to +Y), in radians

setAngleZ

public void setAngleZ(double angleZ)
Sets the orientation of the light around Z axis (CW, from +X to +Y).
Zero angle value corresponds to orientation of the light towards -Y direction (to the North).

Parameters:
angleZ - the new value of orientation around Z axis (CW, from +X to +Y), in radians

getAngleX

public float getAngleX()
Returns the orientation of the light around X axis (CW, from +Y to +Z).
Zero angle value corresponds to horizontal orientation of the light (parallel with XY-plane).

Returns:
orientation around X axis (CW, from +Y to +Z), in radians

setAngleX

public void setAngleX(double angleX)
Sets the orientation of the light around X axis (CW, from +Y to +Z).
Zero angle value corresponds to horizontal orientation of the light (parallel with XY-plane).

Parameters:
angleX - the new value of orientation around X axis (CW, from +Y to +Z), in radians

getCutOffAngle

public float getCutOffAngle()
Returns the cut-off angle of light source.
The angle is measured from the light direction axis to the light cut-off cone.
The angle lies in the range [0, PI/2] radians, where the angle of PI/2 corresponds to the lighting of the half of the world's space.

Returns:
the cut-off angle of light source, in radians

setCutOffAngle

public void setCutOffAngle(double cutOffAngle)
Sets the cut-off angle of light source.
The angle is measured from the light direction axis to the light cut-off cone.
The angle must lie in the range [0, PI/2] radians, where the angle of PI/2 corresponds to the lighting of the half of the world's space.

Parameters:
cutOffAngle - the cut-off angle in radians [0, PI/2]

getDropOffRate

public float getDropOffRate()
Returns the value of the exponent that is used to control how the light intensity drops off from the center to the cut off angle. Default value is zero.

Returns:
the value of the light intensity drop off exponent

setDropOffRate

public void setDropOffRate(double dropOffRate)
Sets the value of the exponent that can be used to control how the light intensity drops off from the center to the cut off angle. By default a value of zero is used, and provides an even light value from beginning to edge.

Parameters:
dropOffRate - the value of the light intensity drop off exponent

clone

public final Light3DSpot clone()
Description copied from class: Light3D
Creates and returns a copy of this light (i.e. new light instance).
The returned light has the same type and parameters
The returned copy isn't automatically added to the group this light belongs to.
The clone is created in the context of the same active object

Overrides:
clone in class Light3D

restoreOwner

public final void restoreOwner(java.lang.Object owner)
This method normally should not be called by user
This method restores owner of this object
The method is used in snapshot saving/loading

Specified by:
restoreOwner in interface com.xj.anylogic.engine.internal.Child
Parameters:
owner - owner of this object, usually ActiveObject, Experiment or ShapeGroup

setContextReference_xjal

public void setContextReference_xjal(Presentable contextReference)
Description copied from interface: com.xj.anylogic.engine.internal.presentation.WorldObject3D_xjal
This method is internal and shouldn't be accessed by user.
It is public due to technical reasons.

Specified by:
setContextReference_xjal in interface com.xj.anylogic.engine.internal.presentation.WorldObject3D_xjal

set3DElement_xjal

public void set3DElement_xjal(Element3D_xjal element3D)
Description copied from interface: com.xj.anylogic.engine.internal.presentation.Accessor3D_xjal
This method is internal and shouldn't be accessed by user.
It is public due to technical reasons.

Specified by:
set3DElement_xjal in interface com.xj.anylogic.engine.internal.presentation.Accessor3D_xjal

get3DElement_xjal

public Element3D_xjal get3DElement_xjal()
Description copied from interface: com.xj.anylogic.engine.internal.presentation.Accessor3D_xjal
This method is internal and shouldn't be accessed by user.
It is public due to technical reasons.

Specified by:
get3DElement_xjal in interface com.xj.anylogic.engine.internal.presentation.Accessor3D_xjal


Copyright © 1991-2008 XJ Technlogies. All Rights Reserved.