goog.vec.vec3d
Functions
abs( vec0, resultVec ) → Float64Array
Float64Array
Takes the absolute value of each component of vec0 storing the result in resultVec.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
add( vec0, vec1, resultVec ) → Float64Array
Float64Array
Performs a component-wise addition of vec0 and vec1 together storing the result into resultVec.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
clone( vec ) → Float64Array
Float64Array
Creates a clone of the given vec3d.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
create() → Float64Array
Float64Array
Creates a vec3d with all elements initialized to zero.
Parameters | None. | ||
---|---|---|---|
Returns |
|
createFromArray( vec ) → Float64Array
Float64Array
createFromValues( v0, v1, v2 ) → Float64Array
Float64Array
cross( v0, v1, resultVec ) → Float64Array
Float64Array
Computes the vector (cross) product of v0 and v1 storing the result into resultVec.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
direction( vec0, vec1, resultVec ) → Float64Array
Float64Array
Returns a unit vector pointing from one point to another. If the input points are equal then the result will be all zeros.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
distance( vec0, vec1 ) → number
number
Returns the distance between two points.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
distanceSquared( vec0, vec1 ) → number
number
Returns the squared distance between two points.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
dot( v0, v1 ) → number
number
Returns the scalar product of vectors v0 and v1.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
equals( v0, v1 ) → boolean
boolean
Returns true if the components of v0 are equal to the components of v1.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
lerp( v0, v1, f, resultVec ) → Float64Array
Float64Array
Linearly interpolate from vec0 to v1 according to f. The value of f should be in the range [0..1] otherwise the results are undefined.
Parameters |
| ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
magnitude( vec0 ) → number
number
Returns the magnitude of the given vector.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
magnitudeSquared( vec0 ) → number
number
Returns the magnitudeSquared of the given vector.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
max( vec0, limit, resultVec ) → Float64Array
Float64Array
Compares the components of vec0 with the components of another vector or scalar, storing the larger values in resultVec.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
min( vec0, limit, resultVec ) → Float64Array
Float64Array
Compares the components of vec0 with the components of another vector or scalar, storing the smaller values in resultVec.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
negate( vec0, resultVec ) → Float64Array
Float64Array
Negates vec0, storing the result into resultVec.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
normalize( vec0, resultVec ) → Float64Array
Float64Array
Normalizes the given vector storing the result into resultVec.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
scale( vec0, scalar, resultVec ) → Float64Array
Float64Array
Multiplies each component of vec0 with scalar storing the product into resultVec.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
setFromArray( vec, src ) → Float64Array
Float64Array
setFromValues( vec, v0, v1, v2 ) → Float64Array
Float64Array
Initializes the vector with the given values.
Parameters |
| ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
setFromVec3d( vec, src ) → Float64Array
Float64Array
Initializes vec3d vec from vec3d src.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
setFromVec3f( vec, src ) → Float64Array
Float64Array
Initializes vec3d vec from vec3f src (typed as a Float32Array to avoid circular goog.requires).
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
slerp( v0, v1, f, resultVec ) → Float64Array
Float64Array
Perform a spherical linear interpolation from v0 to v1 according to f. The value of f should be in the range [0..1] otherwise the results are undefined.
Slerp is normally used to interpolate quaternions, but there is a geometric formula for interpolating vectors directly, see "Geometric Slerp" in: https://en.wikipedia.org/wiki/Slerp.
This interpolates the vectors' directions via slerp, but linearly interpolates the vectors' magnitudes.
Results are undefined if v0 or v1 are of zero magnitude.
Parameters |
| ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
subtract( vec0, vec1, resultVec ) → Float64Array
Float64Array
Performs a component-wise subtraction of vec1 from vec0 storing the result into resultVec.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
Properties
Type → Float64Array
Float64Array
No information.