Package com.jogamp.nativewindow.util
Class Point
- java.lang.Object
-
- com.jogamp.nativewindow.util.Point
-
- All Implemented Interfaces:
WriteCloneable
,PointImmutable
,Cloneable
,Comparable<PointImmutable>
public class Point extends Object implements Cloneable, PointImmutable
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
clone()
Object
cloneMutable()
int
compareTo(PointImmutable d)
Compares the square of the position.boolean
equals(Object obj)
Checks whether two points objects are equal.int
getX()
int
getY()
int
hashCode()
Point
scale(float sx, float sy)
Scale this instance's x- and y-components, i.e.Point
scale(int sx, int sy)
Scale this instance's x- and y-components, i.e.Point
scaleInv(float sx, float sy)
Inverse scale this instance's x- and y-components, i.e.Point
scaleInv(int sx, int sy)
Inverse scale this instance's x- and y-components, i.e.Point
set(int x, int y)
Set this instance's x- and y-component.Point
setX(int x)
Set this instance's x--component.Point
setY(int y)
Set this instance's y-component.String
toString()
Point
translate(int dx, int dy)
Translate this instance's x- and y-components, i.e.Point
translate(Point pd)
Translate this instance's x- and y-components, i.e.Point
translate(PointImmutable pd)
Translate this instance's x- and y-components, i.e.
-
-
-
Method Detail
-
cloneMutable
public Object cloneMutable()
- Specified by:
cloneMutable
in interfaceWriteCloneable
-
clone
public Object clone()
-
compareTo
public int compareTo(PointImmutable d)
Description copied from interface:PointImmutable
Compares the square of the position.
- Specified by:
compareTo
in interfaceComparable<PointImmutable>
- Specified by:
compareTo
in interfacePointImmutable
-
equals
public boolean equals(Object obj)
Description copied from interface:PointImmutable
Checks whether two points objects are equal. Two instances ofPointReadOnly
are equal if the two componentsy
andx
are equal.- Specified by:
equals
in interfacePointImmutable
- Overrides:
equals
in classObject
- Returns:
true
if the two points are equal; otherwisefalse
.
-
getX
public final int getX()
- Specified by:
getX
in interfacePointImmutable
-
getY
public final int getY()
- Specified by:
getY
in interfacePointImmutable
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfacePointImmutable
- Overrides:
hashCode
in classObject
-
set
public final Point set(int x, int y)
Set this instance's x- and y-component.- Parameters:
x
- value for x-componenty
- value for y-component- Returns:
- this instance for scaling
-
setX
public final Point setX(int x)
Set this instance's x--component.- Parameters:
x
- value for x-component- Returns:
- this instance for scaling
-
setY
public final Point setY(int y)
Set this instance's y-component.- Parameters:
y
- value for y-component- Returns:
- this instance for scaling
-
translate
public final Point translate(Point pd)
Translate this instance's x- and y-components, i.e. add the values of the given delta point to them.- Parameters:
pd
- delta point- Returns:
- this instance for scaling
-
translate
public final Point translate(PointImmutable pd)
Translate this instance's x- and y-components, i.e. add the values of the given delta point to them.- Parameters:
pd
- delta point- Returns:
- this instance for scaling
-
translate
public final Point translate(int dx, int dy)
Translate this instance's x- and y-components, i.e. add the given deltas to them.- Parameters:
dx
- delta for xdy
- delta for y- Returns:
- this instance for scaling
-
scale
public final Point scale(int sx, int sy)
Scale this instance's x- and y-components, i.e. multiply them by the given scale factors.- Parameters:
sx
- scale factor for xsy
- scale factor for y- Returns:
- this instance for scaling
-
scale
public final Point scale(float sx, float sy)
Scale this instance's x- and y-components, i.e. multiply them by the given scale factors.The product is rounded back to integer.
- Parameters:
sx
- scale factor for xsy
- scale factor for y- Returns:
- this instance for scaling
-
scaleInv
public final Point scaleInv(int sx, int sy)
Inverse scale this instance's x- and y-components, i.e. divide them by the given scale factors.- Parameters:
sx
- inverse scale factor for xsy
- inverse scale factor for y- Returns:
- this instance for scaling
-
scaleInv
public final Point scaleInv(float sx, float sy)
Inverse scale this instance's x- and y-components, i.e. divide them by the given scale factors.The product is rounded back to integer.
- Parameters:
sx
- inverse scale factor for xsy
- inverse scale factor for y- Returns:
- this instance for scaling
-
-