29package com.jogamp.math;
45 return new Vec2i(
this);
52 public Vec2i(
final int x,
final int y) {
57 public void set(
final Vec2i o) {
63 public void set(
final int x,
final int y) {
69 public Vec2i set(
final int[] xy) {
83 public int[]
get(
final int[] xy) {
89 public int x() {
return x; }
90 public int y() {
return y; }
92 public void setX(
final int x) { this.x = x; }
93 public void setY(
final int y) { this.y = y; }
97 return 0 == x && 0 == y;
122 final int dx = x - o.x;
123 final int dy = y - o.y;
124 return dx*dx + dy*dy;
131 return (
int)Math.sqrt(
distSq(o));
143 return x == o.x && y == o.y;
149 if( o instanceof
Vec2i ) {
158 return x +
" / " + y;
2D Vector based upon two integer components.
boolean equals(final Object o)
boolean isEqual(final Vec2i o)
Equals check.
boolean isZero()
Return true if all components are zero.
Vec2i(final int x, final int y)
int length()
Return the length of this vector, a.k.a the norm or magnitude
int dist(final Vec2i o)
Return the distance between this vector and the given one.
Vec2i toArray(final int[] xy)
xy[0..1] = this.
int distSq(final Vec2i o)
Return the squared distance between this vector and the given one.
int lengthSq()
Return the squared length of this vector, a.k.a the squared norm or squared magnitude