Struct VectorL
- Namespace
- VirtualLabAPI.Core.Numerics
- Assembly
- VirtualLabAPI.dll
This struct defines a two-dimensional vector of long numbers. Operators \(a+b\), \(a-b\) and \(a|b\) (Scalar product) can be used. One operand on \(a*b\) and \(a/b\) can be an long too.
public struct VectorL
- Inherited Members
Constructors
VectorL(long, long)
public VectorL(long x, long y)
Parameters
Properties
X
Gets and sets the x-value of this VectorL object.
public long X { get; set; }
Property Value
Y
Gets and sets the y-value of this VectorL object.
public long Y { get; set; }
Property Value
Methods
Equals(object)
This function compares the values of this vector with vector given as parameter.
public override bool Equals(object obj)
Parameters
objobjectVectorL to be compared.
Returns
- bool
Returns true if both values 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.
ToString()
Converts a VectorL into a string of format “(X; Y)”.
public override string ToString()
Returns
- string
String containing the VectorL information.
Operators
operator +(VectorL, VectorL)
Adds two VectorL objects.
public static VectorL operator +(VectorL a, VectorL b)
Parameters
Returns
- VectorL
Returns the sum of the two VectorL objects.
operator |(VectorL, VectorL)
Calculates the scalar product of two VectorL objects.
public static long operator |(VectorL a, VectorL b)
Parameters
Returns
- long
Scalar product of the two VectorL objects.
operator /(long, VectorL)
Performs a component-wise division of a long value and a VectorL object.
The result is defined as new Vector(number / vector.X, number / vector.Y).
public static VectorL operator /(long number, VectorL vector)
Parameters
numberlongThe long value to divide by the components of the VectorL object.
vectorVectorLThe VectorL object used as divisor.
Returns
- VectorL
Returns the quotient of the long value and the VectorL object.
operator /(VectorL, long)
public static VectorL operator /(VectorL vector, long divisor)
Parameters
vectorVectorLThe VectorL object to divide by the long value.
divisorlongThe long value used as divisor.
Returns
- VectorL
Returns the quotient of the VectorL object and the long value.
operator /(VectorL, VectorL)
Performs a component-wise division of two VectorL objects.
public static VectorL operator /(VectorL a, VectorL b)
Parameters
aVectorLThe first VectorL object to divide by parameter b.
bVectorLThe second VectorL object used as divisor.
Returns
- VectorL
Returns the quotient of the two VectorL objects.
operator ==(VectorL, VectorL)
Compares two VectorL for equality. The comparison will be done by comparing the values of the two x- and y-components, respectively.
public static bool operator ==(VectorL vector1, VectorL vector2)
Parameters
Returns
- bool
Returns true if the two objects are equal.
explicit operator VectorL(VectorD)
public static explicit operator VectorL(VectorD vector)
Parameters
vectorVectorDVectorD object to be converted.
Returns
- VectorL
Converted VectorL.
explicit operator Vector(VectorL)
public static explicit operator Vector(VectorL vector)
Parameters
vectorVectorLVectorL object to be converted.
Returns
- Vector
Converted Vector.
implicit operator VectorL(Vector)
public static implicit operator VectorL(Vector vector)
Parameters
vectorVectorVector object to be converted.
Returns
- VectorL
Converted VectorL.
operator !=(VectorL, VectorL)
Compares two VectorL for inequality. The comparison will be done by comparing the values of the two x- and y-components, respectively.
public static bool operator !=(VectorL vector1, VectorL vector2)
Parameters
Returns
- bool
Returns true if the two objects are unequal.
operator *(long, VectorL)
Multiplies a VectorL object with a long value.
public static VectorL operator *(long factor, VectorL vector)
Parameters
Returns
- VectorL
Returns the product of the VectorL object and the long value.
operator *(VectorL, long)
Multiplies a VectorL object with a long value.
public static VectorL operator *(VectorL vector, long factor)
Parameters
Returns
- VectorL
Returns the product of the VectorL object and the long value.
operator *(VectorL, VectorL)
Multiplies two VectorL objects.
public static VectorL operator *(VectorL a, VectorL b)
Parameters
Returns
- VectorL
Returns the product of the two VectorL objects.
operator -(VectorL, VectorL)
Subtracts two VectorL objects.
public static VectorL operator -(VectorL a, VectorL b)
Parameters
aVectorLThe first VectorL object to subtract from.
bVectorLThe second VectorL object to subtract.
Returns
- VectorL
Returns the difference of the two VectorL objects.