Name | Summary |
---|---|
x | The x component of the vector. |
y | The y component of the vector. |
Name | Summary |
---|---|
Vector2 | constructor(v: Float) Secondary constructor to create a vector where both components are the same. constructor(x: Float = 0.0f, y: Float = 0.0f) |
Name | Summary |
---|---|
x | var x: Float |
y | var y: Float |
Name | Summary |
---|---|
add | fun add(v: Vector2): Vector2 Adds the specified vector to this vector. |
cross | fun cross(other: Vector2): Float Calculates the cross product of this vector with another vector. |
distanceTo | fun distanceTo(v: Vector2): Float Calculates the distance to another vector. |
div | operator fun div(v: Float): Vector2 Divides each component of this vector by a scalar. |
divide | fun divide(v: Float): Vector2 Divides each component of this vector by a scalar. |
dot | fun dot(v: Vector2): Float Calculates the dot product of this vector with another vector. |
length | fun length(): Float Returns the length (magnitude) of this vector. |
lerp | fun lerp(dest: Vector2, ratio: Float): Vector2 Linearly interpolates between this vector and another vector by the given ratio. |
max | fun max(v: Vector2): Vector2 Returns a vector with the maximum components of this vector and another vector. |
min | fun min(v: Vector2): Vector2 Returns a vector with the minimum components of this vector and another vector. |
minus | operator fun minus(v: Vector2): Vector2 Subtracts the other vector from this vector. |
multiply | fun multiply(v: Vector2): Vector2 Multiplies this vector by another vector component-wise. fun multiply(v: Float): Vector2 Multiplies each component of this vector by a scalar. |
negate | fun negate(): Vector2 Negates this vector. |
normalize | fun normalize(): Vector2 Normalizes this vector. |
plus | operator fun plus(v: Vector2): Vector2 Adds two vectors. |
setX | fun setX(x: Float): Vector2 Sets the x component of this vector. |
setY | fun setY(y: Float): Vector2 Sets the y component of this vector. |
sub | fun sub(v: Vector2): Vector2 Subtracts the specified vector from this vector. |
times | operator fun times(v: Vector2): Vector2 Multiplies two vectors component-wise. operator fun times(v: Float): Vector2 Multiplies each component of this vector by a scalar. |
toString | open override fun toString(): String Returns a string representation of the vector. |
unaryMinus | operator fun unaryMinus(): Vector2 Negates this vector. |