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
FastVec3i(int[])
Create a new vector with given coordinates
public FastVec3i(int[] values)
Parameters
valuesint[]
FastVec3i(BlockPos)
Create a new vector with given coordinates
public FastVec3i(BlockPos pos)
Parameters
posBlockPos
FastVec3i(Vec3i)
public FastVec3i(Vec3i vec3i)
Parameters
vec3iVec3i
Fields
X
The X-Component of the vector
public int X
Field Value
Y
The Y-Component of the vector
public int Y
Field Value
Z
The Z-Component of the vector
public int Z
Field Value
Properties
B
Synonum for Z
public int B { get; set; }
Property Value
G
Synonum for Y
public int G { get; set; }
Property Value
this[int]
Returns the n-th coordinate
public int this[int index] { get; set; }
Parameters
indexint
Property Value
R
Synonum for X
public int R { get; set; }
Property Value
Methods
Add(int, int, int)
Adds given x/y/z coordinates to the vector
public FastVec3i Add(int x, int y, int z)
Parameters
Returns
AddCopy(FastVec3i)
Adds both vectors into a new vector. Both source vectors remain unchanged.
public FastVec3i AddCopy(FastVec3i vec)
Parameters
vecFastVec3i
Returns
Clone()
Creates a copy of the vetor
public FastVec3i Clone()
Returns
CreateFromBytes(BinaryReader)
public static FastVec3i CreateFromBytes(BinaryReader reader)
Parameters
readerBinaryReader
Returns
Distance(FastVec3i)
Calculates the distance the two endpoints
public float Distance(FastVec3i vec)
Parameters
vecFastVec3i
Returns
Distance(Vec3d)
Calculates the distance the two endpoints
public float Distance(Vec3d vec)
Parameters
vecVec3d
Returns
DistanceSq(double, double, double)
Calculates the square distance the two endpoints
public double DistanceSq(double x, double y, double z)
Parameters
Returns
Equals(BlockPos)
public bool Equals(BlockPos other)
Parameters
otherBlockPos
Returns
Equals(FastVec3i)
public bool Equals(FastVec3i other)
Parameters
otherFastVec3i
Returns
Equals(Vec3i)
public bool Equals(Vec3i other)
Parameters
otherVec3i
Returns
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
Length()
Returns the length of this vector
public float Length()
Returns
Mul(int)
Multiplies each coordinate with given multiplier
public FastVec3i Mul(int multiplier)
Parameters
multiplierint
Returns
Negate()
public void Negate()
Set(int, int, int)
Sets the vector to this coordinates
public FastVec3i Set(int x, int y, int z)
Parameters
Returns
Set(int[])
public FastVec3i Set(int[] vec)
Parameters
vecint[]
Returns
Set(BlockPos)
public FastVec3i Set(BlockPos pos)
Parameters
posBlockPos
Returns
Set(FastVec3i)
Sets the vector to the coordinates of given vector
public void Set(FastVec3i vec)
Parameters
vecFastVec3i
Set(Vec3d)
Sets the vector to the coordinates of given vector
public FastVec3i Set(Vec3d vec)
Parameters
vecVec3d
Returns
ToString()
Simple string represenation of the x/y/z components
public override string ToString()
Returns
ToVec3d()
Creates a new double precision vector with the same coordinates
public Vec3d ToVec3d()
Returns
Write(BinaryWriter)
public void Write(BinaryWriter writer)
Parameters
writerBinaryWriter