Vector2d

Represents a 2D vector with double-precision.

@author RGreenlees @author Kai Burjack @author F. Neurath

struct Vector2d {}

Constructors

this
this(double d)

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

this
this(double x, double y)

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

this
this(Vector2d v)

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

this
this(Vector2i v)

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

this
this(double[] xy)

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

Members

Functions

absolute
Vector2d absolute()

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

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

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

add
Vector2d add(double x, double y)

Add <code>(x, y)</code> to this vector.

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

Set each component of this vector to the smallest (closest to negative infinity) {@code double} value that is greater than or equal to that component and is equal to a mathematical integer.

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

Divide this Vector2d by the given scalar value.

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

Divide the components of this Vector2d by the given scalar values and store the result in <code>this</code>.

div
Vector2d div(double x, double y, Vector2d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
div
Vector2d div(Vector2d v)

Divide this Vector2d component-wise by another Vector2d.

div
Vector2d div(Vector2d v, Vector2d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
dot
double dot(Vector2d v)
Undocumented in source. Be warned that the author may not have intended to support it.
equals
bool equals(Vector2d v, double delta)
Undocumented in source. Be warned that the author may not have intended to support it.
equals
bool equals(double x, double y)
Undocumented in source. Be warned that the author may not have intended to support it.
floor
Vector2d floor()

Set each component of this vector to the largest (closest to positive infinity) {@code double} value that is less than or equal to that component and is equal to a mathematical integer.

floor
Vector2d floor(Vector2d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
fma
Vector2d fma(Vector2d a, Vector2d b)

Add the component-wise multiplication of <code>a * b</code> to this vector.

fma
Vector2d fma(double a, Vector2d b)

Add the component-wise multiplication of <code>a * b</code> to this vector.

fma
Vector2d fma(Vector2d a, Vector2d b, Vector2d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
fma
Vector2d fma(double a, Vector2d b, Vector2d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
get
double get(int component)
Undocumented in source. Be warned that the author may not have intended to support it.
get
Vector2i get(int mode, Vector2i dest)
Undocumented in source. Be warned that the author may not have intended to support it.
get
Vector2d get(Vector2d dest)
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.
isFinite
bool isFinite()
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
double lengthSquared()
Undocumented in source. Be warned that the author may not have intended to support it.
lerp
Vector2d lerp(Vector2d other, double t)

Linearly interpolate <code>this</code> and <code>other</code> using the given interpolation factor <code>t</code> and store the result in <code>this</code>. <p> If <code>t</code> is <code>0.0</code> then the result is <code>this</code>. If the interpolation factor is <code>1.0</code> then the result is <code>other</code>.

lerp
Vector2d lerp(Vector2d other, double t, Vector2d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
max
Vector2d max(Vector2d v)

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

max
Vector2d max(Vector2d v, Vector2d 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
Vector2d min(Vector2d v)

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

min
Vector2d min(Vector2d v, Vector2d 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
Vector2d mul(double scalar)

Multiply the components of this vector by the given scalar.

mul
Vector2d mul(double scalar, Vector2d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
mul
Vector2d mul(double x, double y)

Multiply the components of this Vector2d by the given scalar values and store the result in <code>this</code>.

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

Multiply this Vector2d component-wise by another Vector2d.

mul
Vector2d mul(Vector2d v, Vector2d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
mul
Vector2d mul(Matrix2d mat)

Multiply the given matrix <code>mat</code> with this Vector2d.

mul
Vector2d mul(Matrix2d mat, Vector2d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
mulDirection
Vector2d mulDirection(Matrix3x2d mat)

Multiply the given 3x2 matrix <code>mat</code> with <code>this</code>. <p> This method assumes the <code>z</code> component of <code>this</code> to be <code>0.0</code>.

mulDirection
Vector2d mulDirection(Matrix3x2d mat, Vector2d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
mulPosition
Vector2d mulPosition(Matrix3x2d mat)

Multiply the given 3x2 matrix <code>mat</code> with <code>this</code>. <p> This method assumes the <code>z</code> component of <code>this</code> to be <code>1.0</code>.

mulPosition
Vector2d mulPosition(Matrix3x2d mat, Vector2d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
mulTranspose
Vector2d mulTranspose(Matrix2d mat)

Multiply the transpose of the given matrix with this Vector2d and store the result in <code>this</code>.

mulTranspose
Vector2d mulTranspose(Matrix2d mat, Vector2d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
negate
Vector2d negate()

Negate this vector.

negate
Vector2d negate(Vector2d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
normalize
Vector2d normalize()

Normalize this vector.

normalize
Vector2d normalize(Vector2d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
normalize
Vector2d normalize(double length)

Scale this vector to have the given length.

normalize
Vector2d normalize(double length, Vector2d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
perpendicular
Vector2d perpendicular()

Set this vector to be one of its perpendicular vectors.

round
Vector2d round()

Set each component of this vector to the closest double that is equal to a mathematical integer, with ties rounding to positive infinity.

round
Vector2d round(Vector2d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
set
Vector2d set(double d)

Set the x and y components to the supplied value.

set
Vector2d set(double x, double y)

Set the x and y components to the supplied values.

set
Vector2d set(Vector2d v)

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

set
Vector2d set(Vector2i v)

Set this {@link Vector2d} to be a clone of <code>v</code>.

set
Vector2d set(double[] xy)

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

setComponent
Vector2d setComponent(int component, double value)

Set the value of the specified component of this vector.

sub
Vector2d sub(Vector2d v)

Subtract <code>v</code> from this vector.

sub
Vector2d sub(double x, double y)

Subtract <code>(x, y)</code> from this vector.

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

Set all components to zero.

Static functions

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

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

distanceSquared
double distanceSquared(double x1, double y1, double x2, double y2)

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

length
double length(double x, double y)

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

lengthSquared
double lengthSquared(double x, double y)

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

Variables

x
double x;

The x component of the vector.

y
double y;

The y component of the vector.

Meta