Vec2I

Description

struct Tinman.Core.Math.Vectors.Vec2I

A two-dimensional vector with 32-bit integer precision.

/     \
|  X  |
|  Y  |
\     /

Public / Constants

Zero


public static readonly attribute Zero → (Vec2I)

The zero vector.

Public / Constructors

Vec2​I


public constructor Vec2I → (2)

in : int32

X-coordinate of vector.

in : int32

Y-coordinate of vector.

Creates a new instance of Vec2I.

Public / Methods

Add

2 overloads


[Pure]
public method Add1 → (1)

in : Vec2I

The vector.

returns → Vec2I

The resulting vector.

Adds this vector and the given one.


[Pure]
public method Add2 → (2)

in : int32

X-component of vector.

in : int32

Y-component of vector.

returns → Vec2I

The resulting vector.

Adds this vector and the given one.

Choose


[Pure]
public method Choose → (2)

idx in : int32

The zero-based component index.

opt : int32 = 0

The value to return if idx in is out of range.

returns → int32

The resulting vector.

Chooses a component of this vector.

Cross

3 overloads


[Pure]
public method Cross1 → (1)

in : int32

Z-component of vector (X- and Y-components are zero).

returns → Vec2I

The cross product vector.

Computes the cross product between this vector and the given one: this x other.


[Pure]
public method Cross2 → (1)

in : Vec2I

The other vector.

returns → int32

The Z-component of the cross product vector (X- and Y-components are zero).

Computes the cross product between this vector and the given one: this x other.


[Pure]
public method Cross3 → (2)

in : int32

X-component of vector.

in : int32

Y-component of vector.

returns → int32

The Z-component of the cross product vector (X- and Y-components are zero).

Computes the cross product between this vector and the given one: this x other.

Dot

2 overloads


[Pure]
public method Dot1 → (1)

in : Vec2I

The vector.

returns → int32

The resulting vector.

Computes the dot product between this vector and the given one.


[Pure]
public method Dot2 → (2)

in : int32

X-component of vector.

in : int32

Y-component of vector.

returns → int32

The resulting vector.

Computes the dot product between this vector and the given one.

Equals

2 overloads


[Pure]
public method Equals2 → (2)

in : int32

X-component of vector.

in : int32

Y-component of vector.

returns → bool

true if both vectors are equal, false if they are not.

Checks if this vector and the given one are equal.

Max

2 overloads


[Pure]
public method Max1 → (1)

in : Vec2I

The vector.

returns → Vec2I

The resulting vector.

Computes the component-wise maximum of this vector and the given one.


[Pure]
public method Max2 → (2)

in : int32

X-component of vector.

in : int32

Y-component of vector.

returns → Vec2I

The resulting vector.

Computes the component-wise maximum of this vector and the given one.

Min

2 overloads


[Pure]
public method Min1 → (1)

in : Vec2I

The vector.

returns → Vec2I

The resulting vector.

Computes the component-wise minimum of this vector and the given one.


[Pure]
public method Min2 → (2)

in : int32

X-component of vector.

in : int32

Y-component of vector.

returns → Vec2I

The resulting vector.

Computes the component-wise minimum of this vector and the given one.

Mul

3 overloads


[Pure]
public method Mul1 → (1)

in : Vec2I

The vector.

returns → Vec2I

The resulting vector.

Multiplies this vector with the given one.


[Pure]
public method Mul2 → (2)

in : int32

X-component of vector.

in : int32

Y-component of vector.

returns → Vec2I

The resulting vector.

Multiplies this vector with the given one.


[Pure]
public method Mul3 → (1)

in : int32

The scalar value.

returns → Vec2I

The resulting vector.

Multiplies this vector with the given scalar value.

Neg


[Pure]
public method Neg → ()

returns → Vec2I

The resulting vector.

Negates this vector.

Shift​Left


[Pure]
public method ShiftLeft → (1)

in : int32

The shift amount.

returns → Vec2I

The resulting vector.

Performs a left bit shift on each component of this vector.

Shift​Right


[Pure]
public method ShiftRight → (1)

in : int32

The shift amount.

returns → Vec2I

The resulting vector.

Performs a right bit shift on each component of this vector.

Sub

2 overloads


[Pure]
public method Sub1 → (1)

in : Vec2I

The vector.

returns → Vec2I

The resulting vector.

Subtracts the given vector from this one.


[Pure]
public method Sub2 → (2)

in : int32

X-component of vector.

in : int32

Y-component of vector.

returns → Vec2I

The resulting vector.

Subtracts the given vector from this one.

To​String

2 overloads


[Pure]
public method ToString2 → (1)

flags in : FormatFlags

The format flags to use.

returns → string

The string representation.

Returns the string representation of this vector.

See also

Format.ThisInt

Public / Attributes

Length


public attribute Length → (get)

value : float64

[>=0]
The vector length.

Returns the length of this vector.

Length​Sqr


public attribute LengthSqr → (get)

value : float64

[>=0]
The squared vector length.

Returns the squared length of this vector.

X


public readonly attribute X → (int32)

X-coordinate of vector.

Y


public readonly attribute Y → (int32)

Y-coordinate of vector.

Serialization

Serializer


public static readonly attribute Serializer → (ITypeSerializerEx<Vec2I>)

The serialization helper object for values of Vec2I.