Struct Vector3C
- Namespace
- VirtualLabAPI.Core.Numerics
- Assembly
- VirtualLabAPI.dll
This class defines 3-dimensional vectors of complex numbers. The class saves the x-, y- and z-coordinate.
public struct Vector3C
- Inherited Members
Constructors
Vector3C(Complex, Complex, Complex)
Creates a Vector3C from three Complex values.
public Vector3C(Complex x, Complex y, Complex z)
Parameters
xComplexx-value of new Vector3C object.
yComplexy-value of new Vector3C object.
zComplexz-value of new Vector3C object.
Vector3C(Vector3C)
Copy constructor.
public Vector3C(Vector3C vec)
Parameters
vecVector3CVector3C object to copy.
Fields
UnitVectorX
A constant containing the unit vector in x-direction.
public static readonly Vector3C UnitVectorX
Field Value
UnitVectorY
A constant containing the unit vector in y-direction.
public static readonly Vector3C UnitVectorY
Field Value
UnitVectorZ
A constant containing the unit vector in z-direction.
public static readonly Vector3C UnitVectorZ
Field Value
X
x-value of the Vector3C object.
public Complex X
Field Value
Y
y-value of the Vector3C object.
public Complex Y
Field Value
Z
z-value of the Vector3C object.
public Complex Z
Field Value
ZeroVector
A constant containing the zero vector (0, 0).
public static readonly Vector3C ZeroVector
Field Value
Properties
Im
Sets or gets a Vector3D object containing the imaginary part of the x-, y- and z- components of this Vector3C object.
public Vector3D Im { get; set; }
Property Value
IsUndefined
Gets whether a least one component of the vector is undefined.
public bool IsUndefined { get; }
Property Value
- bool
trueiff at least one component of the vector isNaN.
Re
Sets or gets a Vector3D object containing the real part of the x-, y- and z- components of this Vector3C object.
public Vector3D Re { get; set; }
Property Value
Methods
Abs()
Calculates the absolute value of this Vector3C object. The absolute value is defined as the square root of the Norm().
public double Abs()
Returns
- double
The absolute value of the Vector3C.
ComplexAbs()
Calculates the complex absolute value of the Vector3C object.
public Complex ComplexAbs()
Returns
- Complex
The complex absolute value of the vector.
CrossProduct(Vector3C, Vector3C)
Calculates the cross product of two Vector3C objects.
public static Vector3C CrossProduct(Vector3C a, Vector3C b)
Parameters
aVector3CFirst operant used for cross product calculation.
bVector3CSecond operant used for cross product calculation.
Returns
- Vector3C
A Vector3C object containing the cross product.
Equals(object)
This function compares the values of this vector and the vector given as parameter object for equality.
public override bool Equals(object vector3C)
Parameters
vector3CobjectVector3C to be compared.
Returns
- bool
Returns true if both object pointers are equal.
GetHashCode()
Returns a hash code for this instance.
public override int GetHashCode()
Returns
- int
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
IsRealVector()
Determines whether this vector is a pure real one, i.e. all imaginary parts are zero.
public bool IsRealVector()
Returns
- bool
Trueiff the imaginary parts of all vector components are zero.
Norm()
Calculates the norm of this Vector3C object.
The norm is defined as (X * Complex.Conjugate(X) + Y * Complex.Conjugate(Y) + Z * Complex.Conjugate(Z)).Re which is equal to the sum
of the norms of the vector components.
public double Norm()
Returns
- double
The norm of the Vector3C object.
Normalize()
Normalizes this Vector3C object.
public void Normalize()
ToString()
Converts a Vector3C into a string of format (X.Re + iX.Im; Y.Re + iY.Im; Z.Re + iZ.Im).
public override string ToString()
Returns
- string
String containing the Vector3C information.
Operators
operator +(Vector3C, Vector3C)
Adds two Vector3C objects.
public static Vector3C operator +(Vector3C a, Vector3C b)
Parameters
Returns
- Vector3C
Returns the sum of the two Vector3C objects.
operator |(Vector3C, Vector3C)
Calculates the scalar product of two Vector3C objects.
The scalar product is defined as a.X * b.X + a.Y * b.Y + a.Z * b.Z.
public static Complex operator |(Vector3C a, Vector3C b)
Parameters
Returns
- Complex
Scalar product of the two Vector3C objects.
operator /(Complex, Vector3C)
Performs a component-wise division of a double value and a Vector3C object.
The result is defined as new Vector3C(number / vector.X, number / vector.Y).
public static Vector3C operator /(Complex number, Vector3C vector)
Parameters
numberComplexThe double value to divide by the components of the Vector3C object.
vectorVector3CThe Vector3C object used as divisor.
Returns
- Vector3C
Returns the quotient of the double value and the Vector3C object.
operator /(Vector3C, Complex)
public static Vector3C operator /(Vector3C vector, Complex divisor)
Parameters
vectorVector3CThe Vector3C object to divide by the Complex value.
divisorComplexThe Complex value used as divisor.
Returns
- Vector3C
Returns the quotient of the Vector3C object and the Complex value.
operator /(Vector3C, Vector3C)
Performs a component-wise division of two Vector3C objects.
public static Vector3C operator /(Vector3C a, Vector3C b)
Parameters
aVector3CThe first Vector3C object to divide by parameter b.
bVector3CThe second Vector3C object used as divisor.
Returns
- Vector3C
Returns the quotient of the two Vector3C objects.
operator ==(Vector3C, Vector3C)
Compares two Vector3C for equality. The comparison will be done by comparing the values of the two x-, y- and z- components, respectively.
public static bool operator ==(Vector3C vector1, Vector3C vector2)
Parameters
vector1Vector3CFirst Vector3C object to compare.
vector2Vector3CSecond Vector3C object to compare.
Returns
- bool
Returns true if the two objects are equal.
implicit operator Vector3C(Vector3D)
public static implicit operator Vector3C(Vector3D vector3D)
Parameters
vector3DVector3DVector3D object to convert into a Vector3C object.
Returns
- Vector3C
The converted Vector3C object.
operator !=(Vector3C, Vector3C)
Compares two Vector3C for inequality. The comparison will be done by comparing the values of the two x-, y- and z- components, respectively.
public static bool operator !=(Vector3C vector1, Vector3C vector2)
Parameters
vector1Vector3CFirst Vector3C object to compare.
vector2Vector3CSecond Vector3C object to compare.
Returns
- bool
Returns true if the two objects are unequal.
operator *(Complex, Vector3C)
Multiplies a Vector3C object with a Complex value.
public static Vector3C operator *(Complex factor, Vector3C vector)
Parameters
Returns
- Vector3C
Returns the product of the Vector3C object and the Complex value.
operator *(Vector3C, Complex)
Multiplies a Vector3C object with a Complex value.
public static Vector3C operator *(Vector3C vector, Complex factor)
Parameters
Returns
- Vector3C
Returns the product of the Vector3C object and the Complex value.
operator *(Vector3C, Vector3C)
Multiplies two Vector3C objects.
public static Vector3C operator *(Vector3C a, Vector3C b)
Parameters
aVector3CThe first Vector3C object to multiply.
bVector3CThe second Vector3C object to multiply.
Returns
- Vector3C
Returns the product of the two Vector3C objects.
operator -(Vector3C, Vector3C)
Subtracts two Vector3C objects.
public static Vector3C operator -(Vector3C a, Vector3C b)
Parameters
aVector3CThe first Vector3C object to subtract from.
bVector3CThe second Vector3C object to subtract.
Returns
- Vector3C
Returns the difference of the two Vector3C objects.