Struct Vector4
Represent a four component vector of double precision.
Implements
Inherited Members
Namespace: netDxf
Assembly: CADability.dll
Syntax
public struct Vector4 : IEquatable<Vector4>
Constructors
| Improve this Doc View SourceVector4(Double, Double, Double, Double)
Initializes a new instance of Vector3.
Declaration
public Vector4(double x, double y, double z, double w)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | x | X component. |
| System.Double | y | Y component. |
| System.Double | z | Z component. |
| System.Double | w | W component. |
Vector4(Double[])
Initializes a new instance of Vector4.
Declaration
public Vector4(double[] array)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double[] | array | Array of four elements that represents the vector. |
Properties
| Improve this Doc View SourceIsNormalized
Gets if the vector has been normalized.
Declaration
public bool IsNormalized { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Item[Int32]
Gets or sets a vector element defined by its index.
Declaration
public double this[int index] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index | Index of the element. |
Property Value
| Type | Description |
|---|---|
| System.Double |
NaN
Represents a vector with not a number components.
Declaration
public static Vector4 NaN { get; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
UnitW
Unit W vector.
Declaration
public static Vector4 UnitW { get; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
UnitX
Unit X vector.
Declaration
public static Vector4 UnitX { get; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
UnitY
Unit Y vector.
Declaration
public static Vector4 UnitY { get; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
UnitZ
Unit Z vector.
Declaration
public static Vector4 UnitZ { get; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
W
Gets or sets the W component.
Declaration
public double W { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
X
Gets or sets the X component.
Declaration
public double X { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Y
Gets or sets the Y component.
Declaration
public double Y { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Z
Gets or sets the Z component.
Declaration
public double Z { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Zero
Zero vector.
Declaration
public static Vector4 Zero { get; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Methods
| Improve this Doc View SourceAdd(Vector4, Vector4)
Adds two vectors.
Declaration
public static Vector4 Add(Vector4 u, Vector4 v)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | u | Vector4. |
| Vector4 | v | Vector4. |
Returns
| Type | Description |
|---|---|
| Vector4 | The addition of u plus v. |
Distance(Vector4, Vector4)
Obtains the distance between two points.
Declaration
public static double Distance(Vector4 u, Vector4 v)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | u | Vector4. |
| Vector4 | v | Vector4. |
Returns
| Type | Description |
|---|---|
| System.Double | Distance. |
Divide(Vector4, Vector4)
Divides two vectors component by component.
Declaration
public static Vector4 Divide(Vector4 u, Vector4 v)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | u | Vector4. |
| Vector4 | v | Vector4. |
Returns
| Type | Description |
|---|---|
| Vector4 | The multiplication of u times v. |
Divide(Vector4, Double)
Divides a vector with an scalar.
Declaration
public static Vector4 Divide(Vector4 u, double a)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | u | Vector4. |
| System.Double | a | Scalar. |
Returns
| Type | Description |
|---|---|
| Vector4 | The division of u times a. |
DotProduct(Vector4, Vector4)
Obtains the dot product of two vectors.
Declaration
public static double DotProduct(Vector4 u, Vector4 v)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | u | Vector4. |
| Vector4 | v | Vector4. |
Returns
| Type | Description |
|---|---|
| System.Double | The dot product. |
Equals(Vector4)
Check if the components of two vectors are approximate equal.
Declaration
public bool Equals(Vector4 other)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | other | Vector4. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the four components are almost equal or false in any other case. |
Equals(Vector4, Vector4)
Check if the components of two vectors are approximate equal.
Declaration
public static bool Equals(Vector4 a, Vector4 b)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | a | Vector4. |
| Vector4 | b | Vector4. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the four components are almost equal or false in any other case. |
Equals(Vector4, Vector4, Double)
Check if the components of two vectors are approximate equal.
Declaration
public static bool Equals(Vector4 a, Vector4 b, double threshold)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | a | Vector4. |
| Vector4 | b | Vector4. |
| System.Double | threshold | Maximum tolerance. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the four components are almost equal or false in any other case. |
Equals(Vector4, Double)
Check if the components of two vectors are approximate equal.
Declaration
public bool Equals(Vector4 other, double threshold)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | other | Vector4. |
| System.Double | threshold | Maximum tolerance. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the four components are almost equal or false in any other case. |
Equals(Object)
Indicates whether this instance and a specified object are equal.
Declaration
public override bool Equals(object other)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | other | Another object to compare to. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if obj and this instance are the same type and represent the same value; otherwise, false. |
Overrides
GetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| System.Int32 | A 32-bit signed integer that is the hash code for this instance. |
Overrides
IsNaN(Vector4)
Returns a value indicating if any component of the specified vector evaluates to a value that is not a number System.Double.NaN.
Declaration
public static bool IsNaN(Vector4 u)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | u | Vector3. |
Returns
| Type | Description |
|---|---|
| System.Boolean | Returns true if any component of the specified vector evaluates to System.Double.NaN; otherwise, false. |
Modulus()
Obtains the modulus of the vector.
Declaration
public double Modulus()
Returns
| Type | Description |
|---|---|
| System.Double | Vector modulus. |
Multiply(Vector4, Vector4)
Multiplies two vectors component by component.
Declaration
public static Vector4 Multiply(Vector4 u, Vector4 v)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | u | Vector4. |
| Vector4 | v | Vector4. |
Returns
| Type | Description |
|---|---|
| Vector4 | The multiplication of u times v. |
Multiply(Vector4, Double)
Multiplies a vector with an scalar (same as a*u, commutative property).
Declaration
public static Vector4 Multiply(Vector4 u, double a)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | u | Vector4. |
| System.Double | a | Scalar. |
Returns
| Type | Description |
|---|---|
| Vector4 | The multiplication of u times a. |
Multiply(Double, Vector4)
Multiplies a scalar with a vector (same as u*a, commutative property).
Declaration
public static Vector4 Multiply(double a, Vector4 u)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | a | Scalar. |
| Vector4 | u | Vector4. |
Returns
| Type | Description |
|---|---|
| Vector4 | The multiplication of u times a. |
Negate(Vector4)
Negates a vector.
Declaration
public static Vector4 Negate(Vector4 u)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | u | Vector4. |
Returns
| Type | Description |
|---|---|
| Vector4 | The negative vector of u. |
Normalize()
Normalizes the current vector.
Declaration
public void Normalize()
Normalize(Vector4)
Normalizes the vector.
Declaration
public static Vector4 Normalize(Vector4 u)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | u | Vector to normalize |
Returns
| Type | Description |
|---|---|
| Vector4 | A normalized vector. |
Round(Vector4, Int32)
Rounds the components of a vector.
Declaration
public static Vector4 Round(Vector4 u, int numDigits)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | u | Vector to round. |
| System.Int32 | numDigits | Number of decimal places in the return value. |
Returns
| Type | Description |
|---|---|
| Vector4 | The rounded vector. |
SquareDistance(Vector4, Vector4)
Obtains the square distance between two points.
Declaration
public static double SquareDistance(Vector4 u, Vector4 v)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | u | Vector4. |
| Vector4 | v | Vector4. |
Returns
| Type | Description |
|---|---|
| System.Double | Square distance. |
Subtract(Vector4, Vector4)
Subtracts two vectors.
Declaration
public static Vector4 Subtract(Vector4 u, Vector4 v)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | u | Vector4. |
| Vector4 | v | Vector4. |
Returns
| Type | Description |
|---|---|
| Vector4 | The subtraction of u minus v. |
ToArray()
Returns an array that represents the vector.
Declaration
public double[] ToArray()
Returns
| Type | Description |
|---|---|
| System.Double[] | Array. |
ToString()
Obtains a string that represents the vector.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String | A string text. |
Overrides
ToString(IFormatProvider)
Obtains a string that represents the vector.
Declaration
public string ToString(IFormatProvider provider)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IFormatProvider | provider | An IFormatProvider interface implementation that supplies culture-specific formatting information. |
Returns
| Type | Description |
|---|---|
| System.String | A string text. |
Operators
| Improve this Doc View SourceAddition(Vector4, Vector4)
Adds two vectors.
Declaration
public static Vector4 operator +(Vector4 u, Vector4 v)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | u | Vector4. |
| Vector4 | v | Vector4. |
Returns
| Type | Description |
|---|---|
| Vector4 | The addition of u plus v. |
Division(Vector4, Vector4)
Divides two vectors component by component.
Declaration
public static Vector4 operator /(Vector4 u, Vector4 v)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | u | Vector4. |
| Vector4 | v | Vector4. |
Returns
| Type | Description |
|---|---|
| Vector4 | The multiplication of u times v. |
Division(Vector4, Double)
Divides an scalar with a vector.
Declaration
public static Vector4 operator /(Vector4 u, double a)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | u | Vector4. |
| System.Double | a | Scalar. |
Returns
| Type | Description |
|---|---|
| Vector4 | The division of u times a. |
Equality(Vector4, Vector4)
Check if the components of two vectors are equal.
Declaration
public static bool operator ==(Vector4 u, Vector4 v)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | u | Vector4. |
| Vector4 | v | Vector4. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the three components are equal or false in any other case. |
Inequality(Vector4, Vector4)
Check if the components of two vectors are different.
Declaration
public static bool operator !=(Vector4 u, Vector4 v)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | u | Vector4. |
| Vector4 | v | Vector4. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the three components are different or false in any other case. |
Multiply(Vector4, Vector4)
Multiplies two vectors component by component.
Declaration
public static Vector4 operator *(Vector4 u, Vector4 v)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | u | Vector4. |
| Vector4 | v | Vector4. |
Returns
| Type | Description |
|---|---|
| Vector4 | The multiplication of u times v. |
Multiply(Vector4, Double)
Multiplies a vector with an scalar (same as a*u, commutative property).
Declaration
public static Vector4 operator *(Vector4 u, double a)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | u | Vector4. |
| System.Double | a | Scalar. |
Returns
| Type | Description |
|---|---|
| Vector4 | The multiplication of u times a. |
Multiply(Double, Vector4)
Multiplies a scalar with a vector (same as u*a, commutative property).
Declaration
public static Vector4 operator *(double a, Vector4 u)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | a | Scalar. |
| Vector4 | u | Vector4. |
Returns
| Type | Description |
|---|---|
| Vector4 | The multiplication of u times a. |
Subtraction(Vector4, Vector4)
Subtracts two vectors.
Declaration
public static Vector4 operator -(Vector4 u, Vector4 v)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | u | Vector4. |
| Vector4 | v | Vector4. |
Returns
| Type | Description |
|---|---|
| Vector4 | The subtraction of u minus v. |
UnaryNegation(Vector4)
Negates a vector.
Declaration
public static Vector4 operator -(Vector4 u)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | u | Vector4. |
Returns
| Type | Description |
|---|---|
| Vector4 | The negative vector of u. |