menu

UWP

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class Vector - UWP API Reference | Syncfusion

    Show / Hide Table of Contents

    Class Vector

    Inheritance
    System.Object
    Vector
    Implements
    System.IFormattable
    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 vector1 and vector2.

    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 point by vector.

    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 vector1 and vector2.

    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 vector1 and vector2. The following formula is used to calculate the cross product: (Vector1.X * Vector2.Y) - (Vector1.Y * Vector2.X)

    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 vector1 and vector2.

    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 vector is divided.

    Returns
    Type Description
    Vector

    The result of dividing vector by scalar.

    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 value has the same System.Windows.Vector.X and System.Windows.Vector.Y values as this vector; otherwise, false.

    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 vector1 and vector2 are equal; otherwise, false.

    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 o is a System.Windows.Vector and has the same System.Windows.Vector.X and System.Windows.Vector.Y values as this vector; otherwise, false.

    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 vector1 and vector2, which is calculated using the following formula: (vector1.X * vector2.X) + (vector1.Y * vector2.Y)

    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 vector and scalar.

    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 scalar and vector.

    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 vector2 is subtracted.

    Vector vector2

    The vector to subtract from vector1.

    Returns
    Type Description
    Vector

    The difference between vector1 and vector2.

    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 vector1 and vector2.

    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 point.

    Windows.Foundation.Point point

    The point to translate.

    Returns
    Type Description
    Windows.Foundation.Point

    The result of translating point by vector.

    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 vector will be divided.

    Returns
    Type Description
    Vector

    The result of dividing vector by scalar.

    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 vector1 and vector2 are equal; otherwise, false.

    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 vector1 and vector2 are different; otherwise, false.

    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 vector1 and vector2, which is calculated using the following formula:vector1.X * vector2.X + vector1.Y * vector2.Y

    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 vector and scalar.

    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 scalar and vector.

    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 vector2 is subtracted.

    Vector vector2

    The vector to subtract from vector1.

    Returns
    Type Description
    Vector

    The difference between vector1 and vector2.

    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 vector.

    Implements

    System.IFormattable

    Extension Methods

    DateTimeExtension.ToDateTime(Object)
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved