com.partnersoft.geometry.xy
Class XyPolar

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

public class XyPolar
extends java.lang.Object
implements Immutable

A polar coordinate in (x, y) space. Actually, strictly speaking polars are in (r, theta) space but they are useful when doing trigonometry on (x, y) cartesian planes.

Copyright 2007 Partner Software, Inc.

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

Constructor Summary
XyPolar(double radius, XyDirection direction)
          Create a new polar coordinate with the given radius and angle.
 
Method Summary
 XyDirection getDirection()
          The angular coordinate.
 double getRadius()
          The radial coordinate, in whatever units X and Y are in.
 XyPolar rotatedBy(XyRotation rotation)
          Returns a rotated version of this polar.
 XyPoint toPoint()
          Returns the polar coordinate as an (x, y) point.
 java.lang.String toString()
           
 XyVector toVector()
          Returns the vector equivalent of this polar coordinate.
 XyPolar withDirection(XyDirection newDirection)
          Returns a modified version of this polar with the given direction.
 XyPolar withRadius(double newRadius)
          Returns a modified version of this polar with the given radius.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XyPolar

public XyPolar(double radius,
               XyDirection direction)
Create a new polar coordinate with the given radius and angle.

Parameters:
radius - (in whatever units X and Y are in)
direction - direction of polar vector
Method Detail

withRadius

public XyPolar withRadius(double newRadius)
Returns a modified version of this polar with the given radius.


withDirection

public XyPolar withDirection(XyDirection newDirection)
Returns a modified version of this polar with the given direction.


rotatedBy

public XyPolar rotatedBy(XyRotation rotation)
Returns a rotated version of this polar.


toPoint

public XyPoint toPoint()
Returns the polar coordinate as an (x, y) point.

Returns:
(x, y) point for this polar coordinate

toVector

public XyVector toVector()
Returns the vector equivalent of this polar coordinate.


toString

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

getRadius

public double getRadius()
The radial coordinate, in whatever units X and Y are in.

Returns:
radius

getDirection

public XyDirection getDirection()
The angular coordinate.

Returns:
angle