edu.uci.ics.jung.visualization
Class Coordinates

java.lang.Object
  extended byedu.uci.ics.jung.visualization.Coordinates

public class Coordinates
extends java.lang.Object

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

Author:
Scott White

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
 double getX()
           
 double getY()
           
 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.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, 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

getX

public double getX()

getY

public double getY()

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