plus

operator fun Vector.plus(other: Vector): Vector

Adds two Vectors component-wise.

Example:

val v1 = Vector(1.0, 2.0, 3.0)
val v2 = Vector(4.0, 5.0, 6.0)
val result = v1 + v2 // Vector(5.0, 7.0, 9.0)

Return

A new Vector with component-wise sum

Parameters

other

The Vector to add


operator fun Vector.plus(other: Double): Vector

Adds a scalar value to all components of the Vector.

Example:

val v = Vector(1.0, 2.0, 3.0)
val result = v + 5.0 // Vector(6.0, 7.0, 8.0)

Return

A new Vector with the scalar added to all components

Parameters

other

The scalar value to add to each component


operator fun Location.plus(vector: Vector): Location

Adds a Vector to this Location's coordinates.

Example:

val loc = Location(world, 10.0, 64.0, -20.0)
val vec = Vector(5.0, 10.0, 3.0)
val result = loc + vec // Location at (15.0, 74.0, -17.0)

Return

A new Location with the Vector added

Parameters

vector

The Vector to add


operator fun Location.plus(other: Location): Location

Adds another Location's coordinates to this Location.

Example:

val loc1 = Location(world, 10.0, 20.0, 30.0)
val loc2 = Location(world, 5.0, 10.0, 15.0)
val result = loc1 + loc2 // Location at (15.0, 30.0, 45.0)

Return

A new Location with the coordinates added

Parameters

other

The Location whose coordinates to add


operator fun Location.plus(other: Double): Location

Adds a scalar value to all coordinates of this Location.

Example:

val loc = Location(world, 10.0, 20.0, 30.0)
val result = loc + 5.0 // Location at (15.0, 25.0, 35.0)

Return

A new Location with the scalar added to all coordinates

Parameters

other

The scalar value to add to all coordinates