Table of Contents

Struct Vector2

Namespace
NominalSystems
Assembly
NominalSystems.Core.dll

Represents a vector or array of 2 numbers (or a matrix with 1 row or 1 column).


public struct Vector2 : IEnumerable<double>, IEnumerable
Implements

Constructors

Vector2()

Creates a zero-initialized vector.

public Vector2()

Vector2(in Vector2)

Creates a deep-copy from another vector.

public Vector2(in Vector2 a)

Parameters

a Vector2

Vector2(in double)

Creates a value-initialized vector.

public Vector2(in double a)

Parameters

a double

Vector2(in double, in double)

Creates and initializes all vector values.

public Vector2(in double x, in double y)

Parameters

x double
y double

Fields

X

The vector's 1st value.

public double X

Field Value

double

Y

The vector's 2nd value.

public double Y

Field Value

double

Properties

Length

A number representing the length/magnitude of the vector.

public readonly double Length { get; }

Property Value

double

Length2

A number representing the squared length/magnitude of the vector.

public readonly double Length2 { get; }

Property Value

double

Normalized

A vector representing the same vector with a length/magnitude of 1.

public readonly Vector2 Normalized { get; }

Property Value

Vector2

One

A vector with all values initialized with 1's.

public static Vector2 One { get; }

Property Value

Vector2

Zero

A vector with all values initialized with 0's.

public static Vector2 Zero { get; }

Property Value

Vector2

Methods

Equals(object)

public override readonly bool Equals(object obj)

Parameters

obj object

Returns

bool

Equals(object, in double)

public readonly bool Equals(object obj, in double precision)

Parameters

obj object

The object to compare.

precision double

The precision error.

Returns

bool

GetEnumerator()

public readonly IEnumerator<double> GetEnumerator()

Returns

IEnumerator<double>

GetHashCode()

public override readonly int GetHashCode()

Returns

int

ToString()

public override readonly string ToString()

Returns

string

ToString(string)

public readonly string ToString(string fmt)

Parameters

fmt string

A numeric format string.

Returns

string

Operators

operator +(in Vector2, in Vector2)

Returns the addition of a vector with another vector.

public static Vector2 operator +(in Vector2 a, in Vector2 b)

Parameters

a Vector2
b Vector2

Returns

Vector2

operator +(in Vector2, in double)

Returns the addition of a vector with a number.

public static Vector2 operator +(in Vector2 a, in double b)

Parameters

a Vector2
b double

Returns

Vector2

operator +(in double, in Vector2)

Returns the addition of a number with a vector.

public static Vector2 operator +(in double a, in Vector2 b)

Parameters

a double
b Vector2

Returns

Vector2

operator /(in Vector2, in Vector2)

Returns the division of a vector with another vector.

public static Vector2 operator /(in Vector2 a, in Vector2 b)

Parameters

a Vector2
b Vector2

Returns

Vector2

operator /(in Vector2, in double)

Returns the division of a vector with a number.

public static Vector2 operator /(in Vector2 a, in double b)

Parameters

a Vector2
b double

Returns

Vector2

operator /(in double, in Vector2)

Returns the division of a number with a vector.

public static Vector2 operator /(in double a, in Vector2 b)

Parameters

a double
b Vector2

Returns

Vector2

operator ==(in Vector2, in Vector2)

Returns true if all values in a vector are equal to another vector.

public static bool operator ==(in Vector2 a, in Vector2 b)

Parameters

a Vector2
b Vector2

Returns

bool

operator ==(in Vector2, in double)

Returns true if all values in a vector are equal to a number.

public static bool operator ==(in Vector2 a, in double b)

Parameters

a Vector2
b double

Returns

bool

operator ==(in double, in Vector2)

Returns true if a number is equal to all values in a vector.

public static bool operator ==(in double a, in Vector2 b)

Parameters

a double
b Vector2

Returns

bool

operator >(in Vector2, in double)

Returns true if all values in a vector are greater than a number.

public static bool operator >(in Vector2 a, in double b)

Parameters

a Vector2
b double

Returns

bool

operator >(in double, in Vector2)

Returns true if a number is greater than all values in a vector.

public static bool operator >(in double a, in Vector2 b)

Parameters

a double
b Vector2

Returns

bool

operator >=(in Vector2, in double)

Returns true if all values in a vector are greater than or equal to a number.

public static bool operator >=(in Vector2 a, in double b)

Parameters

a Vector2
b double

Returns

bool

operator >=(in double, in Vector2)

Returns true if a number is greater than or equal to all values in a vector.

public static bool operator >=(in double a, in Vector2 b)

Parameters

a double
b Vector2

Returns

bool

operator !=(in Vector2, in Vector2)

Returns true if all values in a vector are not equal to another vector.

public static bool operator !=(in Vector2 a, in Vector2 b)

Parameters

a Vector2
b Vector2

Returns

bool

operator !=(in Vector2, in double)

Returns true if all values in a vector are not equal to a number.

public static bool operator !=(in Vector2 a, in double b)

Parameters

a Vector2
b double

Returns

bool

operator !=(in double, in Vector2)

Returns true if a number is not equal to all values in a vector.

public static bool operator !=(in double a, in Vector2 b)

Parameters

a double
b Vector2

Returns

bool

operator <(in Vector2, in double)

Returns true if all values in a vector are less than a number.

public static bool operator <(in Vector2 a, in double b)

Parameters

a Vector2
b double

Returns

bool

operator <(in double, in Vector2)

Returns true if a number is less than all values in a vector.

public static bool operator <(in double a, in Vector2 b)

Parameters

a double
b Vector2

Returns

bool

operator <=(in Vector2, in double)

Returns true if all values in a vector are less than or equal to a number.

public static bool operator <=(in Vector2 a, in double b)

Parameters

a Vector2
b double

Returns

bool

operator <=(in double, in Vector2)

Returns true if a number is less than or equal to all values in a vector.

public static bool operator <=(in double a, in Vector2 b)

Parameters

a double
b Vector2

Returns

bool

operator *(in Vector2, in Vector2)

Returns the multiplication of a vector with another vector.

public static Vector2 operator *(in Vector2 a, in Vector2 b)

Parameters

a Vector2
b Vector2

Returns

Vector2

operator *(in Vector2, in double)

Returns the multiplication of a vector with a number.

public static Vector2 operator *(in Vector2 a, in double b)

Parameters

a Vector2
b double

Returns

Vector2

operator *(in double, in Vector2)

Returns the multiplication of a number with a vector.

public static Vector2 operator *(in double a, in Vector2 b)

Parameters

a double
b Vector2

Returns

Vector2

operator -(in Vector2, in Vector2)

Returns the subtraction of a vector with another vector.

public static Vector2 operator -(in Vector2 a, in Vector2 b)

Parameters

a Vector2
b Vector2

Returns

Vector2

operator -(in Vector2, in double)

Returns the subtraction of a vector with a number.

public static Vector2 operator -(in Vector2 a, in double b)

Parameters

a Vector2
b double

Returns

Vector2

operator -(in double, in Vector2)

Returns the subtraction of a number with a vector.

public static Vector2 operator -(in double a, in Vector2 b)

Parameters

a double
b Vector2

Returns

Vector2

operator -(in Vector2)

Returns the negation of all values in a vector.

public static Vector2 operator -(in Vector2 a)

Parameters

a Vector2

Returns

Vector2