Vector2
Vector2
Kind: global class
- Vector2
- new Vector2([x], [y])
- instance
- .x :
number
- .y :
number
- .isVector2 :
boolean
.writeToArray.readFromArray- .fromArray(array, offset)
- .toArray(array, offset)
- .set(x, y) ⇒
Vector2
- .setSilent(x, y)
- .setX(x) ⇒
Vector2
- .setY(y) ⇒
Vector2
- ._sub(x, y) ⇒
Vector2
- .sub(other) ⇒
Vector2
- .subVectors(a, b)
- .floor() ⇒
Vector2
- .ceil() ⇒
Vector2
- .round()
- .abs() ⇒
Vector2
- ._mod(x, y) ⇒
Vector2
- .mod(other) ⇒
Vector2
- .divide(other) ⇒
Vector2
- .multiply(other) ⇒
Vector2
- ._multiply(x, y) ⇒
Vector2
- .max(other) ⇒
Vector2
- .dot(other) ⇒
number
- .copy(other) ⇒
Vector2
- .clone() ⇒
Vector2
- .negate() ⇒
Vector2
- ._add(x, y) ⇒
Vector2
- .add(other) ⇒
Vector2
- .addScalar(val)
- .setScalar(val)
- .divideScalar(val)
- .multiplyScalar(val) ⇒
Vector2
- .toBinaryBuffer(buffer)
- .fromBinaryBuffer(buffer)
- .toBinaryBufferFloat32(buffer)
- .fromBinaryBufferFloat32(buffer)
- .isZero() ⇒
boolean
- .clamp(minX, minY, maxX, maxY)
- .clampLow(lowX, lowY)
- .clampHigh(highX, highY)
- .distanceSqrTo(other) ⇒
number
- ._distanceSqrTo(x, y) ⇒
number
- .lerpVectors(a, b, fraction)
- .applyMatrix3(matrix3)
- .distanceTo(other) ⇒
number
- ._distanceTo(x, y) ⇒
number
- .manhattanDistanceTo(other) ⇒
number
- .length() ⇒
number
- .normalize()
- .hash() ⇒
number
- .rotate(angle)
- .process(processor, [thisArg]) ⇒
Vector2
- .equals(other) ⇒
boolean
- .roughlyEquals(other, [tolerance]) ⇒
boolean
- ._roughlyEquals(x, y, [tolerance]) ⇒
boolean
- .x :
- static
new Vector2([x], [y])
Param | Type | Default |
---|---|---|
[x] | number | 0 |
[y] | number | 0 |
vector2.x : number
Kind: instance property of Vector2
vector2.y : number
Kind: instance property of Vector2
vector2.isVector2 : boolean
Kind: instance property of Vector2
Read only: true
vector2.writeToArray
Deprecated
Kind: instance property of Vector2
vector2.readFromArray
Deprecated
Kind: instance property of Vector2
vector2.fromArray(array, offset)
Kind: instance method of Vector2
Param | Type | Default |
---|---|---|
array | Array.<number> | Float32Array | |
offset | number | 0 |
vector2.toArray(array, offset)
Kind: instance method of Vector2
Param | Type | Default |
---|---|---|
array | Array.<number> | Float32Array | |
offset | number | 0 |
vector2.set(x, y) ⇒ Vector2
Kind: instance method of Vector2
Param | Type |
---|---|
x | number |
y | number |
vector2.setSilent(x, y)
Kind: instance method of Vector2
Param | Type |
---|---|
x | number |
y | number |
vector2.setX(x) ⇒ Vector2
Kind: instance method of Vector2
Param | Type |
---|---|
x | number |
vector2.setY(y) ⇒ Vector2
Kind: instance method of Vector2
Param | Type |
---|---|
y | number |
vector2._sub(x, y) ⇒ Vector2
Kind: instance method of Vector2
Param | Type |
---|---|
x | number |
y | number |
vector2.sub(other) ⇒ Vector2
Kind: instance method of Vector2
Param | Type |
---|---|
other | Vector2 |
vector2.subVectors(a, b)
Kind: instance method of Vector2
Param | Type |
---|---|
a | Vector2 |
b | Vector2 |
vector2.floor() ⇒ Vector2
performs Math.floor operation on x and y
Kind: instance method of Vector2
vector2.ceil() ⇒ Vector2
performs Math.ceil operation on x and y
Kind: instance method of Vector2
vector2.round()
Round both components to nearest integer
Kind: instance method of Vector2
vector2.abs() ⇒ Vector2
performs Math.abs operation on x and y
Kind: instance method of Vector2
vector2._mod(x, y) ⇒ Vector2
Kind: instance method of Vector2
Param | Type |
---|---|
x | number |
y | number |
vector2.mod(other) ⇒ Vector2
Kind: instance method of Vector2
Param | Type |
---|---|
other | Vector2 |
vector2.divide(other) ⇒ Vector2
Kind: instance method of Vector2
Param | Type |
---|---|
other | Vector2 |
vector2.multiply(other) ⇒ Vector2
Kind: instance method of Vector2
Param | Type |
---|---|
other | Vector2 |
vector2._multiply(x, y) ⇒ Vector2
Kind: instance method of Vector2
Param | Type |
---|---|
x | number |
y | number |
vector2.max(other) ⇒ Vector2
Kind: instance method of Vector2
Param | Type |
---|---|
other | Vector2 |
vector2.dot(other) ⇒ number
Kind: instance method of Vector2
Param | Type |
---|---|
other | Vector2 |
vector2.copy(other) ⇒ Vector2
Kind: instance method of Vector2
Param | Type |
---|---|
other | Vector2 |
vector2.clone() ⇒ Vector2
Kind: instance method of Vector2
vector2.negate() ⇒ Vector2
Kind: instance method of Vector2
vector2._add(x, y) ⇒ Vector2
Kind: instance method of Vector2
Param | Type |
---|---|
x | number |
y | number |
vector2.add(other) ⇒ Vector2
Kind: instance method of Vector2
Param | Type |
---|---|
other | Vector2 |
vector2.addScalar(val)
Kind: instance method of Vector2
Param | Type |
---|---|
val | Number |
vector2.setScalar(val)
Kind: instance method of Vector2
Param | Type |
---|---|
val | number |
vector2.divideScalar(val)
Kind: instance method of Vector2
Param | Type |
---|---|
val | number |
vector2.multiplyScalar(val) ⇒ Vector2
Kind: instance method of Vector2
Param | Type |
---|---|
val | Number |
vector2.toBinaryBuffer(buffer)
Kind: instance method of Vector2
Param | Type |
---|---|
buffer | BinaryBuffer |
vector2.fromBinaryBuffer(buffer)
Kind: instance method of Vector2
Param | Type |
---|---|
buffer | BinaryBuffer |
vector2.toBinaryBufferFloat32(buffer)
Kind: instance method of Vector2
Param | Type |
---|---|
buffer | BinaryBuffer |
vector2.fromBinaryBufferFloat32(buffer)
Kind: instance method of Vector2
Param | Type |
---|---|
buffer | BinaryBuffer |
vector2.isZero() ⇒ boolean
Kind: instance method of Vector2
vector2.clamp(minX, minY, maxX, maxY)
Kind: instance method of Vector2
Param | Type |
---|---|
minX | Number |
minY | Number |
maxX | Number |
maxY | Number |
vector2.clampLow(lowX, lowY)
Kind: instance method of Vector2
Param | Type |
---|---|
lowX | Number |
lowY | Number |
vector2.clampHigh(highX, highY)
Kind: instance method of Vector2
Param | Type |
---|---|
highX | Number |
highY | Number |
vector2.distanceSqrTo(other) ⇒ number
Kind: instance method of Vector2
Param | Type |
---|---|
other | Vector2 |
vector2._distanceSqrTo(x, y) ⇒ number
Kind: instance method of Vector2
Param | Type |
---|---|
x | number |
y | number |
vector2.lerpVectors(a, b, fraction)
Kind: instance method of Vector2
Param | Type |
---|---|
a | Vector2 |
b | Vector2 |
fraction | number |
vector2.applyMatrix3(matrix3)
Kind: instance method of Vector2
Param | Type |
---|---|
matrix3 | Array.<number> |
vector2.distanceTo(other) ⇒ number
Kind: instance method of Vector2
Param | Type |
---|---|
other | Vector2 |
vector2._distanceTo(x, y) ⇒ number
Kind: instance method of Vector2
Param | Type |
---|---|
x | number |
y | number |
vector2.manhattanDistanceTo(other) ⇒ number
Kind: instance method of Vector2
Param | Type |
---|---|
other | Vector2 |
vector2.length() ⇒ number
Kind: instance method of Vector2
vector2.normalize()
Normalizes the vector, preserving its direction, but making magnitude equal to 1
Kind: instance method of Vector2
vector2.hash() ⇒ number
Kind: instance method of Vector2
vector2.rotate(angle)
Rotation is counter-clockwise
Kind: instance method of Vector2
Param | Type | Description |
---|---|---|
angle | number | in radians |
vector2.process(processor, [thisArg]) ⇒ Vector2
Kind: instance method of Vector2
Param | Type |
---|---|
processor | function |
[thisArg] | * |
vector2.equals(other) ⇒ boolean
Kind: instance method of Vector2
Param | Type |
---|---|
other | Vector2 |
vector2.roughlyEquals(other, [tolerance]) ⇒ boolean
Kind: instance method of Vector2
Param | Type |
---|---|
other | Vector2 |
[tolerance] | number |
vector2._roughlyEquals(x, y, [tolerance]) ⇒ boolean
Kind: instance method of Vector2
Param | Type | Description |
---|---|---|
x | number | |
y | number | |
[tolerance] | number | acceptable deviation |
Vector2.up : Vector2
Kind: static property of Vector2
Read only: true
Vector2.down : Vector2
Kind: static property of Vector2
Read only: true
Vector2.left : Vector2
Kind: static property of Vector2
Read only: true
Vector2.right : Vector2
Kind: static property of Vector2
Read only: true
Vector2.zero : Vector2
Kind: static property of Vector2
Read only: true
Vector2.one : Vector2
Kind: static property of Vector2
Read only: true