Skip to main content

Motion Standalone Postprocessor C# library 2024 R2

Struct Vector

Last update: 03.07.2024

Namespace: VM
Assembly: VM.dll

public struct Vector

Constructors

Vector(Vector)

Initializes a new instance of the class.

public Vector(Vector vec)

Parameters

vec Vector

The Vector instance to copy.

Vector(double, double, double)

Initializes a new instance of the class.

public Vector(double dX, double dY, double dZ)

Parameters

dX double

The X.

dY double

The Y.

dZ double

The Z.

Vector(double[])

Initializes a new instance of the class.

public Vector(double[] arVec)

Parameters

arVec double[]

The arVec.

Vector(double[], int)

Initializes a new instance of the class.

public Vector(double[] arVec, int nStartIndex)

Parameters

arVec double[]

The array that have values of vector.

nStartIndex int

The start index of array.

Vector(string)

public Vector(string vector)

Parameters

vector string

Properties

Magnitude

Gets the magnitude of vector.

public double Magnitude { get; }

Property Value

double

Exceptions

InvalidOperationException

The get magnitude operation failed .

X

Gets or sets the X of vector.

public double X { get; set; }

Property Value

double

Y

Gets or sets the Y of vector.

public double Y { get; set; }

Property Value

double

Z

Gets or sets the Z of vector.

public double Z { get; set; }

Property Value

double

this[int]

Gets or sets the element of vector.

public double this[int nIndex] { get; set; }

Property Value

double

this[Coordinate]

Gets or sets the element of vector.

public double this[Coordinate enCoord] { get; set; }

Property Value

double

Methods

CopyToArray(Vector[], double[])

Copy all values in the array of vector to the array of double.

public static void CopyToArray(Vector[] arVec, double[] arTarget)

Parameters

arVec Vector[]

The array of vector

arTarget double[]

The array to store values of the array of vector.

CopyToArray(Vector[], double[], int)

Copy all values in the array of vector to the array of double.

public static void CopyToArray(Vector[] arVec, double[] arTarget, int nIndex)

Parameters

arVec Vector[]

The array of vector

arTarget double[]

The array to store values of the array of vector.

nIndex int

The start index of array

CrossProduct(Vector)

Cross product.

public Vector CrossProduct(Vector vec)

Parameters

vec Vector

The vec.

Returns

Vector

Result of product

DotProduct(Vector)

Dot product.

public double DotProduct(Vector vec)

Parameters

vec Vector

The vec.

Returns

double

Result of product

Equals(object)

Determines whether the specified object is equal to the current object.

public override bool Equals(object obj)

Parameters

obj object

The object to compare.

Returns

bool

true if the objects are equal, otherwise false.

GetArray()

Gets the array.

public double[] GetArray()

Returns

double[]

The array.

GetDistance(Vector)

Gets the distance.

public double GetDistance(Vector vec)

Parameters

vec Vector

The vec.

Returns

double

The distance

Exceptions

InvalidOperationException

The get distance operation failed .

GetHashCode()

Returns the hash code for this vector

public override int GetHashCode()

Returns

int

A 32-bit signed integer hash code.

GetOrthoVector()

Gets the ortho vector.

public Vector GetOrthoVector()

Returns

Vector

The ortho vector.

GetOrthoVector(Vector)

Gets the ortho vector.

public Vector GetOrthoVector(Vector vecCandidate)

Parameters

vecCandidate Vector

The candidate.

Returns

Vector

The ortho vector.

Exceptions

InvalidOperationException

The get ortho vector operation failed .

Initialize()

Initialize the Vector

public void Initialize()

IsValidFormat(string)

public static bool IsValidFormat(string vector)

Parameters

vector string

Returns

bool

MakeUnitVector()

Mate unit vector.

public void MakeUnitVector()

Exceptions

InvalidOperationException

The make unit vector operation failed .

Set(Vector)

Sets the value of vector.

public void Set(Vector vec)

Parameters

vec Vector

The Vector instance to copy.

Set(double[])

Sets the value of vector.

public void Set(double[] arVec)

Parameters

arVec double[]

The array of X, Y, Z Components.

Set(double[], int)

Sets the value of vector.

public void Set(double[] arVec, int nStartIndex)

Parameters

arVec double[]

The array of X, Y, Z Components.

nStartIndex int

The start index of array.

Set(double, double, double)

Sets the value of vector.

public void Set(double dX, double dY, double dZ)

Parameters

dX double

The X.

dY double

The Y.

dZ double

The Z.

ToString()

Returns a string that represents the current type.

public override string ToString()

Returns

string

A string that represents the current object.

Operators

operator +(Vector, Vector)

Add two vectors.

public static Vector operator +(Vector vecLeft, Vector vecRight)

Parameters

vecLeft Vector

The left vector to add

vecRight Vector

The right vector to add

Returns

Vector

The added vector.

operator /(Vector, double)

Divide value to the vector.

public static Vector operator /(Vector vec, double dValue)

Parameters

vec Vector

The vector to divide value

dValue double

The value to divide

Returns

Vector

The divided vector.

operator ==(Vector, Vector)

Compare two vectors are same or not

public static bool operator ==(Vector vecLeft, Vector vecRight)

Parameters

vecLeft Vector

The left vector to compare

vecRight Vector

The right vector to compare

Returns

bool

true if two vectors are same, otherwise false.

operator !=(Vector, Vector)

Compare two vectors are same or not

public static bool operator !=(Vector vecLeft, Vector vecRight)

Parameters

vecLeft Vector

The left vector to compare

vecRight Vector

The right vector to compare

Returns

bool

true if two vectors are not same, otherwise false.

operator *(Vector, Vector)

Cross product two vectors.

public static Vector operator *(Vector vecLeft, Vector vecRight)

Parameters

vecLeft Vector

The left vector to cross product

vecRight Vector

The right vector to cross product

Returns

Vector

The cross product vector.

operator *(Vector, double)

Multiply value to the vector.

public static Vector operator *(Vector vec, double dValue)

Parameters

vec Vector

The vector to multiply value

dValue double

The value to multiply

Returns

Vector

The Multiplied vector.

operator -(Vector, Vector)

Subtract two vectors.

public static Vector operator -(Vector vecLeft, Vector vecRight)

Parameters

vecLeft Vector

The left vector to subtract

vecRight Vector

The right vector to subtract

Returns

Vector

The subtracted vector.