Programming Reference for VirtualLab Fusion
2025.1
|
This struct defines a two-dimensional vector of double numbers. Operators \(a+b\), \(a-b\) and \(a|b\) (Scalar product) can be used. One operand on \(a*b\), \(a/b\) (applied separate on components) can be also a double. It is also possible to raise a VectorD to a given power ( \(a^b\)). Implicit casting from Vector is supported. More...
Public Member Functions | |
double | Abs () |
Calculates the absolute value of this VectorD object. The absolute value corresponds with the length of the vector. | |
VectorD | Ceil () |
Calculates smallest integers less than X and Y component and creates new VectorD using them. | |
VectorD | ComponentAbs () |
Calculates the absolute values of both elements of the current VectorD and creates new one using them. | |
VectorD | Floor () |
Calculates smallest integers greater than X and Y component and creates new VectorD using them. | |
double | Max () |
returns the maximal component value | |
double | Min () |
returns the minimal component value | |
double | Norm () |
Calculates the norm (squared absolute value) of the present VectorD object. | |
void | Normalize () |
Normalizes the present VectorD object. | |
VectorD | Reziprocal () |
Calculates the reciprocals of both components of current VectorD object and returns the result as new object. | |
VectorD | Round () |
Rounds both X and Y coordinate of a VectorD to an integer and creates new VectorD using them. | |
Vector | RoundToVector () |
Round both X and Y to int and returns a Vector. | |
VectorD | Sqrt () |
Calculates the square roots of the components of the present VectorD object and returns a new object. | |
override string | ToString () |
Converts this VectorD into a string of format (X; Y). | |
string | ToString (int numberOfDigits) |
Converts this VectorD into a string of format (X; Y). | |
VectorD (double x, double y) | |
Creates a VectorD from two double values. | |
VectorD (Tuple< double, double > values) | |
Initializes a new instance of the VectorD struct. from a tuple of two doubles. | |
VectorD (Vector vector) | |
Creates a new VectorD object from an existing Vector. | |
VectorD (VectorD vector) | |
Creates a new VectorD object from an existing object. | |
Static Public Member Functions | |
static double | AngleBetweenVectors (VectorD vector1, VectorD vector2) |
Calculates the angle between two vectors in radian. | |
static bool | AreCollinear (VectorD v1, VectorD v2) |
Checks whether two VectorD objects are collinear, i.e. they are parallel or anti-parallel. | |
static VectorD | Max (VectorD v1, VectorD v2) |
Gets the component-wise maximum of two double vectors. | |
static VectorD | Min (VectorD v1, VectorD v2) |
Gets the component-wise minimum of two double vectors. | |
static implicit | operator PointF (VectorD vector) |
Converts a VectorD object into a System.Drawing.PointF object. | |
static implicit | operator SizeF (VectorD vector) |
Converts a VectorD object into a System.Drawing.SizeF object. | |
static implicit | operator Vector2D (VectorD vector) |
Converts a VectorD object into a System.Drawing.SizeF object. | |
static implicit | operator VectorD (PointF size) |
Converts a System.Drawing.PointF object into a VectorD object. | |
static implicit | operator VectorD (SizeF size) |
Converts a System.Drawing.SizeF object into a VectorD object. | |
static implicit | operator VectorD (Vector vector) |
Converts a Vector object to a VectorD object. | |
static implicit | operator VectorD (VectorL vector) |
Converts a VectorL object to a VectorD object. | |
static bool | operator!= (VectorD vector1, VectorD vector2) |
Compares two VectorD for inequality. The comparison will be done by comparing the values of the two x- and y- components respectively. | |
static VectorD | operator* (double factor, VectorD vector) |
Multiplies a VectorD objects by a double value. | |
static VectorD | operator* (VectorD a, VectorD b) |
Multiplies two VectorD objects. | |
static VectorD | operator* (VectorD vector, double factor) |
Multiplies a VectorD objects by a double value. | |
static VectorD | operator+ (VectorD a, VectorD b) |
Adds two VectorD objects. | |
static VectorD | operator- (VectorD a) |
Returns the negated argument. () | |
static VectorD | operator- (VectorD a, VectorD b) |
Subtracts two VectorD objects. | |
static VectorD | operator/ (double number, VectorD vector) |
Performs a component wise division of a double value and a VectorD object. The result is defined as new VectorD(number / vector.X, number / vector.Y). | |
static VectorD | operator/ (VectorD a, VectorD b) |
Performs a component wise division of two VectorD objects. | |
static VectorD | operator/ (VectorD vector, double divisor) |
Performs a component wise division of a VectorD object and a double value. | |
static bool | operator== (VectorD vector1, VectorD vector2) |
Compares two VectorD for equality. The comparison will be done by comparing the values of the two x- and y- components respectively. | |
static double | operator| (VectorD a, VectorD b) |
Calculates the scalar product of two VectorD objects. | |
static VectorD | Parse (string vectorDAsString) |
parse function of the VectorD class | |
static VectorD | Power (VectorD vector, double exp) |
Raises both components of current VectorD to the power of exp and creates new one using them. | |
Public Attributes | |
double | X |
X value of the VectorD object. | |
double | Y |
Y value of the VectorD object. | |
Static Public Attributes | |
static VectorD | coords |
Method which calculates the intersection of two line segments that are collinear. | |
static readonly VectorD | DummyVector |
A constant showing the absence of any useful direction. | |
static readonly VectorD | UndefinedVector |
A constant vector containing 2 Double.NaNs. Property IsUndefined can be used to check for being undefined. | |
static readonly VectorD | UnitVectorX |
A constant containing the unit vector in x-direction. | |
static readonly VectorD | UnitVectorY |
A constant containing the unit vector in y-direction. | |
static readonly VectorD | ZeroVector |
A constant containing the zero vector (0, 0). | |
Properties | |
bool | IsUndefined [get] |
Gets whether a least one component of the vector is undefined. | |
This struct defines a two-dimensional vector of double numbers. Operators \(a+b\), \(a-b\) and \(a|b\) (Scalar product) can be used. One operand on \(a*b\), \(a/b\) (applied separate on components) can be also a double. It is also possible to raise a VectorD to a given power ( \(a^b\)). Implicit casting from Vector is supported.
VectorD | ( | double | x, |
double | y | ||
) |
Creates a VectorD from two double values.
x | X value of new VectorD object. |
y | Y value of new VectorD object. |
VectorD | ( | Tuple< double, double > | values | ) |
Initializes a new instance of the VectorD struct. from a tuple of two doubles.
values | The tuple with the values. |
Creates a new VectorD object from an existing object.
vector | The VectorD object to copy. |
Creates a new VectorD object from an existing Vector.
vector | The Vector object to copy. |
double Abs | ( | ) |
Calculates the absolute value of this VectorD object. The absolute value corresponds with the length of the vector.
Calculates the angle between two vectors in radian.
vector1 | The first vector. |
vector2 | The second vector. |
Checks whether two VectorD objects are collinear, i.e. they are parallel or anti-parallel.
v1 | First vector to be checked for collinearity to second vector. |
v2 | Second vector to be checked for collinearity to first vector. |
true
if v1 and v2 are collinear or a zero vector is given, otherwise false
.VectorD Ceil | ( | ) |
Calculates smallest integers less than X and Y component and creates new VectorD using them.
VectorD ComponentAbs | ( | ) |
Calculates the absolute values of both elements of the current VectorD and creates new one using them.
VectorD Floor | ( | ) |
Calculates smallest integers greater than X and Y component and creates new VectorD using them.
double Max | ( | ) |
returns the maximal component value
Gets the component-wise maximum of two double vectors.
v1 | first VectorD |
v2 | second VectorD |
double Min | ( | ) |
returns the minimal component value
inheritdoc/>
Gets the component-wise minimum of two double vectors.
v1 | first VectorD |
v2 | second VectorD |
double Norm | ( | ) |
Calculates the norm (squared absolute value) of the present VectorD object.
void Normalize | ( | ) |
Normalizes the present VectorD object.
ArgumentException | Vector to normalize has a length of zero. |
|
static |
Converts a VectorD object into a System.Drawing.PointF object.
vector | The VectorD object to convert into a System.Drawing.PointF object. |
|
static |
Converts a VectorD object into a System.Drawing.SizeF object.
vector | The VectorD object to convert into a System.Drawing.SizeF object. |
|
static |
Converts a VectorD object into a System.Drawing.SizeF object.
vector | The VectorD object to convert into a System.Drawing.SizeF object. |
|
static |
Converts a System.Drawing.PointF object into a VectorD object.
size | The System.Drawing.PointF object to convert into a VectorD object. |
|
static |
Converts a System.Drawing.SizeF object into a VectorD object.
size | The System.Drawing.SizeF object to convert into a VectorD object. |
Converts a Vector object to a VectorD object.
vector | Vector object to be converted. |
Converts a VectorL object to a VectorD object.
vector | VectorL object to be converted. |
Compares two VectorD for inequality. The comparison will be done by comparing the values of the two x- and y- components respectively.
vector1 | First VectorD object to compare. |
vector2 | Second VectorD object to compare. |
Multiplies a VectorD objects by a double value.
factor | The double value to multiply. |
vector | The VectorD object to multiply. |
Multiplies two VectorD objects.
a | The first VectorD object to multiply. |
b | The second VectorD object to multiply. |
Multiplies a VectorD objects by a double value.
vector | The VectorD object to multiply. |
factor | The double value to multiply. |
Adds two VectorD objects.
a | The first VectorD object to add. |
b | The second VectorD object to add. |
Subtracts two VectorD objects.
a | The first VectorD object to subtract from. |
b | The second VectorD object to subtract. |
Performs a component wise division of a double value and a VectorD object. The result is defined as new VectorD(number / vector.X, number / vector.Y).
number | The double value to divide by the components of the VectorD object. |
vector | The VectorD object used as divisor. |
Performs a component wise division of two VectorD objects.
a | The first VectorD object to divide by parameter b. |
b | The second VectorD object used as divisor. |
Performs a component wise division of a VectorD object and a double value.
vector | The VectorD object to divide by the double value. |
divisor | The double value used as divisor. |
Compares two VectorD for equality. The comparison will be done by comparing the values of the two x- and y- components respectively.
vector1 | First VectorD object to compare. |
vector2 | Second VectorD object to compare. |
Calculates the scalar product of two VectorD objects.
a | First VectorD object. |
b | Second VectorD object. |
|
static |
parse function of the VectorD class
vectorDAsString | the string which should be parsed |
Raises both components of current VectorD to the power of exp and creates new one using them.
vector | Base. |
exp | Exponent. |
VectorD Reziprocal | ( | ) |
Calculates the reciprocals of both components of current VectorD object and returns the result as new object.
VectorD Round | ( | ) |
Rounds both X and Y coordinate of a VectorD to an integer and creates new VectorD using them.
Vector RoundToVector | ( | ) |
Round both X and Y to int and returns a Vector.
VectorD Sqrt | ( | ) |
Calculates the square roots of the components of the present VectorD object and returns a new object.
override string ToString | ( | ) |
Converts this VectorD into a string of format (X; Y).
string ToString | ( | int | numberOfDigits | ) |
Converts this VectorD into a string of format (X; Y).
numberOfDigits | The number of significant digits returned for the vector components. |
|
static |
Method which calculates the intersection of two line segments that are collinear.
firstSegment | First line segment. |
secondSegment | Second line segment. |
|
get |
Gets whether a least one component of the vector is undefined.
true
iff at least one component of the vector is NaN
.