Generated by DocFX

Class Vector

Vector represents list of doubles.

Inheritance
System.Object
System.Collections.Generic.List<System.Double>
Vector
Inherited Members
System.Collections.Generic.List<System.Double>.System.Collections.IList.get_Item(System.Int32)
System.Collections.Generic.List<System.Double>.System.Collections.IList.set_Item(System.Int32, System.Object)
System.Collections.Generic.List<System.Double>.Add(System.Double)
System.Collections.Generic.List<System.Double>.AddRange(System.Collections.Generic.IEnumerable<System.Double>)
System.Collections.Generic.List<System.Double>.AsReadOnly()
System.Collections.Generic.List<System.Double>.BinarySearch(System.Int32, System.Int32, System.Double, System.Collections.Generic.IComparer<System.Double>)
System.Collections.Generic.List<System.Double>.BinarySearch(System.Double)
System.Collections.Generic.List<System.Double>.BinarySearch(System.Double, System.Collections.Generic.IComparer<System.Double>)
System.Collections.Generic.List<System.Double>.Clear()
System.Collections.Generic.List<System.Double>.Contains(System.Double)
System.Collections.Generic.List<System.Double>.ConvertAll<TOutput>(System.Converter<System.Double, TOutput>)
System.Collections.Generic.List<System.Double>.CopyTo(System.Int32, System.Double[], System.Int32, System.Int32)
System.Collections.Generic.List<System.Double>.CopyTo(System.Double[])
System.Collections.Generic.List<System.Double>.CopyTo(System.Double[], System.Int32)
System.Collections.Generic.List<System.Double>.Exists(System.Predicate<System.Double>)
System.Collections.Generic.List<System.Double>.Find(System.Predicate<System.Double>)
System.Collections.Generic.List<System.Double>.FindAll(System.Predicate<System.Double>)
System.Collections.Generic.List<System.Double>.FindIndex(System.Int32, System.Int32, System.Predicate<System.Double>)
System.Collections.Generic.List<System.Double>.FindIndex(System.Int32, System.Predicate<System.Double>)
System.Collections.Generic.List<System.Double>.FindIndex(System.Predicate<System.Double>)
System.Collections.Generic.List<System.Double>.FindLast(System.Predicate<System.Double>)
System.Collections.Generic.List<System.Double>.FindLastIndex(System.Int32, System.Int32, System.Predicate<System.Double>)
System.Collections.Generic.List<System.Double>.FindLastIndex(System.Int32, System.Predicate<System.Double>)
System.Collections.Generic.List<System.Double>.FindLastIndex(System.Predicate<System.Double>)
System.Collections.Generic.List<System.Double>.ForEach(System.Action<System.Double>)
System.Collections.Generic.List<System.Double>.GetEnumerator()
System.Collections.Generic.List<System.Double>.GetRange(System.Int32, System.Int32)
System.Collections.Generic.List<System.Double>.IndexOf(System.Double)
System.Collections.Generic.List<System.Double>.IndexOf(System.Double, System.Int32)
System.Collections.Generic.List<System.Double>.IndexOf(System.Double, System.Int32, System.Int32)
System.Collections.Generic.List<System.Double>.Insert(System.Int32, System.Double)
System.Collections.Generic.List<System.Double>.InsertRange(System.Int32, System.Collections.Generic.IEnumerable<System.Double>)
System.Collections.Generic.List<System.Double>.LastIndexOf(System.Double)
System.Collections.Generic.List<System.Double>.LastIndexOf(System.Double, System.Int32)
System.Collections.Generic.List<System.Double>.LastIndexOf(System.Double, System.Int32, System.Int32)
System.Collections.Generic.List<System.Double>.Remove(System.Double)
System.Collections.Generic.List<System.Double>.RemoveAll(System.Predicate<System.Double>)
System.Collections.Generic.List<System.Double>.RemoveAt(System.Int32)
System.Collections.Generic.List<System.Double>.RemoveRange(System.Int32, System.Int32)
System.Collections.Generic.List<System.Double>.Reverse()
System.Collections.Generic.List<System.Double>.Reverse(System.Int32, System.Int32)
System.Collections.Generic.List<System.Double>.Sort()
System.Collections.Generic.List<System.Double>.Sort(System.Collections.Generic.IComparer<System.Double>)
System.Collections.Generic.List<System.Double>.Sort(System.Comparison<System.Double>)
System.Collections.Generic.List<System.Double>.Sort(System.Int32, System.Int32, System.Collections.Generic.IComparer<System.Double>)
System.Collections.Generic.List<System.Double>.System.Collections.Generic.IEnumerable<System.Double>.GetEnumerator()
System.Collections.Generic.List<System.Double>.System.Collections.ICollection.CopyTo(System.Array, System.Int32)
System.Collections.Generic.List<System.Double>.System.Collections.IEnumerable.GetEnumerator()
System.Collections.Generic.List<System.Double>.System.Collections.IList.Add(System.Object)
System.Collections.Generic.List<System.Double>.System.Collections.IList.Contains(System.Object)
System.Collections.Generic.List<System.Double>.System.Collections.IList.IndexOf(System.Object)
System.Collections.Generic.List<System.Double>.System.Collections.IList.Insert(System.Int32, System.Object)
System.Collections.Generic.List<System.Double>.System.Collections.IList.Remove(System.Object)
System.Collections.Generic.List<System.Double>.ToArray()
System.Collections.Generic.List<System.Double>.TrimExcess()
System.Collections.Generic.List<System.Double>.TrueForAll(System.Predicate<System.Double>)
System.Collections.Generic.List<System.Double>.Capacity
System.Collections.Generic.List<System.Double>.Count
System.Collections.Generic.List<System.Double>.Item[System.Int32]
System.Collections.Generic.List<System.Double>.System.Collections.Generic.ICollection<System.Double>.IsReadOnly
System.Collections.Generic.List<System.Double>.System.Collections.ICollection.IsSynchronized
System.Collections.Generic.List<System.Double>.System.Collections.ICollection.SyncRoot
System.Collections.Generic.List<System.Double>.System.Collections.IList.IsFixedSize
System.Collections.Generic.List<System.Double>.System.Collections.IList.IsReadOnly
System.Collections.Generic.List<System.Double>.System.Collections.IList.Item[System.Int32]
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Syntax
public class Vector : List<double>, IList<double>, ICollection<double>, IReadOnlyList<double>, IReadOnlyCollection<double>, IEnumerable<double>, IList, ICollection, IEnumerable, IEquatable<Vector>
Examples
var vec1 = new Vector { 20, 0, 0 };
var vec2 = new Vector { -10, 15, 5 };

Constructors

| Improve this Doc View Source

Vector()

Default constructor.

Declaration
public Vector()
| Improve this Doc View Source

Vector(IEnumerable<Double>)

Vector3 initialized by a list of values.

Declaration
public Vector(IEnumerable<double> values)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<System.Double> values

List of values.

Methods

| Improve this Doc View Source

AddMulMutate(Vector, Double, Vector)

Adds to each component of the first vector the respective component of the second vector multiplied by a scalar.

Declaration
public static void AddMulMutate(Vector a, double s, Vector b)
Parameters
Type Name Description
Vector a

First vector.

System.Double s

Scalar value.

Vector b

Second vector.

| Improve this Doc View Source

Dot(Vector, Vector)

Computes the dot product between two vectors.

Declaration
public static double Dot(Vector a, Vector b)
Parameters
Type Name Description
Vector a

The first vector.

Vector b

The second vector with which compute the dot product.

Returns
Type Description
System.Double

The dot product.

| Improve this Doc View Source

Equals(Vector)

Checks if the two vectors are the same.
Two vectors are the same, if all components of the two vectors are within Epsilon.

Declaration
public bool Equals(Vector other)
Parameters
Type Name Description
Vector other

The vector to test.

Returns
Type Description
System.Boolean

True if are the same, otherwise false.

| Improve this Doc View Source

Equals(Object)

Checks if the two vectors are the same.
Two vectors are the same, if all components of the two vectors are within Epsilon.

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj

The vector to test.

Returns
Type Description
System.Boolean

True if are the same, otherwise false.

Overrides
System.Object.Equals(System.Object)
| Improve this Doc View Source

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32
Overrides
System.Object.GetHashCode()
| Improve this Doc View Source

IsValid()

Gets a value indicating whether this vector is valid.
A valid vector must be formed of finite numbers.

Declaration
public bool IsValid()
Returns
Type Description
System.Boolean

True if the vector is valid.

| Improve this Doc View Source

IsZero()

Gets a value indicating whether the X, Y, and Z values are all equal to 0.0.

Declaration
public bool IsZero()
Returns
Type Description
System.Boolean

True if all the component are less than Epsilon.

| Improve this Doc View Source

Length()

Computes the length (or magnitude, or size) of this vector.

Declaration
public double Length()
Returns
Type Description
System.Double

The magnitude of the vector.

| Improve this Doc View Source

Reverse(Vector)

Reverses this vector in place (reverses the direction).

Declaration
public static Vector Reverse(Vector a)
Parameters
Type Name Description
Vector a

The vector to reverse.

Returns
Type Description
Vector

The reversed vector.

| Improve this Doc View Source

SquaredLength()

Computes the squared length (or magnitude, or size) of this vector.

Declaration
public double SquaredLength()
Returns
Type Description
System.Double

The sum of each value squared.

| Improve this Doc View Source

SubMulMutate(Vector, Double, Vector)

Subtracts to each component of the first vector the respective component of the second vector multiplied by a scalar.

Declaration
public static void SubMulMutate(Vector a, double s, Vector b)
Parameters
Type Name Description
Vector a

First vector.

System.Double s

Scalar value.

Vector b

Second vector.

| Improve this Doc View Source

ToString()

Constructs the string representation of the vector.

Declaration
public override string ToString()
Returns
Type Description
System.String

The vector in string format.

Overrides
System.Object.ToString()
| Improve this Doc View Source

Zero1d(Int32)

Creates a list of zero values.

Declaration
public static Vector Zero1d(int rows)
Parameters
Type Name Description
System.Int32 rows

Rows dimension.

Returns
Type Description
Vector

Get a vector of r dimension.

| Improve this Doc View Source

Zero2d(Int32, Int32)

Creates a 2 dimensional list of zero values.

Declaration
public static List<Vector> Zero2d(int rows, int cols)
Parameters
Type Name Description
System.Int32 rows

Rows dimension.

System.Int32 cols

Columns dimension.

Returns
Type Description
System.Collections.Generic.List<Vector>

Get a vector of r*c dimension.

| Improve this Doc View Source

Zero3d(Int32, Int32, Int32)

Creates a 3 dimensional list of zero values.

Declaration
public static List<List<Vector>> Zero3d(int rows, int cols, int depth)
Parameters
Type Name Description
System.Int32 rows

Rows dimension.

System.Int32 cols

Columns dimension.

System.Int32 depth

Depth dimension.

Returns
Type Description
System.Collections.Generic.List<System.Collections.Generic.List<Vector>>

Get a vector of rcd dimension.

Operators

| Improve this Doc View Source

Addition(Vector, Vector)

Adds two vectors.

Declaration
public static Vector operator +(Vector a, Vector b)
Parameters
Type Name Description
Vector a

The first vector.

Vector b

The second vector.

Returns
Type Description
Vector

A vector which is the sum of a and b.

| Improve this Doc View Source

Division(Vector, Double)

Divides a vector by a scalar.

Declaration
public static Vector operator /(Vector v, double a)
Parameters
Type Name Description
Vector v

The vector to divide.

System.Double a

The scalar divisor.

Returns
Type Description
Vector

A vector whose magnitude is multiplied by a.

| Improve this Doc View Source

Equality(Vector, Vector)

Checks if the two vectors are the same.
Two vectors are the same, if all components of the two vectors are within Epsilon.

Declaration
public static bool operator ==(Vector a, Vector b)
Parameters
Type Name Description
Vector a

First vector.

Vector b

Second vector.

Returns
Type Description
System.Boolean

True if are the same, otherwise false.

| Improve this Doc View Source

Inequality(Vector, Vector)

Checks if the two vectors are the same.
Two vectors are the same, if all components of the two vectors are within Epsilon.

Declaration
public static bool operator !=(Vector a, Vector b)
Parameters
Type Name Description
Vector a

First vector.

Vector b

Second vector.

Returns
Type Description
System.Boolean

True if are the same, otherwise false.

| Improve this Doc View Source

Multiply(Vector, Matrix)

Multiplying an n x m matrix by a m x 1. Transform the vector.

Declaration
public static Vector operator *(Vector v, Matrix m)
Parameters
Type Name Description
Vector v

Vector to transform.

Matrix m

Matrix to multiply.

Returns
Type Description
Vector

Vector resulting of multiplying an n x m matrix by a m x 1.

| Improve this Doc View Source

Multiply(Vector, Double)

Multiply a vector and a scalar.

Declaration
public static Vector operator *(Vector v, double a)
Parameters
Type Name Description
Vector v

The vector to multiply.

System.Double a

The scalar value to multiply.

Returns
Type Description
Vector

A vector whose magnitude is multiplied by a.

| Improve this Doc View Source

Subtraction(Vector, Vector)

Subtracts two vectors.

Declaration
public static Vector operator -(Vector a, Vector b)
Parameters
Type Name Description
Vector a

The first vector.

Vector b

The second vector.

Returns
Type Description
Vector

A vector which is the difference between a and b.

Implements

System.Collections.Generic.IList<T>
System.Collections.Generic.ICollection<T>
System.Collections.Generic.IReadOnlyList<T>
System.Collections.Generic.IReadOnlyCollection<T>
System.Collections.Generic.IEnumerable<T>
System.Collections.IList
System.Collections.ICollection
System.Collections.IEnumerable
System.IEquatable<T>

Extension Methods

ExtendedEnumerable.ToVector(IEnumerable<Double>)
ExtendedEnumerable.ToKnot(IEnumerable<Double>)
ExtendedEnumerable.Unique<T>(IEnumerable<T>, Func<T, T, Boolean>)