jasi.sim.geo.cartesian
Class Direction

java.lang.Object
  extended by jasi.sim.geo.GeoObject
      extended by jasi.sim.geo.cartesian.Direction
All Implemented Interfaces:
SimValue, Geometric, java.io.Serializable

public final class Direction
extends GeoObject

Immutable class to represent a unit direction.

See Also:
Serialized Form

Field Summary
static Direction X
          X-direction.
static Direction Y
          Y-direction.
static Direction Z
          Z-direction.
 
Fields inherited from interface jasi.sim.geo.Geometric
BEGIN, END, MIDLE
 
Constructor Summary
Direction(Direction d)
          Constructor of a unit direction.
Direction(double x, double y)
          Constructor of a unit direction, with vanishing third component.
Direction(double x, double y, double z)
          Constructor of a unit direction.
Direction(java.lang.String s)
          Constructor of a unit direction.
 
Method Summary
 double[] components()
          Get the components of this direction.
 Direction cross(Direction d)
          Calculate the cross product between this and that direction, i.e., the sine of the angle.
 double dot(Direction d)
          Calculate the scalar product between this and that direction, i.e., the cosine of the angle.
 boolean equals(java.lang.Object o)
          Indicates whether some other object is "equal to" this one.
 int hashCode()
          Returns a hash code value for the object.
 SpaceVec times(Space d)
          Get a space vector from this direction by providing a distance, i.e. a space value.
 SpeedVec times(Speed s)
          Get a speed vector from this direction by providing a speed value.
 java.lang.String toString()
          Returns a string representation of this space object.
 
Methods inherited from class jasi.sim.geo.GeoObject
getContent
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

X

public static final Direction X
X-direction.


Y

public static final Direction Y
Y-direction.


Z

public static final Direction Z
Z-direction.

Constructor Detail

Direction

public Direction(double x,
                 double y,
                 double z)
Constructor of a unit direction.

Parameters:
x - First component.
y - Second component.
z - Third component.

Direction

public Direction(Direction d)
Constructor of a unit direction.

Parameters:
d - A direction.

Direction

public Direction(double x,
                 double y)
Constructor of a unit direction, with vanishing third component.

Parameters:
x - First component.
y - Second component.

Direction

public Direction(java.lang.String s)
Constructor of a unit direction.

Parameters:
s - The string representation of a direction.
Method Detail

dot

public double dot(Direction d)
Calculate the scalar product between this and that direction, i.e., the cosine of the angle.

Parameters:
d - That direction.
Returns:
The scalar product.

cross

public Direction cross(Direction d)
Calculate the cross product between this and that direction, i.e., the sine of the angle.

Parameters:
d - That direction.
Returns:
The cross product.

times

public SpaceVec times(Space d)
Get a space vector from this direction by providing a distance, i.e. a space value.

Parameters:
d - The space value.
Returns:
The space vector.

times

public SpeedVec times(Speed s)
Get a speed vector from this direction by providing a speed value.

Parameters:
s - The speed value.
Returns:
The speed vector.

components

public double[] components()
Get the components of this direction.

Returns:
The components.

hashCode

public int hashCode()
Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.Hashtable.

Overrides:
hashCode in class java.lang.Object
Returns:
A hash code value for this object.

equals

public boolean equals(java.lang.Object o)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class java.lang.Object
Parameters:
o - That object which is compared with this object.
Returns:
True, if this object is the same as that object.

toString

public java.lang.String toString()
Returns a string representation of this space object.

Overrides:
toString in class java.lang.Object
Returns:
The string representation.