com.partnersoft.geometry.xy
Class XyDeflection

java.lang.Object
  extended by com.partnersoft.geometry.xy.XyDeflection
All Implemented Interfaces:
Immutable

public class XyDeflection
extends java.lang.Object
implements Immutable

A deflection angle. Retains the original reference direction.

Copyright 2007 Partner Software, Inc.

Version:
$Id:XyDeflection.java 1012 2007-11-24 18:30:02Z paul $
Author:
Paul Reavis, Richard Fay, Rich Stepanski

Constructor Summary
XyDeflection(XyDirection baseDirection, XyDirection deflectedDirection)
          Creates a new XyDeflection reflecting the given deflected direction's deflection from the given base direction.
XyDeflection(XyDirection origin, XyRotation rotation)
          Create a new XyDeflection from the given starting direction (angular origin) and angle offset.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 XyDeflection flipped()
          Returns a modified version of this deflection with the angle flipped (leftTurn is set to the opposite of this deflection's setting).
 XyDirection getOrigin()
          Returns the origin (reference or straight-line) direction that this is a deflection from.
 XyRotation getRotation()
          Returns the rotation angle and direction from the origin this is a deflection from.
 XyDirection toDirection()
          Computes the final direction from the reference and angle.
 java.lang.String toString()
           
 XyDeflection withOrigin(XyDirection newOrigin)
          Returns a modified version of this deflection with the given origin.
 XyDeflection withRotation(XyRotation newRotation)
          Returns a modified version of this deflection with the given rotation.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XyDeflection

public XyDeflection(XyDirection origin,
                    XyRotation rotation)
Create a new XyDeflection from the given starting direction (angular origin) and angle offset.


XyDeflection

public XyDeflection(XyDirection baseDirection,
                    XyDirection deflectedDirection)
Creates a new XyDeflection reflecting the given deflected direction's deflection from the given base direction.

Method Detail

withOrigin

public XyDeflection withOrigin(XyDirection newOrigin)
Returns a modified version of this deflection with the given origin.


withRotation

public XyDeflection withRotation(XyRotation newRotation)
Returns a modified version of this deflection with the given rotation.


flipped

public XyDeflection flipped()
Returns a modified version of this deflection with the angle flipped (leftTurn is set to the opposite of this deflection's setting).


toDirection

public XyDirection toDirection()
Computes the final direction from the reference and angle.


equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getOrigin

public XyDirection getOrigin()
Returns the origin (reference or straight-line) direction that this is a deflection from.


getRotation

public XyRotation getRotation()
Returns the rotation angle and direction from the origin this is a deflection from.