optics
Class Director

java.lang.Object
  extended by javax.vecmath.Tuple3d
      extended by javax.vecmath.Vector3d
          extended by optics.Director
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class Director
extends javax.vecmath.Vector3d

Class to implement a three-dimensional director being the direction cosines. It is used to hold a ray direction or a surface normal. This class also implements reflection and refraction at interfaces.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.vecmath.Tuple3d
x, y, z
 
Constructor Summary
Director()
          Default Director will be set to invalid by default with all three compoents set to Double.NaN.
Director(Angles a)
          Constructor for a Director specifying two direction angles specifed by a Angles object
Director(Director u)
          Construct a director specified by a Director which is assumes to be normalised, so the component values are just copied.
Director(double theta)
          Constructor a director by specifying one director angles, being the angle with respect to the z-axis.
Director(double theta, double psi)
          Constructor for a Director specifying two direction angles.
Director(double x, double y, double z)
          Constructor a director with three doubles.
Director(javax.vecmath.Tuple3d t)
          Constructor a director from any Tuple3d.
Director(javax.vecmath.Tuple3d start, javax.vecmath.Tuple3d end)
          Constructor to form the Director from a specified start Position towards a specified end Position.
 
Method Summary
 Director clone()
          Return the clone of the current Director
 Angles getAngles()
          Method to get the Director angles
 boolean isInvalid()
          Boolean to test if Director is invalid.
 boolean isValid()
          Boolean to test if Director is valid.
 boolean reflection(Director u)
          Method to reflect from a surface specified by its surface normal.
 boolean refraction(Director u, double ratio)
          Method to refract at a surface specified by it surface normal.
 void set(Angles a)
          Method to se tthe director with theta/psi angles specifed in a Angles object
 void set(double theta, double psi)
          Method to se tthe director with theta/psi angles
 void setInvalid()
          Set the current director to invalid, all three componets with be set to Double.NaN
 
Methods inherited from class javax.vecmath.Vector3d
angle, cross, dot, length, lengthSquared, normalize, normalize
 
Methods inherited from class javax.vecmath.Tuple3d
absolute, absolute, add, add, clamp, clamp, clamp, clamp, clampMax, clampMax, clampMax, clampMax, clampMin, clampMin, clampMin, clampMin, epsilonEquals, equals, equals, get, get, getX, getY, getZ, hashCode, interpolate, interpolate, interpolate, interpolate, negate, negate, scale, scale, scaleAdd, scaleAdd, scaleAdd, set, set, set, set, setX, setY, setZ, sub, sub, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Director

public Director(double x,
                double y,
                double z)
Constructor a director with three doubles. It will automatically be normalised so its length is unity.

Parameters:
x - the x value
y - the y value
z - the z value

Director

public Director(javax.vecmath.Tuple3d t)
Constructor a director from any Tuple3d. It will be automatically normalised so its length is unity.

Parameters:
t - the Tuple

Director

public Director(Director u)
Construct a director specified by a Director which is assumes to be normalised, so the component values are just copied.

Parameters:
u - the Director

Director

public Director(Angles a)
Constructor for a Director specifying two direction angles specifed by a Angles object

Parameters:
a - the Angles

Director

public Director(double theta,
                double psi)
Constructor for a Director specifying two direction angles.

Parameters:
theta - angle with respect to to z-axis
psi - angle with respect to y-axis.

Director

public Director(double theta)
Constructor a director by specifying one director angles, being the angle with respect to the z-axis. The angle with respect to the y-axis is zero.

Parameters:
theta - angle with respect to the z-axis

Director

public Director()
Default Director will be set to invalid by default with all three compoents set to Double.NaN.


Director

public Director(javax.vecmath.Tuple3d start,
                javax.vecmath.Tuple3d end)
Constructor to form the Director from a specified start Position towards a specified end Position. Again the element values are normalised.

Parameters:
start - the start Position
end - the end Position
Method Detail

clone

public Director clone()
Return the clone of the current Director

Overrides:
clone in class javax.vecmath.Tuple3d
Returns:
Director the clone.

set

public void set(double theta,
                double psi)
Method to se tthe director with theta/psi angles

Parameters:
theta - the theta angle
psi - the psi angle

set

public void set(Angles a)
Method to se tthe director with theta/psi angles specifed in a Angles object

Parameters:
a - the Angles

setInvalid

public void setInvalid()
Set the current director to invalid, all three componets with be set to Double.NaN

See Also:
isValid(), isInvalid()

isValid

public boolean isValid()
Boolean to test if Director is valid. It test to see if the x component is NOT set Double.NaN.

Returns:
boolean true if valid

isInvalid

public boolean isInvalid()
Boolean to test if Director is invalid. It test to see if the x component is set Double.NaN.

Returns:
boolean true if invalid

getAngles

public Angles getAngles()
Method to get the Director angles

Returns:
Angles the director angles

reflection

public boolean reflection(Director u)
Method to reflect from a surface specified by its surface normal. Will return true if successful and false if either current director or surface normal is set to invalid.

If fails current director will be set invalid.

Parameters:
u - the surface normal.
Returns:
boolean true for success, false for failure.

refraction

public boolean refraction(Director u,
                          double ratio)
Method to refract at a surface specified by it surface normal. with given refractive index ratio. Will return true on success and false on failure.

If failure is due to surface normal or ratio being invalid, current director is set invalid however if failure is due to being above critical angle, director is not changed.

Parameters:
u - the surface normal
ratio - refractive index ration
Returns:
boolean true for success, false for failure.