Table of Contents

Struct VectorInt

Namespace
Termule.Engine.Types
Assembly
Termule.Engine.dll

Two-dimensional integer vector.

[Serializable]
public readonly struct VectorInt
Inherited Members

Constructors

VectorInt(int, int)

Two-dimensional integer vector.

public VectorInt(int x = 0, int y = 0)

Parameters

x int

The X component of the vector.

y int

The Y component of the vector.

Properties

Magnitude

Gets the magnitude (length) of the vector.

public float Magnitude { get; }

Property Value

float

Normalized

Gets the normalized (unit-length) vector as a Vector.

public Vector Normalized { get; }

Property Value

Vector

X

Gets the X component of the vector.

public int X { get; }

Property Value

int

Y

Gets the Y component of the vector.

public int Y { get; }

Property Value

int

Methods

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.

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.

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

Operators

operator +(VectorInt, VectorInt)

Adds two integer vectors.

public static VectorInt operator +(VectorInt v1, VectorInt v2)

Parameters

v1 VectorInt

The first vector.

v2 VectorInt

The second vector.

Returns

VectorInt

The sum as an integer vector.

operator /(VectorInt, float)

Divides an integer vector by a scalar, returning a Vector.

public static Vector operator /(VectorInt v, float f)

Parameters

v VectorInt

The integer vector to divide.

f float

The scalar divisor.

Returns

Vector

The resulting vector.

operator ==(VectorInt, VectorInt)

Determines whether two VectorInt instances are equal.

public static bool operator ==(VectorInt v1, VectorInt v2)

Parameters

v1 VectorInt

The first VectorInt to compare.

v2 VectorInt

The second VectorInt to compare.

Returns

bool

true if the vectors are equal; otherwise, false.

implicit operator VectorInt((int x, int y))

Creates a VectorInt from a tuple of integers.

public static implicit operator VectorInt((int x, int y) t)

Parameters

t (int x, int y)

The component values to use.

Returns

VectorInt

operator !=(VectorInt, VectorInt)

Determines whether two VectorInt instances are not equal.

public static bool operator !=(VectorInt v1, VectorInt v2)

Parameters

v1 VectorInt

The first VectorInt to compare.

v2 VectorInt

The second VectorInt to compare.

Returns

bool

true if the vectors are not equal; otherwise, false.

operator *(float, VectorInt)

Multiplies an scalar by an integer vector, returning a Vector.

public static Vector operator *(float f, VectorInt v)

Parameters

f float

The scalar multiplier.

v VectorInt

The integer vector to scale.

Returns

Vector

The scaled vector.

operator *(VectorInt, float)

Multiplies an integer vector by a scalar, returning a Vector.

public static Vector operator *(VectorInt v, float f)

Parameters

v VectorInt

The integer vector to scale.

f float

The scalar multiplier.

Returns

Vector

The scaled vector.

operator -(VectorInt, VectorInt)

Subtracts one integer vector from another.

public static VectorInt operator -(VectorInt v1, VectorInt v2)

Parameters

v1 VectorInt

The first vector.

v2 VectorInt

The second vector.

Returns

VectorInt

The difference as an integer vector.

operator -(VectorInt)

Negates an integer vector.

public static VectorInt operator -(VectorInt v)

Parameters

v VectorInt

The vector to negate.

Returns

VectorInt

The negated integer vector.