Vec3i

data class Vec3i(val x: Int, val y: Int, val z: Int) : Record, Comparable<Vec3i>

An integer vector with an X, Y, and Z component.

This is mostly used to represent positions of blocks in a world, as blocks are axis-aligned and so have integer coordinates.

Constructors

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

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun abs(): Vec3i

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

Link copied to clipboard
fun add(amount: Int): Vec3i

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

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

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

fun add(x: Int, y: Int, z: Int): Vec3i

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

Link copied to clipboard

Converts this integer vector to an equivalent double vector, at the center of a block.

Link copied to clipboard

Converts this integer vector to an equivalent position.

Link copied to clipboard
fun asVec3d(): Vec3d

Converts this integer vector to an equivalent double vector.

Link copied to clipboard
fun chunkX(): Int

Gets the chunk X coordinate of this vector.

Link copied to clipboard
fun chunkZ(): Int

Gets the chunk Z coordinate of this vector.

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

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.

fun distance(x: Int, y: Int, z: Int): Double

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.

fun distanceSquared(x: Int, y: Int, z: Int): Int

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

Link copied to clipboard
fun divide(factor: Int): Vec3i

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

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

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

fun divide(x: Int, y: Int, z: Int): Vec3i

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

Link copied to clipboard
fun dot(other: Vec3i): Int

Calculates the dot product of this vector and the given other 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: Int): Vec3i

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

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

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

fun multiply(x: Int, y: Int, z: Int): Vec3i

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

Link copied to clipboard
fun negate(): Vec3i

Returns a vector with the components of this vector negated.

Link copied to clipboard
fun relative(direction: Direction): Vec3i

Gets the vector in the given direction relative to this vector.

Link copied to clipboard
fun subtract(amount: Int): Vec3i

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

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

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

fun subtract(x: Int, y: Int, z: Int): Vec3i

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: Int): Vec3i

Creates a new vector with the given x component.

Link copied to clipboard
fun withY(y: Int): Vec3i

Creates a new vector with the given y component.

Link copied to clipboard
fun withZ(z: Int): Vec3i

Creates a new vector with the given z component.

Properties

Link copied to clipboard
val x: Int

The X component of this vector.

Link copied to clipboard
val y: Int

The Y component of this vector.

Link copied to clipboard
val z: Int

The Z component of this vector.