Struct VectorInt
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
Properties
Magnitude
Gets the magnitude (length) of the vector.
public float Magnitude { get; }
Property Value
Normalized
Gets the normalized (unit-length) vector as a Vector.
public Vector Normalized { get; }
Property Value
X
Gets the X component of the vector.
public int X { get; }
Property Value
Y
Gets the Y component of the vector.
public int Y { get; }
Property Value
Methods
Equals(object)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand 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
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
Returns
- Vector
The resulting vector.
operator ==(VectorInt, VectorInt)
Determines whether two VectorInt instances are equal.
public static bool operator ==(VectorInt v1, VectorInt v2)
Parameters
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
Returns
operator !=(VectorInt, VectorInt)
Determines whether two VectorInt instances are not equal.
public static bool operator !=(VectorInt v1, VectorInt v2)
Parameters
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
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
Returns
- Vector
The scaled vector.
operator -(VectorInt, VectorInt)
Subtracts one integer vector from another.
public static VectorInt operator -(VectorInt v1, VectorInt v2)
Parameters
Returns
- VectorInt
The difference as an integer vector.
operator -(VectorInt)
Negates an integer vector.
public static VectorInt operator -(VectorInt v)
Parameters
vVectorIntThe vector to negate.
Returns
- VectorInt
The negated integer vector.