Home > rc-js-util > Vec2
Vector 2.
Signature:
export declare abstract class Vec2<TArray extends TTypedArray> extends ATypedArrayTuple<2, TArray>
Extends: ATypedArrayTuple
See static properties for constructors. Instances are not an extension of this class, but of the static members.
Property | Modifiers | Type | Description |
---|---|---|---|
“0” | number | x | |
“1” | number | y | |
constructor | IVec2Ctor<TArray> | ||
constructors | static |
Map<TTypedArrayCtor, Function> | |
f32 | static |
IVec2Ctor<Float32Array> | |
f64 | static |
IVec2Ctor<Float64Array> | |
i16 | static |
IVec2Ctor<Int16Array> | |
i32 | static |
IVec2Ctor<Int32Array> | |
i8 | static |
IVec2Ctor<Int8Array> | |
TTypeGuardVec2 | true | ||
u16 | static |
IVec2Ctor<Uint16Array> | |
u32 | static |
IVec2Ctor<Uint32Array> | |
u8 | static |
IVec2Ctor<Uint8Array> | |
u8c | static |
IVec2Ctor<Uint8ClampedArray> |
Method | Modifiers | Description |
---|---|---|
add(_vec, _result) | ||
bound2d(_range) | If this point is outside of the range, set that dimension to the extrema of the range. | |
castToBaseType() | Although the typed array tuples extend a typed array, they are not structurally compatible. This function returns the argument passed without modification but cast as the underlying storage type, e.g. Float32Array. | |
copyFromBuffer(_memoryDataView, _pointer, _littleEndian) | If endianness is not supplied the platform’s endianness will be used. | |
copyToBuffer(_memoryDataView, _pointer, _littleEndian) | If endianness is not supplied the platform’s endianness will be used. | |
dotProduct(_vec) | ||
getCtor(ctor) | static |
|
getLoggableValue() | ||
getMagnitude() | ||
getMagnitudeSquared() | ||
getNormal(_result) | Returns the normal to this vector. | |
getX() | ||
getY() | ||
isEqualTo(_other) | Component-wise equals. | |
mat3Multiply(_mat, _result) | ||
normalize(_result) | Returns a unit vector in the direction of this vector. | |
scalarDivide(_value, _result) | ||
scalarMultiply(_value, _result) | ||
setX(_x) | ||
setY(_y) | ||
subtract(_vec, _result) | ||
translate2d(_dx, _dy) | Shifts this position by the arguments. | |
update(_x, _y) | ||
vec2Divide(_value, _result) | Divide this by _value . |
|
vec2Multiply(_value, _result) | Multiply this by _value . |