Velocity
-
Cmn
value class Velocity
A two dimensional velocity in pixels per second.
Summary
Public functions |
||
|---|---|---|
inline operator Float |
The horizontal component of the velocity in pixels per second. |
Cmn
|
inline operator Float |
The vertical component of the velocity in pixels per second. |
Cmn
|
Velocity |
Returns a copy of this |
Cmn
|
operator Velocity |
Division operator. |
Cmn
|
operator Velocity |
Binary subtraction operator. |
Cmn
|
operator Velocity |
Binary addition operator. |
Cmn
|
operator Velocity |
Modulo (remainder) operator. |
Cmn
|
operator Velocity |
Multiplication operator. |
Cmn
|
open String |
toString() |
Cmn
|
operator Velocity |
Unary negation operator. |
Cmn
|
Public properties |
||
|---|---|---|
Float |
The horizontal component of the velocity in pixels per second. |
Cmn
|
Float |
The vertical component of the velocity in pixels per second. |
Cmn
|
Public functions
component1
inline operator fun component1(): Float
The horizontal component of the velocity in pixels per second.
component2
inline operator fun component2(): Float
The vertical component of the velocity in pixels per second.
copy
fun copy(
x: Float = unpackFloat1(packedValue),
y: Float = unpackFloat2(packedValue)
): Velocity
Returns a copy of this Velocity instance optionally overriding the x or y parameter
div
operator fun div(operand: Float): Velocity
Division operator.
Returns a Velocity whose coordinates are those of the left-hand-side operand (an Velocity) divided by the scalar right-hand-side operand (a Float).
minus
operator fun minus(other: Velocity): Velocity
Binary subtraction operator.
Returns a Velocity whose x value is the left-hand-side operand's x minus the right-hand-side operand's x and whose y value is the left-hand-side operand's y minus the right-hand-side operand's y.
plus
operator fun plus(other: Velocity): Velocity
Binary addition operator.
Returns a Velocity whose x value is the sum of the x values of the two operands, and whose y value is the sum of the y values of the two operands.
rem
operator fun rem(operand: Float): Velocity
Modulo (remainder) operator.
Returns a Velocity whose coordinates are the remainder of dividing the coordinates of the left-hand-side operand (a Velocity) by the scalar right-hand-side operand (a Float).
times
operator fun times(operand: Float): Velocity
Multiplication operator.
Returns a Velocity whose coordinates are those of the left-hand-side operand (a Velocity) multiplied by the scalar right-hand-side operand (a Float).
unaryMinus
operator fun unaryMinus(): Velocity
Unary negation operator.
Returns a Velocity with the coordinates negated.
If the Velocity represents an arrow on a plane, this operator returns the same arrow but pointing in the reverse direction.