shady.common
Class Point.Cartesian

java.lang.Object
  extended by shady.common.Point
      extended by shady.common.Point.Cartesian
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Enclosing class:
Point

public static class Point.Cartesian
extends Point
implements java.lang.Cloneable

A mutable point in a 2D Cartesian plane.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class shady.common.Point
Point.Cartesian, Point.OnSegment
 
Field Summary
 double x
          The Cartesian x coordinate.
 double y
          The Cartesian y coordinate.
 
Constructor Summary
Point.Cartesian()
          Make a new Cartesian point at the origin.
Point.Cartesian(double x, double y)
          Make a new Cartesian point.
Point.Cartesian(Point p)
          Make a new Cartesian point as a copy of another Point.
 
Method Summary
 Point.Cartesian copy()
          Return a clone().
 Point.Cartesian copyInto(Point.Cartesian dest)
          Covers copyIntoCartesian(shady.common.Point.Cartesian).
 Point.Cartesian copyIntoCartesian(Point.Cartesian dest)
          Copy into a Point.Cartesian Point.
 double getX()
          Get the Cartesian x coordinate.
 double getY()
          Get the Cartesian y coordinate.
 Point invalidate()
          Invalidate this Point.
 boolean isValid()
          Check whether this Point is valid.
 Point.Cartesian set(double x, double y)
          Set booth coordinates in one shot.
 
Methods inherited from class shady.common.Point
distance, distanceSq, distanceSq, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public double x

The Cartesian x coordinate.


y

public double y

The Cartesian y coordinate.

Constructor Detail

Point.Cartesian

public Point.Cartesian(double x,
                       double y)

Make a new Cartesian point.

Parameters:
x - the x coordinate
y - the y coordinate

Point.Cartesian

public Point.Cartesian(Point p)

Make a new Cartesian point as a copy of another Point.

Parameters:
p - the Point to copy, not null

Point.Cartesian

public Point.Cartesian()

Make a new Cartesian point at the origin.

Method Detail

getX

public double getX()

Get the Cartesian x coordinate.

Specified by:
getX in class Point
Returns:
the Cartesian x coordinate

getY

public double getY()

Get the Cartesian y coordinate.

Specified by:
getY in class Point
Returns:
the Cartesian y coordinate

isValid

public boolean isValid()

Check whether this Point is valid.

Default impl just checks that both coordinates are non-NaN.

Overrides:
isValid in class Point
Returns:
true iff this Point is valid

invalidate

public Point invalidate()

Invalidate this Point.

After calling this Point.isValid() will return false.

Specified by:
invalidate in class Point
Returns:
self ref

copy

public Point.Cartesian copy()

Return a clone().

Returns:
a clone

copyInto

public Point.Cartesian copyInto(Point.Cartesian dest)

Covers copyIntoCartesian(shady.common.Point.Cartesian).


copyIntoCartesian

public Point.Cartesian copyIntoCartesian(Point.Cartesian dest)

Copy into a Point.Cartesian Point.

Parameters:
dest - the destination of the copy, if null a new Point.Cartesian is consed

set

public Point.Cartesian set(double x,
                           double y)

Set booth coordinates in one shot.

Parameters:
x - the x coord
y - the y coord
Returns:
a self ref