Vector2D Class

Defines a 2D vector.
Public Class Vector2D 
Implements ICloneable
This language is not supported or no code example is available.
public class Vector2D : ICloneable
This language is not supported or no code example is available.
Name Description
Protected constructor Vector2D(Vector2D)
Public constructor Vector2D() Empty constructor.
Public constructor Vector2D(Point2D, Point2D) Two 2D points constructor. A 2D vector with direction from P0 to P1.
Public constructor Vector2D(double, double) Standard constructor.
Public constructor Vector2D(double[]) Double array constructor.
Top
Name Description
Public property Angle Gets the angle between the X-axis and the 2D vector.
Public property AsPoint
Public property Static AxisX Returns the X axis vector.
Public property Static AxisY Returns the Y axis vector.
Public property IsUnit True if the vector has length equal to one.
Public property IsZero True if the vector has length equal to zero.
Public property Length Gets or sets the 2D vector length.
Public property LengthSquared Gets the 2D vector squared length.
Public property MaximumCoordinate Gets the absolute value of the maximum coordinate.
Top
Methods
 
Name Description
Public method Static Add(Point2D, Point2D) Addition between two 2D points.
Public method Static AngleBetween(Vector2D, Vector2D) Computes the angle between two 2D vectors.
Public method Static AreCoincident(Vector2D, Vector2D) Returns true if the angle between the two 2D vectors is zero.
Public method Static AreCoincident(Vector2D, Vector2D, double) Returns true if the angle between the two 2D vectors is zero or almost zero.
Public method Static AreOpposite(Vector2D, Vector2D) Returns true if the angle between the two 2D vectors is PI.
Public method Static AreOpposite(Vector2D, Vector2D, double) Returns true if the angle between the two 2D vectors is PI or almost PI.
Public method Static AreOrthogonal(Vector2D, Vector2D) Returns true if the angle between the two 2D vectors is PI/2.
Public method Static AreOrthogonal(Vector2D, Vector2D, double) Returns true if the angle between the two 2D vectors is PI/2 or almost PI/2.
Public method Static AreParallel(Vector2D, Vector2D) Returns true if the angle between the two 2D vectors is 0 or PI.
Public method Static AreParallel(Vector2D, Vector2D, double) Returns true if the angle between the two 2D vectors is zero or PI or almost zero or almost PI.
Public method Clone() Creates a deep copy of this 2D vector.
Public method ConvertToSurrogate()
Public method ConvertToSurrogate_V6()
Public method Static Dot(Point2D, Vector2D) Dot product between a 2D point and a 2D vector.
Public method Static Dot(Vector2D, Vector2D) Dot product between two 2D vectors.
Public method Static Dot(Vector2D, Point2D) Dot product between a 2D vector and a 2D point.
Public method Equals(Vector2D)
Public method Equals(object) Determines whether the specified object is equal to the current object.
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (inherited from Object).
Public method GetHashCode() Serves as the default hash function.
Public method GetType Gets the Type of the current instance. (inherited from Object).
Public method GetXElement()
Public method IsValid() Returns true if the vector's coordinates are reasonable values.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (inherited from Object).
Public method Negate() Reverses the 2D vector direction.
Public method Normalize() Resizes the 2D vector to unit length.
Public method Static PerpDotProduct(Vector2D, Vector2D) Perpendicular dot product.
Public method Reverse() Inverts the 2D vector direction.
Public method Static SignedAngleBetween(Vector2D, Vector2D) Computes the angle between two 2D vectors.
Public method Static Subtract(Point2D, Point2D) Subtraction between two 2D points.
Public method ToArray() Returns an array of vector's coordinates.
Public method ToString() Converts this 2D vector to a human readable string.
Public method ToStringXml() Converts this 2D vector to a human readable string.
Public method TransformBy(Transformation) Transforms the 2D vector by the specified transformation.
Public method WriteXml(XmlTextWriter)
Public method Zero() Sets all the vector components to zero.
Top
Name Description
Operator Static Addition Addition between two vectors.
Operator Static Equality
Operator Static Inequality
Operator Static Multiply Multiplication between a scalar value and a 2D vector.
Operator Static Multiply Multiplication between a scalar value and a 2D vector.
Operator Static Multiply Dot product between two 2D vectors.
Operator Static Subtraction Subtraction between two 2D vectors.
Top
Fields
 
Name Description
Public field X X coordinate value.
Public field Y Y coordinate value.
Top

.NET Framework

Supported in: 4.8

In this article

Definition