Struct VVector
Represents a displacement in 3D space.
Implements
Inherited Members
Namespace: VMS.TPS.Common.Model.Types
Assembly: VMS.TPS.Common.Model.Types.dll
Syntax
public struct VVector : IEquatable<VVector>
Constructors
VVector(Double, Double, Double)
Constructs a VVector.
Declaration
public VVector(double xi, double yi, double zi)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | xi | X component. |
| System.Double | yi | Y component. |
| System.Double | zi | Z component. |
Fields
DefaultEpsilon
DefaultEpsilon value for epsilon equality checking.
Declaration
public const double DefaultEpsilon = 1E-06
Field Value
| Type | Description |
|---|---|
| System.Double |
Undefined
Undefined vector
Declaration
public static readonly VVector Undefined
Field Value
| Type | Description |
|---|---|
| VVector |
Properties
Item[Int32]
Indexing for the x, y and z components.
Declaration
public double this[int i] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | i | Value of 0,1 or 2 that correspond to x,y and z components. |
Property Value
| Type | Description |
|---|---|
| System.Double | Returns the given component of this VVector. |
Item[VVector.Component]
Indexing for the x, y and z components.
Declaration
public readonly double this[VVector.Component vc] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| VVector.Component | vc | Enumeration of vector component corresponding to x,y and z components. |
Property Value
| Type | Description |
|---|---|
| System.Double | Returns the given component of this VVector. |
Length
The length of the VVector.
Declaration
public readonly double Length { get; }
Property Value
| Type | Description |
|---|---|
| System.Double |
LengthSquared
The square of the length of the VVector.
Declaration
public readonly double LengthSquared { get; }
Property Value
| Type | Description |
|---|---|
| System.Double |
x
The X component of the VVector.
Declaration
public double x { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
y
The Y component of the VVector.
Declaration
public double y { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
z
The Z component of the VVector.
Declaration
public double z { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Methods
Distance(VVector, VVector)
The distance between the locations represented by the given VVectors.
Declaration
public static double Distance(VVector left, VVector right)
Parameters
| Type | Name | Description |
|---|---|---|
| VVector | left | First operand. |
| VVector | right | Second operand |
Returns
| Type | Description |
|---|---|
| System.Double | Returns the distance between the locations represented by the given VVectors. |
EpsilonEqual(VVector, Double)
Epsilon-equality comparison of vectors. This method considers two instances of VVector.Undefined to be equal to each other. Otherwise, two vectors are equal only if the vectors components are within epsilon.
Declaration
public bool EpsilonEqual(VVector other, double epsilon)
Parameters
| Type | Name | Description |
|---|---|---|
| VVector | other | Vector to compare this to. |
| System.Double | epsilon | Epsilon to use for the vector component comparison. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the vector components are within epsilon, false otherwise. |
Equals(Object)
Equality comparison of VVector and Object. This method considers two instances of VVector.Undefined to be equal to each other. Otherwise, a vector is equal to an object only if the object is a VVector and vectors are equal. For epsilon-equal comparison, use EpsilonEqual(VVector, Double).
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | Object to compare this to. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the Object is also VVector and equal to this (vectors are equal), false otherwise. |
Overrides
Equals(VVector)
Equality comparison of vectors. This method considers two instances of VVector.Undefined to be equal to each other. Otherwise, two vectors are equal only if the vectors components are equal. a == b, b == c, => a has to be equal to c. Epsilon equality comparison does not fulfill this condition with epsilon > 0.0. For epsilon-equal comparison, use EpsilonEqual(VVector, Double).
Declaration
public bool Equals(VVector other)
Parameters
| Type | Name | Description |
|---|---|---|
| VVector | other | vector to compare this to. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the vectors are equal, false otherwise. |
GetHashCode()
A hash code for the current object.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| System.Int32 | A hash code for the current object. |
Overrides
GetUnitLengthScaledVector()
Scales this VVector so that its length becomes equal to unity.
Declaration
public VVector GetUnitLengthScaledVector()
Returns
| Type | Description |
|---|---|
| VVector |
IsUndefined()
Returns true if at least one of this vector components are equal to double.IsNaN or double.IsInfinity, false otherwise.
Declaration
public bool IsUndefined()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if at least one of the vector component is not defined or is infinity, false otherwise. |
ScalarProduct(VVector)
The scalar product of this VVector and the given VVector.
Declaration
public double ScalarProduct(VVector left)
Parameters
| Type | Name | Description |
|---|---|---|
| VVector | left | VVector that is second operand of the scalar product. |
Returns
| Type | Description |
|---|---|
| System.Double | Returns the scalar product of this VVector with the given VVector. |
ScaleToUnitLength()
Scales this VVector so that its length becomes equal to unity.
Declaration
public void ScaleToUnitLength()
Update(VVector.Component, Double)
Updating VVector component value using VectorComponent indexing.
Declaration
public VVector Update(VVector.Component vc, double value)
Parameters
| Type | Name | Description |
|---|---|---|
| VVector.Component | vc | Component enum that correspond to x,y and z components. |
| System.Double | value | Value of 0,1 or 2 that correspond to x,y and z components. |
Returns
| Type | Description |
|---|---|
| VVector | Returns a new VVector with updated value |
Operators
Addition(VVector, VVector)
The addition of VVectors.
Declaration
public static VVector operator +(VVector left, VVector right)
Parameters
| Type | Name | Description |
|---|---|---|
| VVector | left | First operand. |
| VVector | right | Second operand. |
Returns
| Type | Description |
|---|---|
| VVector | Result of addition. |
Division(VVector, Double)
The division of a VVector by a double.
Declaration
public static VVector operator /(VVector val, double div)
Parameters
| Type | Name | Description |
|---|---|---|
| VVector | val | VVector to divide. |
| System.Double | div | Divisor. |
Returns
| Type | Description |
|---|---|
| VVector | Result of division. |
Equality(VVector, VVector)
Equality operator for vectors. This method considers two instances of VVector.Undefined to be equal to each other. Otherwise, two vectors are equal only if the vectors components are equal. For epsilon-equal comparison, use EpsilonEqual(VVector, Double).
Declaration
public static bool operator ==(VVector vv1, VVector vv2)
Parameters
| Type | Name | Description |
|---|---|---|
| VVector | vv1 | First operand. |
| VVector | vv2 | Second operand. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the vectors are equal, false otherwise. |
Inequality(VVector, VVector)
Inequality operator for vectors. This method considers two instances of VVector.Undefined to be equal to each other. This operator considers two instances of vectors with undefined components to be inequal. For epsilon-equal comparison, use EpsilonEqual(VVector, Double).
Declaration
public static bool operator !=(VVector vv1, VVector vv2)
Parameters
| Type | Name | Description |
|---|---|---|
| VVector | vv1 | First operand. |
| VVector | vv2 | Second operand. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the vectors are inequal, false otherwise. |
Multiply(Double, VVector)
The multiplication of a VVector and a double.
Declaration
public static VVector operator *(double mul, VVector val)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | mul | Multiplier. |
| VVector | val | VVector to multiply. |
Returns
| Type | Description |
|---|---|
| VVector | Result of multiplication. |
Multiply(VVector, Double)
The multiplication of a VVector and a double.
Declaration
public static VVector operator *(VVector val, double mul)
Parameters
| Type | Name | Description |
|---|---|---|
| VVector | val | VVector to multiply. |
| System.Double | mul | Multiplier. |
Returns
| Type | Description |
|---|---|
| VVector | Result of multiplication. |
Subtraction(VVector, VVector)
The subtraction of VVectors.
Declaration
public static VVector operator -(VVector left, VVector right)
Parameters
| Type | Name | Description |
|---|---|---|
| VVector | left | First operand. |
| VVector | right | Second operand. |
Returns
| Type | Description |
|---|---|
| VVector | Result of subtraction. |