optics
Class Angles

java.lang.Object
  extended by optics.Angles

public class Angles
extends Object

Class to implement the Angle pair theta,psi where theta is the angle from the z-axis and psi from the y-axis.


Field Summary
 double psi
          The psi angle
 double theta
          The theta angle
 
Constructor Summary
Angles()
          Form a Angles object with both angles defaulting to zero
Angles(Angles a)
          Form a Angles object with angle taken from the specifying Angles object
Angles(Director u)
          Form a Angles object specifing a Director
Angles(double theta)
          Form an Angles object specifing of the theta angle, the psi defaulting to zero.
Angles(double theta, double psi)
          Form a Angles object specifing both angle in radians.
 
Method Summary
 Angles clone()
          Method to clone the current Angles object.
static Angles fromString(String s)
          Static method to parse a Angles from a String which contains two doubles separated by spaces, commas or () in any order.
static Angles fromTokens(StringTokenizer tokens)
          Static method to parse a Position from StringTokenizer tokens.
 Director getDirector()
          Method to get the positive z-directions Director from the angles.
 double getPsi()
          Method to get the psi angle wrt to z-axis
 double getPsiDegrees()
          Method to get the psi angle wrt to z-axis in degress
 double getTheta()
          Method to get the theta angle wrt to z-axis
 double getThetaDegrees()
          Method to get the theta angle wrt to z-axis in degrees
static void main(String[] args)
          Static test main methods to read in Angles, and test conversion to Director and back again.
 void set(Director u)
          Method to set the Angles from a Director
 void set(double th, double ps)
          Method to set the two angles in radians
 void setDegrees(double th, double ps)
          Method to set the two angles in degrees
 void setPsi(double psi)
          Method to set psi in radians
 void setPsiDegrees(double psi)
          Method to set psi in degrees
 void setTheta(double th)
          Method to set theta in radians
 void setThetaDegrees(double th)
          Method to set theta in degrees
 String toString()
          Method to get as information as formatted String.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

theta

public double theta
The theta angle


psi

public double psi
The psi angle

Constructor Detail

Angles

public Angles(double theta,
              double psi)
Form a Angles object specifing both angle in radians.

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

Angles

public Angles(Director u)
Form a Angles object specifing a Director

Parameters:
u - the Director

Angles

public Angles(double theta)
Form an Angles object specifing of the theta angle, the psi defaulting to zero.

Parameters:
theta - the theta angle

Angles

public Angles()
Form a Angles object with both angles defaulting to zero


Angles

public Angles(Angles a)
Form a Angles object with angle taken from the specifying Angles object

Method Detail

clone

public Angles clone()
Method to clone the current Angles object.

Overrides:
clone in class Object
Returns:
Angles clone of current Angles object

set

public void set(double th,
                double ps)
Method to set the two angles in radians

Parameters:
th - the theta angle
ps - the psi angle

setDegrees

public void setDegrees(double th,
                       double ps)
Method to set the two angles in degrees

Parameters:
th - the theta angle
ps - the psi angle

set

public void set(Director u)
Method to set the Angles from a Director

Parameters:
u - the Director

setTheta

public void setTheta(double th)
Method to set theta in radians

Parameters:
th - the theta angle

setThetaDegrees

public void setThetaDegrees(double th)
Method to set theta in degrees

Parameters:
th - the theta angle

getTheta

public double getTheta()
Method to get the theta angle wrt to z-axis

Returns:
double the theta angle

getThetaDegrees

public double getThetaDegrees()
Method to get the theta angle wrt to z-axis in degrees

Returns:
double the theta angle in degrees

setPsi

public void setPsi(double psi)
Method to set psi in radians

Parameters:
psi - the psi angle

setPsiDegrees

public void setPsiDegrees(double psi)
Method to set psi in degrees

Parameters:
psi - the psi angle in degress

getPsi

public double getPsi()
Method to get the psi angle wrt to z-axis

Returns:
double the psi angle

getPsiDegrees

public double getPsiDegrees()
Method to get the psi angle wrt to z-axis in degress

Returns:
double the psi angle in degrees

getDirector

public Director getDirector()
Method to get the positive z-directions Director from the angles.

Returns:
Director the director (or direction cosine triplet.

toString

public String toString()
Method to get as information as formatted String.

Overrides:
toString in class Object
Returns:
String formatted String.

fromString

public static Angles fromString(String s)
Static method to parse a Angles from a String which contains two doubles separated by spaces, commas or () in any order. It used StringTokenizer to the parsing.

Parameters:
s - the String containing the angles
Returns:
Position the parsed Angles null if anything fails.

fromTokens

public static Angles fromTokens(StringTokenizer tokens)
Static method to parse a Position from StringTokenizer tokens. It assumes there are at least two tokens being theta,psi in degress which can be read. If there are more than two token, then the next three are read using nextToken().

Parameters:
tokens - the tokens
Returns:
Angles the parsed Angles, null if anything fails.

main

public static void main(String[] args)
Static test main methods to read in Angles, and test conversion to Director and back again.