Table of Contents

Struct FastVec2i

Namespace
Vintagestory.API.MathTools
Assembly
VintagestoryAPI.dll

Represents a vector of 2 ints. Go bug Tyron if you need more utility methods in this class.

[ProtoContract]
public struct FastVec2i : IEquatable<FastVec2i>
Implements
Inherited Members
Extension Methods

Constructors

FastVec2i()

public FastVec2i()

FastVec2i(int, int)

public FastVec2i(int x, int y)

Parameters

x int
y int

FastVec2i(Vec3d)

public FastVec2i(Vec3d pos)

Parameters

pos Vec3d

Fields

val

[ProtoMember(1)]
public ulong val

Field Value

ulong

Properties

this[int]

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

Parameters

index int

Property Value

int

X

public int X { get; set; }

Property Value

int

Y

public int Y { get; set; }

Property Value

int

Zero

public static FastVec2i Zero { get; }

Property Value

FastVec2i

Methods

Add(int, int)

public FastVec2i Add(int dx, int dy)

Parameters

dx int
dy int

Returns

FastVec2i

Copy()

public FastVec2i Copy()

Returns

FastVec2i

Equals(object)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

Equals(FastVec2i)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(FastVec2i other)

Parameters

other FastVec2i

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

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.

ManhattenDistance(int, int)

public int ManhattenDistance(int x, int y)

Parameters

x int
y int

Returns

int

ManhattenDistance(Vec2i)

public int ManhattenDistance(Vec2i point)

Parameters

point Vec2i

Returns

int

Set(int, int)

public FastVec2i Set(int x, int y)

Parameters

x int
y int

Returns

FastVec2i

Set(Vec2i)

public FastVec2i Set(Vec2i vec)

Parameters

vec Vec2i

Returns

FastVec2i

ToChunkIndex()

27 lowest bits for X Coordinate, then 27 bits for Z coordinate

public ulong ToChunkIndex()

Returns

ulong

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

Operators

operator +(FastVec2i, int)

public static FastVec2i operator +(FastVec2i left, int right)

Parameters

left FastVec2i
right int

Returns

FastVec2i

operator +(FastVec2i, FastVec2i)

public static FastVec2i operator +(FastVec2i left, FastVec2i right)

Parameters

left FastVec2i
right FastVec2i

Returns

FastVec2i

operator /(FastVec2i, int)

public static FastVec2i operator /(FastVec2i left, int right)

Parameters

left FastVec2i
right int

Returns

FastVec2i

operator /(FastVec2i, float)

public static FastVec2i operator /(FastVec2i left, float right)

Parameters

left FastVec2i
right float

Returns

FastVec2i

operator ==(FastVec2i, FastVec2i)

public static bool operator ==(FastVec2i left, FastVec2i right)

Parameters

left FastVec2i
right FastVec2i

Returns

bool

operator !=(FastVec2i, FastVec2i)

public static bool operator !=(FastVec2i left, FastVec2i right)

Parameters

left FastVec2i
right FastVec2i

Returns

bool

operator *(double, FastVec2i)

public static FastVec2i operator *(double left, FastVec2i right)

Parameters

left double
right FastVec2i

Returns

FastVec2i

operator *(int, FastVec2i)

public static FastVec2i operator *(int left, FastVec2i right)

Parameters

left int
right FastVec2i

Returns

FastVec2i

operator *(FastVec2i, double)

public static FastVec2i operator *(FastVec2i left, double right)

Parameters

left FastVec2i
right double

Returns

FastVec2i

operator *(FastVec2i, int)

public static FastVec2i operator *(FastVec2i left, int right)

Parameters

left FastVec2i
right int

Returns

FastVec2i

operator *(FastVec2i, FastVec2i)

public static double operator *(FastVec2i left, FastVec2i right)

Parameters

left FastVec2i
right FastVec2i

Returns

double

operator -(int, FastVec2i)

public static FastVec2i operator -(int left, FastVec2i right)

Parameters

left int
right FastVec2i

Returns

FastVec2i

operator -(FastVec2i, int)

public static FastVec2i operator -(FastVec2i left, int right)

Parameters

left FastVec2i
right int

Returns

FastVec2i

operator -(FastVec2i, FastVec2i)

public static FastVec2i operator -(FastVec2i left, FastVec2i right)

Parameters

left FastVec2i
right FastVec2i

Returns

FastVec2i