Vector2i

Represents a 2D vector with integer-precision.

@author RGreenlees @author Kai Burjack @author Hans Uhlig

struct Vector2i {}

Constructors

this
this(int s)

Create a new {@link Vector2i} and initialize both of its components with the given value.

this
this(int x, int y)

Create a new {@link Vector2i} and initialize its components to the given values.

this
this(double x, double y, int mode)

Create a new {@link Vector2i} and initialize its component values and round using the given {@link RoundingMode}. @param x the x component @param y the y component @param mode the {@link RoundingMode} to use

this
this(Vector2i v)

Create a new {@link Vector2i} and initialize its components to the one of the given vector.

this
this(Vector2d v, int mode)

Create a new {@link Vector2i} and initialize its components to the rounded value of the given vector.

this
this(int[] xy)

Create a new {@link Vector2i} and initialize its two components from the first two elements of the given array.

Members

Functions

absolute
Vector2i absolute()

Set <code>this</code> vector's components to their respective absolute values.

absolute
Vector2i absolute(Vector2i dest)
Undocumented in source. Be warned that the author may not have intended to support it.
add
Vector2i add(Vector2i v)

Add <code>v</code> to this vector.

add
Vector2i add(Vector2i v, Vector2i dest)
Undocumented in source. Be warned that the author may not have intended to support it.
add
Vector2i add(int x, int y)

Increment the components of this vector by the given values.

add
Vector2i add(int x, int y, Vector2i dest)
Undocumented in source. Be warned that the author may not have intended to support it.
distance
double distance(Vector2i v)
Undocumented in source. Be warned that the author may not have intended to support it.
distance
double distance(int x, int y)
Undocumented in source. Be warned that the author may not have intended to support it.
distanceSquared
long distanceSquared(Vector2i v)
Undocumented in source. Be warned that the author may not have intended to support it.
distanceSquared
long distanceSquared(int x, int y)
Undocumented in source. Be warned that the author may not have intended to support it.
div
Vector2i div(double scalar)

Divide all components of this {@link Vector2i} by the given scalar value.

div
Vector2i div(double scalar, Vector2i dest)
Undocumented in source. Be warned that the author may not have intended to support it.
div
Vector2i div(int scalar)

Divide all components of this {@link Vector2i} by the given scalar value.

div
Vector2i div(int scalar, Vector2i dest)
Undocumented in source. Be warned that the author may not have intended to support it.
equals
bool equals(int x, int y)
Undocumented in source. Be warned that the author may not have intended to support it.
equals
bool equals(Vector2i other)
Undocumented in source. Be warned that the author may not have intended to support it.
get
int get(int component)
Undocumented in source. Be warned that the author may not have intended to support it.
gridDistance
long gridDistance(Vector2i v)
Undocumented in source. Be warned that the author may not have intended to support it.
gridDistance
long gridDistance(int x, int y)
Undocumented in source. Be warned that the author may not have intended to support it.
hashCode
int hashCode()
Undocumented in source. Be warned that the author may not have intended to support it.
length
double length()
Undocumented in source. Be warned that the author may not have intended to support it.
lengthSquared
long lengthSquared()
Undocumented in source. Be warned that the author may not have intended to support it.
max
Vector2i max(Vector2i v)

Set the components of this vector to be the component-wise maximum of this and the other vector.

max
Vector2i max(Vector2i v, Vector2i dest)
Undocumented in source. Be warned that the author may not have intended to support it.
maxComponent
int maxComponent()
Undocumented in source. Be warned that the author may not have intended to support it.
min
Vector2i min(Vector2i v)

Set the components of this vector to be the component-wise minimum of this and the other vector.

min
Vector2i min(Vector2i v, Vector2i dest)
Undocumented in source. Be warned that the author may not have intended to support it.
minComponent
int minComponent()
Undocumented in source. Be warned that the author may not have intended to support it.
mul
Vector2i mul(int scalar)

Multiply all components of this {@link Vector2i} by the given scalar value.

mul
Vector2i mul(int scalar, Vector2i dest)
Undocumented in source. Be warned that the author may not have intended to support it.
mul
Vector2i mul(Vector2i v)

Add the supplied vector by this one.

mul
Vector2i mul(Vector2i v, Vector2i dest)
Undocumented in source. Be warned that the author may not have intended to support it.
mul
Vector2i mul(int x, int y)

Multiply the components of this vector by the given values.

mul
Vector2i mul(int x, int y, Vector2i dest)
Undocumented in source. Be warned that the author may not have intended to support it.
negate
Vector2i negate()

Negate this vector.

negate
Vector2i negate(Vector2i dest)
Undocumented in source. Be warned that the author may not have intended to support it.
set
Vector2i set(int s)

Set the x and y components to the supplied value.

set
Vector2i set(int x, int y)

Set the x and y components to the supplied values.

set
Vector2i set(Vector2i v)

Set this {@link Vector2i} to the values of v.

set
Vector2i set(Vector2d v)

Set this {@link Vector2i} to the values of v using {@link RoundingMode#TRUNCATE} rounding. <p> Note that due to the given vector <code>v</code> storing the components in double-precision, there is the possibility to lose precision.

set
Vector2i set(Vector2d v, int mode)

Set this {@link Vector2i} to the values of v using the given {@link RoundingMode}. <p> Note that due to the given vector <code>v</code> storing the components in double-precision, there is the possibility to lose precision.

set
Vector2i set(int[] xy)

Set the two components of this vector to the first two elements of the given array.

setComponent
Vector2i setComponent(int component, int value)

Set the value of the specified component of this vector.

sub
Vector2i sub(Vector2i v)

Subtract the supplied vector from this one and store the result in <code>this</code>.

sub
Vector2i sub(Vector2i v, Vector2i dest)
Undocumented in source. Be warned that the author may not have intended to support it.
sub
Vector2i sub(int x, int y)

Decrement the components of this vector by the given values.

sub
Vector2i sub(int x, int y, Vector2i dest)
Undocumented in source. Be warned that the author may not have intended to support it.
zero
Vector2i zero()

Set all components to zero.

Static functions

distance
double distance(int x1, int y1, int x2, int y2)

Return the distance between <code>(x1, y1)</code> and <code>(x2, y2)</code>.

distanceSquared
long distanceSquared(int x1, int y1, int x2, int y2)

Return the squared distance between <code>(x1, y1)</code> and <code>(x2, y2)</code>.

length
double length(int x, int y)

Get the length of a 2-dimensional single-precision vector.

lengthSquared
long lengthSquared(int x, int y)

Get the length squared of a 2-dimensional single-precision vector.

Variables

x
int x;

The x component of the vector.

y
int y;

The y component of the vector.

Meta