Table of Contents

Class Vec2i

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 class Vec2i : IEquatable<Vec2i>
Inheritance
Vec2i
Implements
Inherited Members
Extension Methods

Constructors

Vec2i()

public Vec2i()

Vec2i(int, int)

public Vec2i(int x, int y)

Parameters

x int
y int

Vec2i(Vec3d)

public Vec2i(Vec3d pos)

Parameters

pos Vec3d

Fields

X

[ProtoMember(1)]
public int X

Field Value

int

Y

[ProtoMember(2)]
public int Y

Field Value

int

Properties

this[int]

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

Parameters

index int

Property Value

int

Zero

public static Vec2i Zero { get; }

Property Value

Vec2i

Methods

Add(int, int)

public Vec2i Add(int dx, int dy)

Parameters

dx int
dy int

Returns

Vec2i

Copy()

public Vec2i Copy()

Returns

Vec2i

Equals(object)

Determines whether the specified object is equal to the current object.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

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

Equals(Vec2i)

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

public bool Equals(Vec2i other)

Parameters

other Vec2i

An object to compare with this object.

Returns

bool

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

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

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 Vec2i Set(int x, int y)

Parameters

x int
y int

Returns

Vec2i

Set(Vec2i)

public Vec2i Set(Vec2i vec)

Parameters

vec Vec2i

Returns

Vec2i

ToChunkIndex()

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

public ulong ToChunkIndex()

Returns

ulong

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

Operators

operator +(Vec2i, int)

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

Parameters

left Vec2i
right int

Returns

Vec2i

operator +(Vec2i, Vec2i)

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

Parameters

left Vec2i
right Vec2i

Returns

Vec2i

operator /(Vec2i, int)

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

Parameters

left Vec2i
right int

Returns

Vec2i

operator /(Vec2i, float)

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

Parameters

left Vec2i
right float

Returns

Vec2i

operator ==(Vec2i, Vec2i)

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

Parameters

left Vec2i
right Vec2i

Returns

bool

operator !=(Vec2i, Vec2i)

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

Parameters

left Vec2i
right Vec2i

Returns

bool

operator *(double, Vec2i)

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

Parameters

left double
right Vec2i

Returns

Vec2i

operator *(int, Vec2i)

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

Parameters

left int
right Vec2i

Returns

Vec2i

operator *(Vec2i, double)

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

Parameters

left Vec2i
right double

Returns

Vec2i

operator *(Vec2i, int)

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

Parameters

left Vec2i
right int

Returns

Vec2i

operator *(Vec2i, Vec2i)

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

Parameters

left Vec2i
right Vec2i

Returns

double

operator -(int, Vec2i)

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

Parameters

left int
right Vec2i

Returns

Vec2i

operator -(Vec2i, int)

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

Parameters

left Vec2i
right int

Returns

Vec2i

operator -(Vec2i, Vec2i)

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

Parameters

left Vec2i
right Vec2i

Returns

Vec2i