Table of Contents

Class Vec2f

Namespace
Vintagestory.API.MathTools
Assembly
VintagestoryAPI.dll

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

[JsonObject(MemberSerialization.OptIn)]
[ProtoContract]
public class Vec2f
Inheritance
Vec2f
Derived
Inherited Members
Extension Methods

Constructors

Vec2f()

public Vec2f()

Vec2f(float, float)

public Vec2f(float x, float y)

Parameters

x float
y float

Vec2f(Size2i)

public Vec2f(Size2i size)

Parameters

size Size2i

Fields

X

The X element of the vector.

[JsonProperty]
[ProtoMember(1)]
public float X

Field Value

float

Y

The Y element of the vector.

[JsonProperty]
[ProtoMember(2)]
public float Y

Field Value

float

Zero

public static readonly Vec2f Zero

Field Value

Vec2f

Properties

A

public float A { get; }

Property Value

float

B

public float B { get; }

Property Value

float

Methods

Clone()

public Vec2f Clone()

Returns

Vec2f

Distance(float, float, float, float)

public static float Distance(float x1, float y1, float x2, float y2)

Parameters

x1 float
y1 float
x2 float
y2 float

Returns

float

DistanceTo(float, float)

public float DistanceTo(float x, float y)

Parameters

x float
y float

Returns

float

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.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

Length()

public float Length()

Returns

float

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

Operators

operator +(Vec2f, float)

public static Vec2f operator +(Vec2f left, float right)

Parameters

left Vec2f
right float

Returns

Vec2f

operator +(Vec2f, Vec2f)

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

Parameters

left Vec2f
right Vec2f

Returns

Vec2f

operator +(Vec2f, Vec2i)

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

Parameters

left Vec2f
right Vec2i

Returns

Vec2f

operator /(Vec2f, float)

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

Parameters

left Vec2f
right float

Returns

Vec2f

operator ==(Vec2f, Vec2f)

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

Parameters

left Vec2f
right Vec2f

Returns

bool

operator !=(Vec2f, Vec2f)

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

Parameters

left Vec2f
right Vec2f

Returns

bool

operator *(double, Vec2f)

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

Parameters

left double
right Vec2f

Returns

Vec2f

operator *(float, Vec2f)

public static Vec2f operator *(float left, Vec2f right)

Parameters

left float
right Vec2f

Returns

Vec2f

operator *(Vec2f, double)

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

Parameters

left Vec2f
right double

Returns

Vec2f

operator *(Vec2f, float)

public static Vec2f operator *(Vec2f left, float right)

Parameters

left Vec2f
right float

Returns

Vec2f

operator *(Vec2f, Vec2f)

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

Parameters

left Vec2f
right Vec2f

Returns

double

operator -(float, Vec2f)

public static Vec2f operator -(float left, Vec2f right)

Parameters

left float
right Vec2f

Returns

Vec2f

operator -(Vec2f, float)

public static Vec2f operator -(Vec2f left, float right)

Parameters

left Vec2f
right float

Returns

Vec2f

operator -(Vec2f, Vec2f)

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

Parameters

left Vec2f
right Vec2f

Returns

Vec2f