Package com.jogamp.opengl.math
Class Vec2i
- java.lang.Object
-
- com.jogamp.opengl.math.Vec2i
-
public final class Vec2i extends Object
2D Vector based upon two integer components.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Vec2i
copy()
int
dist(Vec2i o)
Return the distance between this vector and the given one.int
distSq(Vec2i o)
Return the squared distance between this vector and the given one.boolean
equals(Object o)
int[]
get(int[] xy)
xy = this, returns xy.boolean
isEqual(Vec2i o)
Equals check.boolean
isZero()
Return true if all components are zero.int
length()
Return the length of this vector, a.k.a the norm or magnitudeint
lengthSq()
Return the squared length of this vector, a.k.a the squared norm or squared magnitudeVec2i
set(int[] xy)
this = xy, returns this.void
set(int x, int y)
this = { x, y }, returns this.void
set(Vec2i o)
this = o, returns this.void
setX(int x)
void
setY(int y)
String
toString()
int
x()
int
y()
-
-
-
Constructor Detail
-
Vec2i
public Vec2i()
-
Vec2i
public Vec2i(Vec2i o)
-
Vec2i
public Vec2i(int[] xy)
-
Vec2i
public Vec2i(int x, int y)
-
-
Method Detail
-
copy
public Vec2i copy()
-
set
public void set(Vec2i o)
this = o, returns this.
-
set
public void set(int x, int y)
this = { x, y }, returns this.
-
set
public Vec2i set(int[] xy)
this = xy, returns this.
-
get
public int[] get(int[] xy)
xy = this, returns xy.
-
x
public int x()
-
y
public int y()
-
setX
public void setX(int x)
-
setY
public void setY(int y)
-
isZero
public boolean isZero()
Return true if all components are zero.
-
length
public int length()
Return the length of this vector, a.k.a the norm or magnitude
-
lengthSq
public int lengthSq()
Return the squared length of this vector, a.k.a the squared norm or squared magnitude
-
distSq
public int distSq(Vec2i o)
Return the squared distance between this vector and the given one.When comparing the relative distance between two points it is usually sufficient to compare the squared distances, thus avoiding an expensive square root operation.
-
dist
public int dist(Vec2i o)
Return the distance between this vector and the given one.
-
isEqual
public boolean isEqual(Vec2i o)
Equals check.- Parameters:
o
- comparison value- Returns:
- true if all components are equal
-
-