shady.common
Class Point.OnSegment

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

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

A mutable point on a Segment.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class shady.common.Point
Point.Cartesian, Point.OnSegment
 
Field Summary
 AbstractSegment segment
          The Segment, not null.
 double where
          The location on segment (0.0->start, 1.0->end).
 
Constructor Summary
Point.OnSegment()
          Make a new uninitialized OnSegment Point.
Point.OnSegment(AbstractSegment segment, double where)
          Make a new point on a Segment.
Point.OnSegment(Point.OnSegment p)
          Copy another OnSegment point.
 
Method Summary
 Point.OnSegment copy()
          Return a clone().
 Point.Cartesian copyInto(Point.Cartesian dest)
          Covers copyIntoCartesian(shady.common.Point.Cartesian).
 Point.OnSegment copyInto(Point.OnSegment dest)
          Covers copyIntoOnSegment(shady.common.Point.OnSegment).
 Point.Cartesian copyIntoCartesian(Point.Cartesian dest)
          Copy into a Point.Cartesian Point.
 Point.OnSegment copyIntoOnSegment(Point.OnSegment dest)
          Copy into an Point.OnSegment 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.OnSegment set(AbstractSegment segment, double where)
          Set segment and where one shot.
 java.lang.String toString()
          Convenience cover of toString(DoubleFormatter), uses no formatter.
 java.lang.String toString(DoubleFormatter formatter)
          Return a human-readable String representation of this Point.Point.OnSegment.
 
Methods inherited from class shady.common.Point
distance, distanceSq, distanceSq
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

segment

public AbstractSegment segment

The Segment, not null.


where

public double where

The location on segment (0.0->start, 1.0->end).

Constructor Detail

Point.OnSegment

public Point.OnSegment(AbstractSegment segment,
                       double where)

Make a new point on a Segment.

Parameters:
segment - the segment, not null
where - the location on segment (0.0->start, 1.0->end)

Point.OnSegment

public Point.OnSegment(Point.OnSegment p)

Copy another OnSegment point.

Parameters:
p - the point to copy

Point.OnSegment

public Point.OnSegment()

Make a new uninitialized OnSegment Point.

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.OnSegment copy()

Return a clone().

Returns:
a clone

copyInto

public Point.OnSegment copyInto(Point.OnSegment dest)

Covers copyIntoOnSegment(shady.common.Point.OnSegment).


copyIntoOnSegment

public Point.OnSegment copyIntoOnSegment(Point.OnSegment dest)

Copy into an Point.OnSegment Point.

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

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

toString

public java.lang.String toString(DoubleFormatter formatter)

Return a human-readable String representation of this Point.Point.OnSegment.

Overrides:
toString in class Point
Parameters:
formatter - the formatter to use, null if none
Returns:
a human-readable String representation of this Point.OnSegment

toString

public java.lang.String toString()

Convenience cover of toString(DoubleFormatter), uses no formatter.

Overrides:
toString in class Point

set

public Point.OnSegment set(AbstractSegment segment,
                           double where)

Set segment and where one shot.

Parameters:
segment - the segment, not null
where - the location on segment (0.0->start, 1.0->end)
Returns:
a self ref