Package org.lwjgl.util
Class Point
- java.lang.Object
-
- org.lwjgl.util.Point
-
- All Implemented Interfaces:
Serializable,ReadablePoint,WritablePoint
public final class Point extends Object implements ReadablePoint, WritablePoint, Serializable
A 2D integer point class, which looks remarkably like an AWT one.- Version:
- $Revision$ $Id$
- Author:
- $Author$
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Point()Constructor for Point.Point(int x, int y)Constructor for Point.Point(ReadablePoint p)Constructor for Point.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)Determines whether an instance ofPoint2Dis equal to this point.voidgetLocation(WritablePoint dest)Copy this ReadablePoint into a destination PointintgetX()intgetY()inthashCode()Returns the hash code for thisPoint.voidsetLocation(int x, int y)voidsetLocation(ReadablePoint p)voidsetX(int x)voidsetY(int y)StringtoString()Returns a string representation of this point and its location in the (x, y) coordinate space.voidtranslate(int dx, int dy)Translate a point.voidtranslate(ReadablePoint p)Translate a point.voiduntranslate(ReadablePoint p)Un-translate a point.
-
-
-
Constructor Detail
-
Point
public Point()
Constructor for Point.
-
Point
public Point(int x, int y)Constructor for Point.
-
Point
public Point(ReadablePoint p)
Constructor for Point.
-
-
Method Detail
-
setLocation
public void setLocation(int x, int y)- Specified by:
setLocationin interfaceWritablePoint
-
setLocation
public void setLocation(ReadablePoint p)
- Specified by:
setLocationin interfaceWritablePoint
-
setX
public void setX(int x)
- Specified by:
setXin interfaceWritablePoint
-
setY
public void setY(int y)
- Specified by:
setYin interfaceWritablePoint
-
translate
public void translate(int dx, int dy)Translate a point.- Parameters:
dx- The translation to applydy- The translation to apply
-
translate
public void translate(ReadablePoint p)
Translate a point.- Parameters:
p- The translation to apply
-
untranslate
public void untranslate(ReadablePoint p)
Un-translate a point.- Parameters:
p- The translation to apply
-
equals
public boolean equals(Object obj)
Determines whether an instance ofPoint2Dis equal to this point. Two instances ofPoint2Dare equal if the values of theirxandymember fields, representing their position in the coordinate space, are the same.
-
toString
public String toString()
Returns a string representation of this point and its location in the (x, y) coordinate space. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not benull.
-
hashCode
public int hashCode()
Returns the hash code for thisPoint.
-
getX
public int getX()
- Specified by:
getXin interfaceReadablePoint- Returns:
- int
-
getY
public int getY()
- Specified by:
getYin interfaceReadablePoint- Returns:
- int
-
getLocation
public void getLocation(WritablePoint dest)
Description copied from interface:ReadablePointCopy this ReadablePoint into a destination Point- Specified by:
getLocationin interfaceReadablePoint- Parameters:
dest- The destination Point, or null, to create a new Point
-
-