open class Vector4(var x: Float, var y: Float, var z: Float, var w: Float)
Vector4
(
v
)
|
Constructor that takes a single float value and initializes all components to that value.
Signature
constructor(v: Float) Parameters v: Float
The value to initialize all components with.
Returns Vector4 |
Vector4
(
x
, y
, z
, w
)
|
Signature
constructor(x: Float, y: Float, z: Float, w: Float) Parameters x: Float
The x coordinate component.
y: Float
The y coordinate component.
z: Float
The z coordinate component.
w: Float
The w component (quaternion scalar or homogeneous coordinate).
Returns Vector4 |
w
: Float
[Get][Set] |
The w component (quaternion scalar or homogeneous coordinate).
Signature
open var w: Float |
x
: Float
[Get][Set] |
The x coordinate component.
Signature
open var x: Float |
y
: Float
[Get][Set] |
The y coordinate component.
Signature
open var y: Float |
z
: Float
[Get][Set] |
The z coordinate component.
Signature
open var z: Float |
add
(
v
)
| |
component1
()
|
Signature
operator fun component1(): Float Returns Float |
component2
()
|
Signature
operator fun component2(): Float Returns Float |
component3
()
|
Signature
operator fun component3(): Float Returns Float |
component4
()
|
Signature
operator fun component4(): Float Returns Float |
copy
()
| |
distanceTo
(
v
)
|
Calculates the distance between two vectors.
Signature
fun distanceTo(v: Vector4): Float Parameters Returns Float
The distance between the two vectors.
|
div
(
v
)
|
Overloads the div operator to perform scalar division.
Signature
operator fun div(v: Float): Vector4 Parameters v: Float
The scalar to divide by.
|
divide
(
v
)
|
Performs scalar division.
Signature
fun divide(v: Float): Vector4 Parameters v: Float
The scalar to divide by.
|
dot
(
v
)
|
Calculates the dot product of two vectors.
Signature
fun dot(v: Vector4): Float Parameters Returns Float
The dot product.
|
equals
(
other
)
|
Signature
open operator override fun equals(other: Any?): Boolean Parameters other: Any?Returns Boolean |
hashCode
()
|
Signature
open override fun hashCode(): Int Returns Int |
length
()
|
Calculates the length of the vector.
Signature
fun length(): Float Returns Float
The length of the vector.
|
lerp
(
dest
, ratio
)
|
Linearly interpolates between two vectors.
Signature
fun lerp(dest: Vector4, ratio: Float): Vector4 Parameters ratio: Float
The interpolation ratio, where 0 means no interpolation (i.e., the current vector) and 1 means full interpolation (i.e., the destination vector).
|
minus
(
v
)
| |
multiply
(
v
)
| |
multiply
(
v
)
|
Performs scalar multiplication.
Signature
fun multiply(v: Float): Vector4 Parameters v: Float
The scalar to multiply by.
|
negate
()
| |
normalize
()
|
Normalizes the vector.
Signature
fun normalize(): Vector4 Returns Vector4
A new vector representing the normalization of this vector, or (0, 0, 0, 0) if the length of this vector is 0.
|
plus
(
v
)
| |
setW
(
w
)
| |
setX
(
x
)
| |
setY
(
y
)
| |
setZ
(
z
)
| |
sub
(
v
)
| |
times
(
v
)
| |
times
(
v
)
|
Overloads the times operator to perform scalar multiplication.
Signature
operator fun times(v: Float): Vector4 Parameters v: Float
The scalar to multiply by.
|
toString
()
|
Signature
open override fun toString(): String Returns String |
unaryMinus
()
|
Overloads the unary minus operator to negate the vector.
Signature
operator fun unaryMinus(): Vector4 |