public final class Vector3 extends APrimitiveVector
| Constructor and Description |
|---|
Vector3() |
Vector3(AVector v) |
Vector3(double... values) |
Vector3(double x,
double y,
double z) |
Vector3(Vector3 source) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(AVector v)
Adds another vector to this one
|
void |
add(double constant)
Adds a double value to all elements in this array.
|
void |
add(double dx,
double dy,
double dz) |
void |
add(Vector3 v) |
void |
addAt(int i,
double value)
Adds a value to a specific element of the vector
This function does not perform bounds checking, i.e.
|
Vector3 |
addCopy(AVector v)
Adds a vector element-wise to this vector, returning a new vector.
|
Vector3 |
addCopy(Vector3 v) |
void |
addMultiple(AVector v,
double factor)
Adds a scaled multiple of another vector to this vector
|
void |
addMultiple(double dx,
double dy,
double dz,
double factor) |
void |
addMultiple(Vector3 v,
double factor) |
void |
addProduct(Vector3 a,
Vector3 b) |
void |
addProduct(Vector3 a,
Vector3 b,
double factor) |
double |
angle(AVector v)
Returns the Euclidean angle between this vector and another vector
|
double |
angle(Vector3 v) |
void |
applyOp(Op op)
Applies a unary operator to all elements of the array (in-place)
|
Vector3 |
clone()
Clones the vector, creating a new mutable copy of all data.
|
Vector3 |
copy()
Returns a defensive copy of the array data.
|
static Vector3 |
create(AVector v) |
static Vector3 |
create(Object o) |
void |
crossProduct(AVector a)
Computes the crossProduct of this vector with another vector, and stores the result in this vector.
|
void |
crossProduct(Vector3 a)
Computes the crossProduct of this vector with another vector, and stores the result in this vector.
|
double |
distance(AVector v)
Returns the Euclidean distance to another vector.
|
double |
distance(Vector3 v) |
double |
distanceSquared(Vector3 v) |
double |
dotProduct(AVector v)
Returns the dot product of this vector with another vector
The vectors must have the same length: if not the result is undefined
|
double |
dotProduct(double[] data,
int offset)
Fast dot product with a double[] array.
|
double |
dotProduct(Vector3 a) |
double |
elementProduct()
Returns the product of all elements in the array.
|
double |
elementSquaredSum()
Returns the sum of squared elements in this array.
|
double |
elementSum()
Returns the sum of all elements in a vector
|
boolean |
equals(AVector v) |
boolean |
equals(Vector3 v) |
boolean |
equalsArray(double[] data,
int offset)
Returns true if this vector exactly matches the elements in double[] array, starting
from the specified offset
|
Vector3 |
exactClone()
Returns an exact clone of this vector, i.e.
|
void |
fill(double v)
Fills the entire vector with a given value
|
double |
get(int i)
Returns the double value at the specified position in a 1D vector
|
void |
getElements(double[] data,
int offset)
Gets all elements of the array, copying them into a double array at the specified offset
|
double |
getX() |
double |
getY() |
double |
getZ() |
boolean |
isZero()
Returns true if this vector is a zero vector (all components zero)
|
int |
length()
Returns the length of a vector, in terms of the number of elements.
|
double |
magnitude()
Returns the magnitude (Euclidean length) of the vector
|
void |
multiply(double d)
Multiplies the vector by a constant factor
|
Vector3 |
multiplyCopy(double d)
Returns a copy of the array with all elements multiplied by a single constant value
|
void |
negate()
Negates all emlements of this vector in place.
|
Vector3 |
negateCopy()
Negates all elements in the array, returning a new array
|
double |
normalise()
Normalises this vector to a magnitude of 1.0
Has no effect on a zero-length vector (i.e.
|
static Vector3 |
of(double... values) |
static Vector3 |
of(double x,
double y,
double z) |
void |
projectToPlane(AVector normal,
double distance)
Projects the vector to the plane defined by: x.normal=distance
|
void |
projectToPlane(Vector3 normal,
double distance) |
double |
reduce(Op2 op)
Reduces over all elements of the array in row-major order.
|
double |
reduce(Op2 op,
double init)
Reduces over all elements of the array in row-major order.
|
void |
scaleAdd(double factor,
AVector constant) |
void |
scaleAdd(double factor,
double constant)
Scales this vector and adds a constant to every element
|
void |
scaleAdd(double factor,
Vector3 constant) |
void |
set(AVector v)
Sets the vector to equal the value of another vector
|
void |
set(int i,
double value)
Sets a value at a given position in a mutable 1D array
|
void |
set(Vector3 a) |
void |
setValues(double x,
double y,
double z) |
void |
sub(Vector3 v) |
void |
subMultiple(Vector3 v,
double factor) |
void |
subtractMultiple(Vector3 v,
double factor) |
double[] |
toDoubleArray()
Copies the elements of this array to a new double[] array.
|
void |
toDoubleBuffer(DoubleBuffer dest)
Copies the elements of this INDArray to the specified double buffer
|
Vector3 |
toNormal()
Creates a new mutable vector representing the normalised value of this vector
Returns null if the vector cannot be normalised (i.e.
|
double |
unsafeGet(int i) |
void |
unsafeSet(int i,
double value) |
getT, isFullyMutable, isMutable, isView, sparse, sparseCloneabs, absCopy, add, add, add, add, add, add, add, addAt, addCopy, addCopy, addInnerProduct, addInnerProduct, addInnerProduct, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultipleCopy, addMultipleToArray, addMultipleToArray, addPower, addPower, addPower, addProduct, addProduct, addProduct, addProductCopy, addProductCopy, addProductToArray, addProductToArray, addToArray, addToArray, addToArray, addWeighted, applyOp, applyOp, applyOp, applyOp, applyOpCopy, asDoubleArray, asElementList, asVector, broadcast, broadcastLike, broadcastLike, broadcastLike, checkDimension, checkIndex, checkLength, checkRange, checkSameLength, checkSameLength, checkSameLength, clamp, clampMax, clampMin, compareTo, copyTo, copyTo, copyTo, copyTo, copyTo, dense, denseClone, dimensionality, distanceL1, distanceLinf, distanceSquared, divide, divide, divide, divide, divideCopy, divideCopy, divideTo, dotProduct, dotProduct, dotProduct, elementAbsPowSum, elementCount, elementIterator, elementMax, elementMin, elementPowSum, elementsEqual, epsilonEquals, epsilonEquals, epsilonEquals, epsilonEquals, equals, equals, equalsArray, fillRange, get, get, get, get, get, getElements, getElements, getLongShape, getShape, getShape, getShapeClone, getSlices, getTranspose, getTransposeCopy, getTransposeView, hashCode, hasUncountable, immutable, innerProduct, innerProduct, innerProduct, innerProduct, innerProduct, innerProduct, interpolate, isElementConstrained, isRangeZero, isSameShape, isSameShape, isUnitLengthVector, isUnitLengthVector, iterator, join, join, join, log, logistic, magnitudeSquared, maxAbsElement, maxAbsElementIndex, maxElement, maxElementIndex, minElement, minElementIndex, multiply, multiply, multiply, multiply, multiplyCopy, multiplyCopy, multiplyTo, mutable, nonSparseIndex, nonZeroCount, nonZeroIndices, nonZeroValues, normaliseCopy, normaliseMaxAbsElement, outerProduct, outerProduct, pow, reduceSlices, reduceSlices, reorder, reorder, reshape, rotateCopy, rotateView, rotateView, scale, scaleAdd, scaleAdd, scaleCopy, scaleToMagnitude, select, selectClone, selectView, set, set, set, set, set, set, set, set, set, setElements, setElements, setElements, setInnerProduct, setInnerProduct, setInnerProduct, setMultiple, setMultiple, setMultiple, setMultiple, shiftCopy, signum, slice, slice, sliceCount, sliceValue, softmax, softmaxCopy, sqrtCopy, square, squareCopy, sub, sub, subArray, subAt, subCopy, subCopy, subMultiple, subVector, tanh, toList, toSliceArray, toString, toStringFull, toVector, tryEfficientJoin, validateadd, addInnerProduct, addInnerProduct, addOuterProduct, broadcastCloneLike, broadcastCopyLike, checkMutable, componentCount, density, ensureMutable, exp, get, get, get, getComponent, getComponents, getElements, getElements, getSlices, getSliceViews, isBoolean, isDense, isSparse, reciprocal, reciprocalCopy, scale, set, set, signumCopy, sqrt, sub, sub, toArray, withComponentsfinalize, getClass, notify, notifyAll, wait, wait, waitaddOuterProduct, broadcastCloneLike, broadcastCopyLike, checkMutable, componentCount, ensureMutable, exp, get, get, get, getComponent, getComponents, getElements, getElements, getSlices, getSliceViews, isBoolean, isDense, isSparse, reciprocal, reciprocalCopy, scale, set, set, signumCopy, sqrt, sub, toArray, withComponentsforEach, spliteratorpublic Vector3()
public Vector3(Vector3 source)
public Vector3(double x,
double y,
double z)
public Vector3(double... values)
public Vector3(AVector v)
public void applyOp(Op op)
INDArraypublic double reduce(Op2 op, double init)
INDArraypublic double reduce(Op2 op)
INDArraypublic double normalise()
AVectorpublic static Vector3 of(double x, double y, double z)
public static Vector3 of(double... values)
public boolean isZero()
AVectorpublic double angle(AVector v)
AVectorpublic double angle(Vector3 v)
public void add(double dx,
double dy,
double dz)
public double elementSquaredSum()
INDArrayelementSquaredSum in interface INDArrayelementSquaredSum in class AVectorpublic double distanceSquared(Vector3 v)
public double distance(Vector3 v)
public double distance(AVector v)
AVectorpublic double magnitude()
AVectorpublic void set(Vector3 a)
public void multiply(double d)
AVectorpublic Vector3 multiplyCopy(double d)
INDArraymultiplyCopy in interface INDArraymultiplyCopy in class AVectord - A scalar factorpublic void addMultiple(double dx,
double dy,
double dz,
double factor)
public void addMultiple(AVector v, double factor)
AVectoraddMultiple in class AVectorpublic void addMultiple(Vector3 v, double factor)
public void subtractMultiple(Vector3 v, double factor)
public void add(AVector v)
AVectorpublic Vector3 addCopy(AVector v)
IVectorpublic void add(Vector3 v)
public void sub(Vector3 v)
public void subMultiple(Vector3 v, double factor)
public double dotProduct(Vector3 a)
public double dotProduct(AVector v)
AVectordotProduct in class AVectorpublic double dotProduct(double[] data,
int offset)
AVectordotProduct in class AVectorpublic void crossProduct(AVector a)
AVectorcrossProduct in class AVectorpublic void crossProduct(Vector3 a)
AVectorcrossProduct in class AVectorpublic void projectToPlane(AVector normal, double distance)
AVectorprojectToPlane in class AVectornormal - A Vector of unit lengthpublic void projectToPlane(Vector3 normal, double distance)
public int length()
IVectorpublic double elementSum()
AVectorelementSum in interface INDArrayelementSum in class AVectorpublic double elementProduct()
INDArrayelementProduct in interface INDArrayelementProduct in class AVectorpublic void scaleAdd(double factor,
double constant)
AVectorpublic void scaleAdd(double factor,
Vector3 constant)
public void add(double constant)
INDArraypublic double get(int i)
INDArraypublic void set(AVector v)
AVectorpublic void fill(double v)
AVectorpublic void set(int i,
double value)
INDArraypublic void addAt(int i,
double value)
AVectorpublic void setValues(double x,
double y,
double z)
public void negate()
AVectorpublic Vector3 negateCopy()
INDArraynegateCopy in interface INDArraynegateCopy in class AVectorpublic void getElements(double[] data,
int offset)
INDArraygetElements in interface INDArraygetElements in class AVectorpublic void toDoubleBuffer(DoubleBuffer dest)
INDArraytoDoubleBuffer in interface INDArraytoDoubleBuffer in class AVectorpublic double[] toDoubleArray()
INDArraytoDoubleArray in interface INDArraytoDoubleArray in class AVectorpublic Vector3 toNormal()
AVectortoNormal in class APrimitiveVectorpublic Vector3 clone()
AVectorpublic Vector3 copy()
INDArraypublic double getX()
getX in class APrimitiveVectorpublic double getY()
getY in class APrimitiveVectorpublic double getZ()
getZ in class APrimitiveVectorpublic Vector3 exactClone()
AVectorexactClone in interface INDArrayexactClone in class APrimitiveVectorpublic boolean equals(Vector3 v)
public boolean equalsArray(double[] data,
int offset)
AVectorequalsArray in interface INDArrayequalsArray in class AVectordata - Array of double element values to check for equalityoffset - Offset into the data arrayCopyright © 2016. All rights reserved.