Vec3d

data class Vec3d(val x: Double, val y: Double, val z: Double) : Record, Comparable<Vec3d>

A double vector with an X, Y, and Z component.

Constructors

Link copied to clipboard
constructor(x: Double, y: Double, z: Double)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun abs(): Vec3d

Returns a vector with the absolute values of the components of this vector.

Link copied to clipboard
fun add(amount: Double): Vec3d

Adds the given amount to this vector and returns the result.

fun add(other: Vec3d): Vec3d
fun add(other: Vec3i): Vec3d

Adds the given other vector to this vector and returns the result.

fun add(x: Double, y: Double, z: Double): Vec3d

Adds the given x, y, and z values to this vector and returns the result.

Link copied to clipboard

Converts this double vector to an equivalent position.

Link copied to clipboard
fun asVec3i(): Vec3i

Converts this double vector to an equivalent integer vector.

Link copied to clipboard
open operator override fun compareTo(other: Vec3d): Int
Link copied to clipboard
fun cross(other: Vec3d): Vec3d

Calculates the cross product of this vector and the given other vector.

Link copied to clipboard
fun distance(other: Vec3d): Double
fun distance(other: Vec3i): Double

Calculates the distance between this vector and the given other vector.

Calculates the distance between this vector and the given x, y, and z values.

Link copied to clipboard

Calculates the squared distance between this vector and the given other vector.

Calculates the squared distance between this vector and the given x, y, and z values.

Link copied to clipboard
fun divide(factor: Double): Vec3d

Divides this vector by the given factor and returns the result.

fun divide(other: Vec3d): Vec3d
fun divide(other: Vec3i): Vec3d

Divides this vector by the given other vector and returns the result.

fun divide(x: Double, y: Double, z: Double): Vec3d

Divides this vector by the given x, y, and z values and returns the result.

Link copied to clipboard
fun dot(other: Vec3d): Double

Calculates the dot product of this vector and the given other vector.

Link copied to clipboard
fun floorX(): Int

Gets the floored X component of this vector.

Link copied to clipboard
fun floorY(): Int

Gets the floored Y component of this vector.

Link copied to clipboard
fun floorZ(): Int

Gets the floored Z component of this vector.

Link copied to clipboard
fun length(): Double

Calculates the length of this vector.

Link copied to clipboard

Computes the length of this vector.

Link copied to clipboard
fun multiply(factor: Double): Vec3d

Multiplies this vector by the given factor and returns the result.

fun multiply(other: Vec3d): Vec3d
fun multiply(other: Vec3i): Vec3d

Multiplies this vector by the given other vector and returns the result.

fun multiply(x: Double, y: Double, z: Double): Vec3d

Multiplies this vector by the given x, y, and z values and returns the result.

Link copied to clipboard
fun negate(): Vec3d

Returns a vector with the components of this vector negated.

Link copied to clipboard

Returns a normalized version of this vector.

Link copied to clipboard
fun subtract(amount: Double): Vec3d

Subtracts the given amount from this vector and returns the result.

fun subtract(other: Vec3d): Vec3d
fun subtract(other: Vec3i): Vec3d

Subtracts the given other vector from this vector and returns the result.

fun subtract(x: Double, y: Double, z: Double): Vec3d

Subtracts the given x, y, and z values from this vector and returns the result.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
fun withX(x: Double): Vec3d

Creates a new vector with the given x component.

Link copied to clipboard
fun withY(y: Double): Vec3d

Creates a new vector with the given y component.

Link copied to clipboard
fun withZ(z: Double): Vec3d

Creates a new vector with the given z component.

Properties

Link copied to clipboard
val x: Double

The X component of this vector.

Link copied to clipboard
val y: Double

The Y component of this vector.

Link copied to clipboard
val z: Double

The Z component of this vector.