T - A phantom type parameter.@Immutable public final class PVectorI4L<T> extends Object implements PVectorReadable4LType<T>
A four-dimensional immutable vector type with integer elements.
Values of this type are immutable and can therefore be safely accessed from multiple threads.
| Constructor and Description |
|---|
PVectorI4L()
Default constructor, initializing the vector with values
[0, 0, 0,
1]. |
PVectorI4L(long in_x,
long in_y,
long in_z,
long in_w)
Construct a vector initialized with the given values.
|
PVectorI4L(PVectorReadable4LType<T> in_v)
Construct a vector initialized with the values given in the vector
in_v. |
| Modifier and Type | Method and Description |
|---|---|
static <T> PVectorI4L<T> |
absolute(PVectorReadable4LType<T> v)
Calculate the absolute values of the elements in vector
v. |
static <T> PVectorI4L<T> |
add(PVectorReadable4LType<T> v0,
PVectorReadable4LType<T> v1)
Calculate the element-wise sum of the vectors
v0 and v1. |
static <T> PVectorI4L<T> |
addScaled(PVectorReadable4LType<T> v0,
PVectorReadable4LType<T> v1,
double r)
Calculate the element-wise sum of the vectors
v0 and the
element-wise product of v1 and r. |
static <T> PVectorI4L<T> |
clamp(PVectorReadable4LType<T> v,
long minimum,
long maximum)
Clamp the elements of the vector
v to the range {@code [minimum .. |
static <T> PVectorI4L<T> |
clampByPVector(PVectorReadable4LType<T> v,
PVectorReadable4LType<T> minimum,
PVectorReadable4LType<T> maximum)
Clamp the elements of the vector
v to the inclusive range given by
the corresponding elements in minimum and maximum. |
static <T> PVectorI4L<T> |
clampMaximum(PVectorReadable4LType<T> v,
long maximum)
Clamp the elements of the vector
v to the range {@code [-Infinity
.. |
static <T> PVectorI4L<T> |
clampMaximumByPVector(PVectorReadable4LType<T> v,
PVectorReadable4LType<T> maximum)
Clamp the elements of the vector
v to the inclusive range given by
the corresponding elements in maximum. |
static <T> PVectorI4L<T> |
clampMinimum(PVectorReadable4LType<T> v,
long minimum)
Clamp the elements of the vector
v to the range {@code [minimum .. |
static <T> PVectorI4L<T> |
clampMinimumByPVector(PVectorReadable4LType<T> v,
PVectorReadable4LType<T> minimum)
Clamp the elements of the vector
v to the inclusive range given by
the corresponding elements in minimum. |
static <T> long |
distance(PVectorReadable4LType<T> v0,
PVectorReadable4LType<T> v1)
Calculate the distance between the two vectors
v0 and v1. |
static <T> long |
dotProduct(PVectorReadable4LType<T> v0,
PVectorReadable4LType<T> v1)
Calculate the scalar product of the vectors
v0 and v1. |
boolean |
equals(Object obj) |
long |
getWL() |
long |
getXL() |
long |
getYL() |
long |
getZL() |
int |
hashCode() |
static <T> PVectorI4L<T> |
interpolateLinear(PVectorReadable4LType<T> v0,
PVectorReadable4LType<T> v1,
double alpha)
Linearly interpolate between
v0 and v1 by the amount alpha. |
static <T> long |
magnitude(PVectorReadable4LType<T> v)
Calculate the magnitude of the vector
v. |
static <T> long |
magnitudeSquared(PVectorReadable4LType<T> v)
Calculate the squared magnitude of the vector
v. |
static <T> PVectorI4L<T> |
projection(PVectorReadable4LType<T> p,
PVectorReadable4LType<T> q)
Calculate the projection of the vector
p onto the vector q. |
static <T> PVectorI4L<T> |
scale(PVectorReadable4LType<T> v,
double r)
Scale the vector
v by the scalar r. |
static <T> PVectorI4L<T> |
subtract(PVectorReadable4LType<T> v0,
PVectorReadable4LType<T> v1)
Subtract the vector
v1 from the vector v0. |
String |
toString() |
static <T> PVectorI4L<T> |
zero() |
public PVectorI4L()
[0, 0, 0,
1].public PVectorI4L(long in_x,
long in_y,
long in_z,
long in_w)
in_x - The x valuein_y - The y valuein_z - The z valuein_w - The w valuepublic PVectorI4L(PVectorReadable4LType<T> in_v)
in_v.in_v - The source vectorpublic static <T> PVectorI4L<T> absolute(PVectorReadable4LType<T> v) throws ArithmeticException
v.T - A phantom type parameter.v - The input vector(abs v.x, abs v.y, abs v.z, abs.w)ArithmeticException - Iff an internal arithmetic operation causes an
integer overflowpublic static <T> PVectorI4L<T> add(PVectorReadable4LType<T> v0, PVectorReadable4LType<T> v1) throws ArithmeticException
v0 and v1.T - A phantom type parameter.v0 - The left input vectorv1 - The right input vector(v0.x + v1.x, v0.y + v1.y, v0.z + v1.z, v0.w + v1.w)ArithmeticException - Iff an internal arithmetic operation causes an
integer overflowpublic static <T> PVectorI4L<T> addScaled(PVectorReadable4LType<T> v0, PVectorReadable4LType<T> v1, double r) throws ArithmeticException
v0 and the
element-wise product of v1 and r.T - A phantom type parameter.v0 - The left input vectorv1 - The right input vectorr - The scaling value(v0.x + (v1.x * r), v0.y + (v1.y * r), v0.z + (v1.z * r),
v0.w + (v1.w * r))ArithmeticException - Iff an internal arithmetic operation causes an
integer overflowpublic static <T> PVectorI4L<T> clamp(PVectorReadable4LType<T> v, long minimum, long maximum)
v to the range [minimum ..
maximum] inclusive.T - A phantom type parameter.v - The input vectorminimum - The minimum allowed valuemaximum - The maximum allowed valuemaximum and at
least minimumpublic static <T> PVectorI4L<T> clampByPVector(PVectorReadable4LType<T> v, PVectorReadable4LType<T> minimum, PVectorReadable4LType<T> maximum)
v to the inclusive range given by
the corresponding elements in minimum and maximum.T - A phantom type parameter.v - The input vectorminimum - The vector containing the minimum acceptable valuesmaximum - The vector containing the maximum acceptable values(min(max(v.x, minimum.x), maximum.x), min(max(v.y,
minimum.y), maximum.y), min(max(v.z, minimum.z), maximum.z), min(max(v.w,
minimum.w), maximum.w))public static <T> PVectorI4L<T> clampMaximum(PVectorReadable4LType<T> v, long maximum)
v to the range [-Infinity
.. maximum] inclusive.T - A phantom type parameter.v - The input vectormaximum - The maximum allowed valuemaximumpublic static <T> PVectorI4L<T> clampMaximumByPVector(PVectorReadable4LType<T> v, PVectorReadable4LType<T> maximum)
v to the inclusive range given by
the corresponding elements in maximum.T - A phantom type parameter.v - The input vectormaximum - The vector containing the maximum acceptable values(min(v.x, maximum.x), min(v.y, maximum.y), min(v.z,
maximum.z), min(v.w, maximum.w))public static <T> PVectorI4L<T> clampMinimum(PVectorReadable4LType<T> v, long minimum)
v to the range [minimum ..
Infinity] inclusive.T - A phantom type parameter.v - The input vectorminimum - The minimum allowed valueminimumpublic static <T> PVectorI4L<T> clampMinimumByPVector(PVectorReadable4LType<T> v, PVectorReadable4LType<T> minimum)
v to the inclusive range given by
the corresponding elements in minimum.T - A phantom type parameter.v - The input vectorminimum - The vector containing the minimum acceptable values(max(v.x, minimum.x), max(v.y, minimum.y), max(v.z,
minimum.z), max(v.w, minimum.w))public static <T> long distance(PVectorReadable4LType<T> v0, PVectorReadable4LType<T> v1) throws ArithmeticException
v0 and v1.T - A phantom type parameter.v0 - The left input vectorv1 - The right input vectorArithmeticException - Iff an internal arithmetic operation causes an
integer overflowpublic static <T> long dotProduct(PVectorReadable4LType<T> v0, PVectorReadable4LType<T> v1) throws ArithmeticException
v0 and v1.T - A phantom type parameter.v0 - The left input vectorv1 - The right input vectorArithmeticException - Iff an internal arithmetic operation causes an
integer overflowpublic static <T> PVectorI4L<T> interpolateLinear(PVectorReadable4LType<T> v0, PVectorReadable4LType<T> v1, double alpha) throws ArithmeticException
v0 and v1 by the amount alpha.
The alpha parameter controls the degree of interpolation, such
that:
interpolateLinear(v0, v1, 0.0, r) → r = v0interpolateLinear(v0, v1, 1.0, r) → r = v1T - A phantom type parameter.v0 - The left input vector.v1 - The right input vector.alpha - The interpolation value, between 0.0 and 1.0.(1 - alpha) * v0 + alpha * v1ArithmeticException - Iff an internal arithmetic operation causes an
integer overflow.public static <T> long magnitude(PVectorReadable4LType<T> v) throws ArithmeticException
v.
Correspondingly, magnitude(normalize(v)) == 1.0.T - A phantom type parameter.v - The input vectorArithmeticException - Iff an internal arithmetic operation causes an
integer overflowpublic static <T> long magnitudeSquared(PVectorReadable4LType<T> v) throws ArithmeticException
v.T - A phantom type parameter.v - The input vectorArithmeticException - Iff an internal arithmetic operation causes an
integer overflowpublic static <T> PVectorI4L<T> projection(PVectorReadable4LType<T> p, PVectorReadable4LType<T> q) throws ArithmeticException
p onto the vector q.T - A phantom type parameter.p - The left vectorq - The right vector((dotProduct p q) / magnitudeSquared q) * qArithmeticException - Iff an internal arithmetic operation causes an
integer overflowpublic static <T> PVectorI4L<T> scale(PVectorReadable4LType<T> v, double r) throws ArithmeticException
v by the scalar r.T - A phantom type parameter.v - The input vectorr - The scaling value(v.x * r, v.y * r, v.z * r, vw * r)ArithmeticException - Iff an internal arithmetic operation causes an
integer overflowpublic static <T> PVectorI4L<T> subtract(PVectorReadable4LType<T> v0, PVectorReadable4LType<T> v1) throws ArithmeticException
v1 from the vector v0.T - A phantom type parameter.v0 - The left input vectorv1 - The right input vector(v0.x - v1.x, v0.y - v1.y, v0.z - v1.z, v0.w - v1.w)ArithmeticException - Iff an internal arithmetic operation causes an
integer overflowpublic static <T> PVectorI4L<T> zero()
T - A phantom type parameter.public long getWL()
getWL in interface VectorReadable4LTypepublic long getXL()
getXL in interface VectorReadable2LTypepublic long getYL()
getYL in interface VectorReadable2LTypepublic long getZL()
getZL in interface VectorReadable3LTypeCopyright © 2016 <code@io7m.com> http://io7m.com