yu.ac.bg.etf.javaqx.qswing.graphics
Class Point

java.lang.Object
  extended byyu.ac.bg.etf.javaqx.qswing.graphics.Point

public class Point
extends java.lang.Object

Point Class.

NOTE: This class is immutable.

Version:
0.2.0
Author:
Slobodan Vrkacevic (slobodan.vrkacevic@gmail.com)

Field Summary
static Point ZERO_POINT
          Point(0, 0) object.
 
Constructor Summary
Point()
          Constructs new Point object.
Point(int x, int y)
          Constructs new Point object.
 
Method Summary
 double distance(int px, int py)
          Returns the distance from this point to a specified point.
 double distance(Point p)
          Returns the distance from this point to a specified point.
 double distanceSq(int px, int py)
          Returns the square distance from this point to a specified point.
 double distanceSq(Point p)
          Returns the square distance from this point to a specified point.
 boolean equals(java.lang.Object obj)
          
 int getX()
          Returns the x coordinate of the point.
 int getY()
          Returns y-coordinate of the point.
 int hashCode()
          
 java.lang.String toString()
          
 Point translate(int dx, int dy)
          Returns translated point at location (x + dx, y + dy).
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ZERO_POINT

public static final Point ZERO_POINT
Point(0, 0) object.

Constructor Detail

Point

public Point()
Constructs new Point object.


Point

public Point(int x,
             int y)
Constructs new Point object.

Parameters:
x - the x coordinate of the point
y - the y coordinate of the point
Method Detail

getX

public int getX()
Returns the x coordinate of the point.

Returns:
the x coordinate of the point

getY

public int getY()
Returns y-coordinate of the point.

Returns:
y-coordinate of the point

distance

public double distance(int px,
                       int py)
Returns the distance from this point to a specified point.

Parameters:
px - the x coordinate of the specified point
py - the y coordinate of the specified point
Returns:
the distance from this point to a specified point

distance

public double distance(Point p)
Returns the distance from this point to a specified point.

Parameters:
p - the specified point
Returns:
the distance from this point to a specified point

distanceSq

public double distanceSq(int px,
                         int py)
Returns the square distance from this point to a specified point.

Parameters:
px - the x coordinate of the specified point
py - the y coordinate of the specified point
Returns:
the square distance from this point to a specified point

distanceSq

public double distanceSq(Point p)
Returns the square distance from this point to a specified point.

Parameters:
p - the specified point
Returns:
the square distance from this point to a specified point

translate

public Point translate(int dx,
                       int dy)
Returns translated point at location (x + dx, y + dy).

Parameters:
dx - the distance to move the point along the x axis
dy - the distance to move the point along the y axis
Returns:
translated point

equals

public boolean equals(java.lang.Object obj)


hashCode

public int hashCode()


toString

public java.lang.String toString()



Copyright © 2007 ETF and contributors. All Rights Reserved.