All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class cynosurex.graphics2D.Point2D

java.lang.Object
   |
   +----cynosurex.graphics2D.Point2D

public class Point2D
extends Object
implements CommonInterface
A point represented in 2D coordination space, e.g. (x, y).


Variable Index

 o x
The x coordinate.
 o y
The y coordinate.

Constructor Index

 o Point2D()
Constructs and initializes a Point initialized with (0, 0, 0).
 o Point2D(double, double)
Constructs and initializes a Point from the specified x, y, and z coordinates.
 o Point2D(Point2D)
Constructs and initializes a Point with the same location as the specified Point2D.

Method Index

 o distance(Point2D)
Calculates the distance between this Point2D and the specified Point2D.
 o equals(Object)
Checks whether two pointers are equal.
 o getLocation()
 o hashCode()
Returns the hashcode for this Point2D.
 o move(double, double)
Changes the point to have the specified location.
 o setLocation(double, double)
Changes the point to have the specificed location.
 o setLocation(Point2D)
Changes the point to have the specificed location.
 o toString()
Returns the String representation of this Point's coordinates.
 o translate(int, int)
Translates the 2D point.

Variables

 o x
 public double x
The x coordinate.

 o y
 public double y
The y coordinate.

Constructors

 o Point2D
 public Point2D()
Constructs and initializes a Point initialized with (0, 0, 0).

 o Point2D
 public Point2D(Point2D p)
Constructs and initializes a Point with the same location as the specified Point2D.

Parameters:
p - a point in 2D space
 o Point2D
 public Point2D(double x,
                double y)
Constructs and initializes a Point from the specified x, y, and z coordinates.

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

Methods

 o distance
 public double distance(Point2D p)
Calculates the distance between this Point2D and the specified Point2D.

Parameters:
p - the specified Point2D
 o equals
 public boolean equals(Object obj)
Checks whether two pointers are equal.

Overrides:
equals in class Object
 o getLocation
 public Point2D getLocation()
 o hashCode
 public int hashCode()
Returns the hashcode for this Point2D.

Overrides:
hashCode in class Object
 o move
 public void move(double x,
                  double y)
Changes the point to have the specified location.

Parameters:
x - the x coordinate of the new location
y - the y coordinate of the new location
 o setLocation
 public void setLocation(Point2D p)
Changes the point to have the specificed location. This method is included for completeness, to parallel the setLocation method of Component.

Parameters:
p - the Point2D containing the new location
 o setLocation
 public void setLocation(double x,
                         double y)
Changes the point to have the specificed location. This method is included for completeness, to parallel the setLocation method of Component.

Parameters:
x - the x coordinate of the new location
y - the y coordinate of the new location
 o toString
 public String toString()
Returns the String representation of this Point's coordinates.

Overrides:
toString in class Object
 o translate
 public void translate(int x,
                       int y)
Translates the 2D point.


All Packages  Class Hierarchy  This Package  Previous  Next  Index