Vector3d

Contains the definition of a Vector comprising 3 doubles and associated transformations.

@author Richard Greenlees @author Kai Burjack @author F. Neurath

struct Vector3d {}

Constructors

this
this(double d)

Create a new {@link Vector3d} and initialize all three components with the given value.

this
this(double x, double y, double z)

Create a new {@link Vector3d} with the given component values.

this
this(Vector3i v)

Create a new {@link Vector3d} whose values will be copied from the given vector.

this
this(Vector2i v, double z)

Create a new {@link Vector3d} with the first two components from the given <code>v</code> and the given <code>z</code>

this
this(Vector3d v)

Create a new {@link Vector3d} whose values will be copied from the given vector.

this
this(Vector2d v, double z)

Create a new {@link Vector3d} with the first two components from the given <code>v</code> and the given <code>z</code>

this
this(double[] xyz)

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

this
this(float[] xyz)

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

Members

Functions

absolute
Vector3d absolute()

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

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

Add the supplied vector to this one.

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

Increment the components of this vector by the given values.

add
Vector3d add(double x, double y, double z, Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
angle
double angle(Vector3d v)
Undocumented in source. Be warned that the author may not have intended to support it.
angleCos
double angleCos(Vector3d v)
Undocumented in source. Be warned that the author may not have intended to support it.
angleSigned
double angleSigned(Vector3d v, Vector3d n)
Undocumented in source. Be warned that the author may not have intended to support it.
angleSigned
double angleSigned(double x, double y, double z, double nx, double ny, double nz)
Undocumented in source. Be warned that the author may not have intended to support it.
ceil
Vector3d ceil(Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
ceil
Vector3d 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.

cross
Vector3d cross(Vector3d v)

Set this vector to be the cross product of this and v2.

cross
Vector3d cross(double x, double y, double z)

Set this vector to be the cross product of itself and <code>(x, y, z)</code>.

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

Divide this Vector3d component-wise by another Vector3d.

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

Divide this Vector3d by the given scalar value.

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

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

div
Vector3d div(double x, double y, double z, Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
dot
double dot(Vector3d v)
Undocumented in source. Be warned that the author may not have intended to support it.
dot
double dot(double x, double y, double z)
Undocumented in source. Be warned that the author may not have intended to support it.
equals
bool equals(Vector3d 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, double z)
Undocumented in source. Be warned that the author may not have intended to support it.
equals
bool equals(Vector3d other)
Undocumented in source. Be warned that the author may not have intended to support it.
floor
Vector3d floor(Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
floor
Vector3d 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.

fma
Vector3d fma(Vector3d a, Vector3d b)

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

fma
Vector3d fma(double a, Vector3d b)

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

fma
Vector3d fma(Vector3d a, Vector3d b, Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
fma
Vector3d fma(double a, Vector3d b, Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
get
Vector3d get(Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
get
Vector3i get(int mode, Vector3i 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.
half
Vector3d half(double x, double y, double z, Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
half
Vector3d half(Vector3d other, Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
half
Vector3d half(double x, double y, double z)

Compute the half vector between this and the vector <code>(x, y, z)</code>.

half
Vector3d half(Vector3d other)

Compute the half vector between this and the other vector.

hashCode
int hashCode()
Undocumented in source. Be warned that the author may not have intended to support it.
hermite
Vector3d hermite(Vector3d t0, Vector3d v1, Vector3d t1, double t, Vector3d dest)
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
Vector3d lerp(Vector3d other, double t, Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
lerp
Vector3d lerp(Vector3d 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>.

max
Vector3d max(Vector3d v)

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

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

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

min
Vector3d min(Vector3d v, Vector3d 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
Vector3d mul(Vector3d v)

Multiply this Vector3d component-wise by another Vector3d.

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

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

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

Multiply the given matrix with this Vector3d by assuming a third row in the matrix of <code>(0, 0, 1)</code> and store the result in <code>this</code>.

mul
Vector3d mul(Matrix3x2d mat, Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
mul
Vector3d mul(double scalar)

Multiply this Vector3d by the given scalar value.

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

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

mul
Vector3d mul(double x, double y, double z, Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
mulAdd
Vector3d mulAdd(Vector3d a, Vector3d b)

Add the component-wise multiplication of <code>this * a</code> to <code>b</code> and store the result in <code>this</code>.

mulAdd
Vector3d mulAdd(double a, Vector3d b)

Add the component-wise multiplication of <code>this * a</code> to <code>b</code> and store the result in <code>this</code>.

mulAdd
Vector3d mulAdd(Vector3d a, Vector3d b, Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
mulAdd
Vector3d mulAdd(double a, Vector3d b, Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
mulDirection
Vector3d mulDirection(Matrix4d mat)

Multiply the given 4x4 matrix <code>mat</code> with <code>this</code>. <p> This method assumes the <code>w</code> component of <code>this</code> to be <code>0.0</code>.

mulDirection
Vector3d mulDirection(Matrix4x3d mat)

Multiply the given 4x3 matrix <code>mat</code> with <code>this</code>. <p> This method assumes the <code>w</code> component of <code>this</code> to be <code>0.0</code>.

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

Multiply the given 4x4 matrix <code>mat</code> with <code>this</code>. <p> This method assumes the <code>w</code> component of <code>this</code> to be <code>1.0</code>.

mulPosition
Vector3d mulPosition(Matrix4x3d mat)

Multiply the given 4x3 matrix <code>mat</code> with <code>this</code>. <p> This method assumes the <code>w</code> component of <code>this</code> to be <code>1.0</code>.

mulPosition
Vector3d mulPosition(Matrix4d mat, Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
mulPosition
Vector3d mulPosition(Matrix4x3d mat, Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
mulPositionW
double mulPositionW(Matrix4d mat)

Multiply the given 4x4 matrix <code>mat</code> with <code>this</code> and return the <i>w</i> component of the resulting 4D vector. <p> This method assumes the <code>w</code> component of <code>this</code> to be <code>1.0</code>.

mulPositionW
double mulPositionW(Matrix4d mat, Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
mulProject
Vector3d mulProject(Matrix4d mat, double w, Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
mulProject
Vector3d mulProject(Matrix4d mat, Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
mulProject
Vector3d mulProject(Matrix4d mat)

Multiply the given matrix <code>mat</code> this Vector3d, perform perspective division. <p> This method uses <code>w=1.0</code> as the fourth vector component.

mulTranspose
Vector3d mulTranspose(Matrix3d mat)

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

mulTranspose
Vector3d mulTranspose(Matrix3d mat, Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
mulTransposeDirection
Vector3d mulTransposeDirection(Matrix4d mat)

Multiply the transpose of the given 4x4 matrix <code>mat</code> with <code>this</code>. <p> This method assumes the <code>w</code> component of <code>this</code> to be <code>0.0</code>.

mulTransposeDirection
Vector3d mulTransposeDirection(Matrix4d mat, Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
mulTransposePosition
Vector3d mulTransposePosition(Matrix4d mat)

Multiply the transpose of the given 4x4 matrix <code>mat</code> with <code>this</code>. <p> This method assumes the <code>w</code> component of <code>this</code> to be <code>1.0</code>.

mulTransposePosition
Vector3d mulTransposePosition(Matrix4d mat, Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
negate
Vector3d negate()

Negate this vector.

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

Normalize this vector.

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

Scale this vector to have the given length.

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

Transform <code>this</code> vector so that it is orthogonal to the given vector <code>v</code> and normalize the result. <p> Reference: <a href="https://en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process">Gram–Schmidt process</a>

orthogonalize
Vector3d orthogonalize(Vector3d v, Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
orthogonalizeUnit
Vector3d orthogonalizeUnit(Vector3d v)

Transform <code>this</code> vector so that it is orthogonal to the given unit vector <code>v</code> and normalize the result. <p> The vector <code>v</code> is assumed to be a {@link #normalize() unit} vector. <p> Reference: <a href="https://en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process">Gram–Schmidt process</a>

orthogonalizeUnit
Vector3d orthogonalizeUnit(Vector3d v, Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
reflect
Vector3d reflect(double x, double y, double z, Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
reflect
Vector3d reflect(Vector3d normal, Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
reflect
Vector3d reflect(double x, double y, double z)

Reflect this vector about the given normal vector.

reflect
Vector3d reflect(Vector3d normal)

Reflect this vector about the given normal vector.

rotate
Vector3d rotate(Quaterniond quat)

Rotate this vector by the given quaternion <code>quat</code> and store the result in <code>this</code>.

rotate
Vector3d rotate(Quaterniond quat, Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
rotateAxis
Vector3d rotateAxis(double angle, double x, double y, double z)

Rotate this vector the specified radians around the given rotation axis.

rotateAxis
Vector3d rotateAxis(double angle, double aX, double aY, double aZ, Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
rotateX
Vector3d rotateX(double angle)

Rotate this vector the specified radians around the X axis.

rotateX
Vector3d rotateX(double angle, Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
rotateY
Vector3d rotateY(double angle)

Rotate this vector the specified radians around the Y axis.

rotateY
Vector3d rotateY(double angle, Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
rotateZ
Vector3d rotateZ(double angle, Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
rotateZ
Vector3d rotateZ(double angle)

Rotate this vector the specified radians around the Z axis.

rotationTo
Quaterniond rotationTo(double toDirX, double toDirY, double toDirZ, Quaterniond dest)
Undocumented in source. Be warned that the author may not have intended to support it.
rotationTo
Quaterniond rotationTo(Vector3d toDir, Quaterniond dest)
Undocumented in source. Be warned that the author may not have intended to support it.
round
Vector3d 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
Vector3d round(Vector3d dest)
Undocumented in source. Be warned that the author may not have intended to support it.
set
Vector3d set(float[] xyz)

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

set
Vector3d set(double[] xyz)

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

set
Vector3d set(double x, double y, double z)

Set the x, y and z components to the supplied values.

set
Vector3d set(double d)

Set the x, y, and z components to the supplied value.

set
Vector3d set(Vector2i v, double z)

Set the first two components from the given <code>v</code> and the z component from the given <code>z</code>

set
Vector3d set(Vector2d v, double z)

Set the first two components from the given <code>v</code> and the z component from the given <code>z</code>

set
Vector3d set(Vector3i v)

Set the x, y and z components to match the supplied vector.

set
Vector3d set(Vector3d v)

Set the x, y and z components to match the supplied vector.

setComponent
Vector3d setComponent(int component, double value)

Set the value of the specified component of this vector.

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

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

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

Subtract the supplied vector from this one.

zero
Vector3d zero()

Set all components to zero.

Static functions

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

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

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

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

length
double length(double x, double y, double z)

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

lengthSquared
double lengthSquared(double x, double y, double z)

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

Variables

x
double x;

The x component of the vector.

y
double y;

The y component of the vector.

z
double z;

The z component of the vector.

Meta