edu.uci.ics.jung.visualization
Class Coordinates

java.lang.Object
  extended by java.awt.geom.Point2D
      extended by java.awt.geom.Point2D.Float
          extended by edu.uci.ics.jung.visualization.Coordinates
All Implemented Interfaces:
Cloneable

public class Coordinates
extends Point2D.Float

Stores coordinates (X,Y) for vertices being visualized.

Author:
Scott White

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.geom.Point2D
Point2D.Double, Point2D.Float
 
Field Summary
 
Fields inherited from class java.awt.geom.Point2D.Float
x, y
 
Constructor Summary
Coordinates()
           
Coordinates(Coordinates coordinates)
          Initializes this coordinate to the value of the passed-in coordinate.
Coordinates(double x, double y)
           
 
Method Summary
 void add(double x, double y)
          Increases the x and y values of this scalar by (x, y).
 void addX(double d)
          Increases the x value by d.
 void addY(double d)
          Increases the y value by d.
 double distance(Coordinates o)
          Computes the euclidean distance between two coordinates
 Coordinates midpoint(Coordinates o)
          Computes the midpoint between the two coordinates
 void mult(double x, double y)
          Multiplies a coordinate by scalar x and y values.
 void multX(double d)
          Multiplies the X coordinate by a scalar value.
 void multY(double d)
          Multiplies the Y coordinate by a scalar value.
 void setX(double d)
          Sets the x value to be d;
 void setY(double d)
          Sets the y value to be d;
 
Methods inherited from class java.awt.geom.Point2D.Float
getX, getY, setLocation, setLocation, toString
 
Methods inherited from class java.awt.geom.Point2D
clone, distance, distance, distance, distanceSq, distanceSq, distanceSq, equals, hashCode, setLocation
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Coordinates

public Coordinates()

Coordinates

public Coordinates(double x,
                   double y)

Coordinates

public Coordinates(Coordinates coordinates)
Initializes this coordinate to the value of the passed-in coordinate.

Parameters:
coordinates -
Method Detail

setX

public void setX(double d)
Sets the x value to be d;

Parameters:
d -

setY

public void setY(double d)
Sets the y value to be d;

Parameters:
d -

add

public void add(double x,
                double y)
Increases the x and y values of this scalar by (x, y).

Parameters:
x -
y -

addX

public void addX(double d)
Increases the x value by d.

Parameters:
d -

addY

public void addY(double d)
Increases the y value by d.

Parameters:
d -

mult

public void mult(double x,
                 double y)
Multiplies a coordinate by scalar x and y values.

Parameters:
x - A scalar to multiple x by
y - A scalar to multiply y by

multX

public void multX(double d)
Multiplies the X coordinate by a scalar value.

For example, (3, 10) x-scaled by 2 returns (6, 10).

Parameters:
d - the scalar value by which x will be multiplied

multY

public void multY(double d)
Multiplies the Y coordinate by a scalar value.

For example, (3, 10) y-scaled by 2 returns (3, 20).

Parameters:
d - the scalar value by which y will be multiplied

distance

public double distance(Coordinates o)
Computes the euclidean distance between two coordinates

Parameters:
o - another coordinates
Returns:
the euclidean distance

midpoint

public Coordinates midpoint(Coordinates o)
Computes the midpoint between the two coordinates

Parameters:
o - another coordinates
Returns:
the midpoint