Class Vector
Inheritance
Implements
Namespace: Syncfusion.UI.Xaml.Diagram.Utility
Assembly: Syncfusion.SfDiagram.UWP.dll
Syntax
public sealed class Vector : ValueType, IFormattable
Constructors
Vector(Double, Double)
Initializes a new instance of the System.Windows.Vector structure.
Declaration
public Vector(double x, double y)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | x | The System.Windows.Vector.X-offset of the new System.Windows.Vector. |
| System.Double | y | The System.Windows.Vector.Y-offset of the new System.Windows.Vector. |
Vector(Point)
Declaration
public Vector(Point p)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.Foundation.Point | p |
Properties
Length
Gets the length of this vector.
Declaration
public double Length { get; }
Property Value
| Type | Description |
|---|---|
| System.Double | The length of this vector. |
LengthSquared
Gets the square of the length of this vector.
Declaration
public double LengthSquared { get; }
Property Value
| Type | Description |
|---|---|
| System.Double | The square of the System.Windows.Vector.Length of this vector. |
X
Gets or sets the System.Windows.Vector.X component of this vector.
Declaration
public double X { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | The System.Windows.Vector.X component of this vector. The default value is 0. |
Y
Gets or sets the System.Windows.Vector.Y component of this vector.
Declaration
public double Y { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | The System.Windows.Vector.Y component of this vector. The default value is 0. |
Methods
Add(Vector, Vector)
Adds two vectors and returns the result as a System.Windows.Vector structure.
Declaration
public static Vector Add(Vector vector1, Vector vector2)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | vector1 | The first vector to add. |
| Vector | vector2 | The second vector to add. |
Returns
| Type | Description |
|---|---|
| Vector | The sum of |
Add(Vector, Point)
Translates the specified point by the specified vector and returns the resulting point.
Declaration
public static Point Add(Vector vector, Point point)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | vector | The amount to translate the specified point. |
| Windows.Foundation.Point | point | The point to translate. |
Returns
| Type | Description |
|---|---|
| Windows.Foundation.Point | The result of translating |
AngleBetween(Vector, Vector)
Retrieves the angle, expressed in degrees, between the two specified vectors.
Declaration
public static double AngleBetween(Vector vector1, Vector vector2)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | vector1 | The first vector to evaluate. |
| Vector | vector2 | The second vector to evaluate. |
Returns
| Type | Description |
|---|---|
| System.Double | The angle, in degrees, between |
CrossProduct(Vector, Vector)
Calculates the cross product of two vectors.
Declaration
public static double CrossProduct(Vector vector1, Vector vector2)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | vector1 | The first vector to evaluate. |
| Vector | vector2 | The second vector to evaluate. |
Returns
| Type | Description |
|---|---|
| System.Double | The cross product of |
Determinant(Vector, Vector)
Calculates the determinant of two vectors.
Declaration
public static double Determinant(Vector vector1, Vector vector2)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | vector1 | The first vector to evaluate. |
| Vector | vector2 | The second vector to evaluate. |
Returns
| Type | Description |
|---|---|
| System.Double | The determinant of |
Divide(Vector, Double)
Divides the specified vector by the specified scalar and returns the result as a System.Windows.Vector.
Declaration
public static Vector Divide(Vector vector, double scalar)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | vector | The vector structure to divide. |
| System.Double | scalar | The amount by which |
Returns
| Type | Description |
|---|---|
| Vector | The result of dividing |
Equals(Vector)
Compares two vectors for equality.
Declaration
public bool Equals(Vector value)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | value | The vector to compare with this vector. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if |
Equals(Vector, Vector)
Compares the two specified vectors for equality.
Declaration
public static bool Equals(Vector vector1, Vector vector2)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | vector1 | The first vector to compare. |
| Vector | vector2 | The second vector to compare. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if t he System.Windows.Vector.X and System.Windows.Vector.Y components of |
Equals(Object)
Determines whether the specified System.Object is a System.Windows.Vector structure and, if it is, whether it has the same System.Windows.Vector.X and System.Windows.Vector.Y values as this vector.
Declaration
public override bool Equals(object o)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | o | The vector to compare. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if |
GetHashCode()
Returns the hash code for this vector.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| System.Int32 | The hash code for this instance. |
Multiply(Vector, Vector)
Calculates the dot product of the two specified vectors and returns the result as a System.Double.
Declaration
public static double Multiply(Vector vector1, Vector vector2)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | vector1 | The first vector to multiply. |
| Vector | vector2 | The second vector structure to multiply. |
Returns
| Type | Description |
|---|---|
| System.Double | A System.Double containing the scalar dot product of |
Multiply(Vector, Double)
Multiplies the specified vector by the specified scalar and returns the resulting System.Windows.Vector.
Declaration
public static Vector Multiply(Vector vector, double scalar)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | vector | The vector to multiply. |
| System.Double | scalar | The scalar to multiply. |
Returns
| Type | Description |
|---|---|
| Vector | The result of multiplying |
Multiply(Double, Vector)
Multiplies the specified scalar by the specified vector and returns the resulting System.Windows.Vector.
Declaration
public static Vector Multiply(double scalar, Vector vector)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | scalar | The scalar to multiply. |
| Vector | vector | The vector to multiply. |
Returns
| Type | Description |
|---|---|
| Vector | The result of multiplying |
Negate()
Negates this vector. The vector has the same magnitude as before, but its direction is now opposite.
Declaration
public void Negate()
Normalize()
Normalizes this vector.
Declaration
public void Normalize()
Subtract(Vector, Vector)
Subtracts the specified vector from another specified vector.
Declaration
public static Vector Subtract(Vector vector1, Vector vector2)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | vector1 | The vector from which |
| Vector | vector2 | The vector to subtract from |
Returns
| Type | Description |
|---|---|
| Vector | The difference between |
Operators
Addition(Vector, Vector)
Adds two vectors and returns the result as a vector.
Declaration
public static Vector operator +(Vector vector1, Vector vector2)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | vector1 | The first vector to add. |
| Vector | vector2 | The second vector to add. |
Returns
| Type | Description |
|---|---|
| Vector | The sum of |
Addition(Vector, Point)
Translates a point by the specified vector and returns the resulting point.
Declaration
public static Point operator +(Vector vector, Point point)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | vector | The vector used to translate |
| Windows.Foundation.Point | point | The point to translate. |
Returns
| Type | Description |
|---|---|
| Windows.Foundation.Point | The result of translating |
Division(Vector, Double)
Divides the specified vector by the specified scalar and returns the resulting vector.
Declaration
public static Vector operator /(Vector vector, double scalar)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | vector | The vector to divide. |
| System.Double | scalar | The scalar by which |
Returns
| Type | Description |
|---|---|
| Vector | The result of dividing |
Equality(Vector, Vector)
Compares two vectors for equality.
Declaration
public static bool operator ==(Vector vector1, Vector vector2)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | vector1 | The first vector to compare. |
| Vector | vector2 | The second vector to compare. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the System.Windows.Vector.X and System.Windows.Vector.Y components of |
Explicit(Vector to Point)
Declaration
public static explicit operator Point(Vector vector)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | vector |
Returns
| Type |
|---|
| Windows.Foundation.Point |
Explicit(Vector to Size)
Declaration
public static explicit operator Size(Vector vector)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | vector |
Returns
| Type |
|---|
| Windows.Foundation.Size |
Inequality(Vector, Vector)
Compares two vectors for inequality.
Declaration
public static bool operator !=(Vector vector1, Vector vector2)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | vector1 | The first vector to compare. |
| Vector | vector2 | The second vector to compare. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the System.Windows.Vector.X and System.Windows.Vector.Y components of |
Multiply(Vector, Vector)
Calculates the dot product of the two specified vector structures and returns the result as a System.Double.
Declaration
public static double operator *(Vector vector1, Vector vector2)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | vector1 | The first vector to multiply. |
| Vector | vector2 | The second vector to multiply. |
Returns
| Type | Description |
|---|---|
| System.Double | Returns a System.Double containing the scalar dot product of |
Multiply(Vector, Double)
Multiplies the specified vector by the specified scalar and returns the resulting vector.
Declaration
public static Vector operator *(Vector vector, double scalar)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | vector | The vector to multiply. |
| System.Double | scalar | The scalar to multiply. |
Returns
| Type | Description |
|---|---|
| Vector | The result of multiplying |
Multiply(Double, Vector)
Multiplies the specified scalar by the specified vector and returns the resulting vector.
Declaration
public static Vector operator *(double scalar, Vector vector)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | scalar | The scalar to multiply. |
| Vector | vector | The vector to multiply. |
Returns
| Type | Description |
|---|---|
| Vector | The result of multiplying |
Subtraction(Vector, Vector)
Subtracts one specified vector from another.
Declaration
public static Vector operator -(Vector vector1, Vector vector2)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | vector1 | The vector from which |
| Vector | vector2 | The vector to subtract from |
Returns
| Type | Description |
|---|---|
| Vector | The difference between |
UnaryNegation(Vector)
Negates the specified vector.
Declaration
public static Vector operator -(Vector vector)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | vector | The vector to negate. |
Returns
| Type | Description |
|---|---|
| Vector | A vector with System.Windows.Vector.X and System.Windows.Vector.Y values opposite of the System.Windows.Vector.X and System.Windows.Vector.Y values of |