Table of Contents

Struct FastVec3i

Namespace
Vintagestory.API.MathTools
Assembly
VintagestoryAPI.dll

Represents a vector of 3 ints, similar to a Vec3i or a BlockPos but this is a struct

public struct FastVec3i
Inherited Members
Extension Methods

Constructors

FastVec3i(int, int, int)

Create a new vector with given coordinates

public FastVec3i(int x, int y, int z)

Parameters

x int
y int
z int

FastVec3i(int[])

Create a new vector with given coordinates

public FastVec3i(int[] values)

Parameters

values int[]

FastVec3i(BlockPos)

Create a new vector with given coordinates

public FastVec3i(BlockPos pos)

Parameters

pos BlockPos

FastVec3i(Vec3i)

public FastVec3i(Vec3i vec3i)

Parameters

vec3i Vec3i

Fields

X

The X-Component of the vector

public int X

Field Value

int

Y

The Y-Component of the vector

public int Y

Field Value

int

Z

The Z-Component of the vector

public int Z

Field Value

int

Properties

B

Synonum for Z

public int B { get; set; }

Property Value

int

G

Synonum for Y

public int G { get; set; }

Property Value

int

this[int]

Returns the n-th coordinate

public int this[int index] { get; set; }

Parameters

index int

Property Value

int

R

Synonum for X

public int R { get; set; }

Property Value

int

Methods

Add(int, int, int)

Adds given x/y/z coordinates to the vector

public FastVec3i Add(int x, int y, int z)

Parameters

x int
y int
z int

Returns

FastVec3i

AddCopy(FastVec3i)

Adds both vectors into a new vector. Both source vectors remain unchanged.

public FastVec3i AddCopy(FastVec3i vec)

Parameters

vec FastVec3i

Returns

FastVec3i

Clone()

Creates a copy of the vetor

public FastVec3i Clone()

Returns

FastVec3i

CreateFromBytes(BinaryReader)

public static FastVec3i CreateFromBytes(BinaryReader reader)

Parameters

reader BinaryReader

Returns

FastVec3i

Distance(FastVec3i)

Calculates the distance the two endpoints

public float Distance(FastVec3i vec)

Parameters

vec FastVec3i

Returns

float

Distance(Vec3d)

Calculates the distance the two endpoints

public float Distance(Vec3d vec)

Parameters

vec Vec3d

Returns

float

DistanceSq(double, double, double)

Calculates the square distance the two endpoints

public double DistanceSq(double x, double y, double z)

Parameters

x double
y double
z double

Returns

double

Equals(BlockPos)

public bool Equals(BlockPos other)

Parameters

other BlockPos

Returns

bool

Equals(FastVec3i)

public bool Equals(FastVec3i other)

Parameters

other FastVec3i

Returns

bool

Equals(Vec3i)

public bool Equals(Vec3i other)

Parameters

other Vec3i

Returns

bool

Length()

Returns the length of this vector

public float Length()

Returns

float

Mul(int)

Multiplies each coordinate with given multiplier

public FastVec3i Mul(int multiplier)

Parameters

multiplier int

Returns

FastVec3i

Negate()

public void Negate()

Set(int, int, int)

Sets the vector to this coordinates

public FastVec3i Set(int x, int y, int z)

Parameters

x int
y int
z int

Returns

FastVec3i

Set(int[])

public FastVec3i Set(int[] vec)

Parameters

vec int[]

Returns

FastVec3i

Set(FastVec3i)

Sets the vector to the coordinates of given vector

public void Set(FastVec3i vec)

Parameters

vec FastVec3i

Set(Vec3d)

Sets the vector to the coordinates of given vector

public FastVec3i Set(Vec3d vec)

Parameters

vec Vec3d

Returns

FastVec3i

ToString()

Simple string represenation of the x/y/z components

public override string ToString()

Returns

string

ToVec3d()

Creates a new double precision vector with the same coordinates

public Vec3d ToVec3d()

Returns

Vec3d

Write(BinaryWriter)

public void Write(BinaryWriter writer)

Parameters

writer BinaryWriter