Vector2d Class

Class that represents a 2d vector, that is a length and a direction in 2d space.
Public Class Vector2d
This language is not supported or no code example is available.
public class Vector2d
This language is not supported or no code example is available.
public ref class Vector2d 
This language is not supported or no code example is available.
public class Vector2d
This language is not supported or no code example is available.
Name Description
Public constructor Vector2d() Creates a zero length vector
Public constructor Vector2d(Point2d, Point2d) Creates a vector that represents the translation from a point to another.
Public constructor Vector2d(Point2d) Creates a vector taking x,y from the point
Public constructor Vector2d(Vector2d) Copy constructor.
Public constructor Vector2d(double, double) Creates a vector with x and y as data.
Top
Name Description
Public property Angle Gets the angle of the vector.
Public property LeftNormal Gets the normal on the left side of this vector as a new vector that has the same length as this one. This means: Vector2d(1,0).LeftNormal equals Vector2d(0,1)
Public property Length Gets or sets the length of the vector.
Public property RightNormal Gets the normal on the right side of this vector as a new vector that has the same length as this one. This means: Vector2d(1,0).LeftNormal equals Vector2d(0,-1)
Public property SquaredLength Gets the The squared length of the vector. This is faster than than getting it's actual length.
Public property Static XAxis
Public property Static YAxis
Top
Methods
 
Name Description
Public method AngleCCW(Vector2d) Computes the counter clockwise angle from this vector to another.
Public method AngleCW(Vector2d) Computes the clockwise angle from this vector to another.
Public method Static CreateFromAngle(double) Creates a unit vector with a given angle.
Public method Static CreateFromAngleAndLength(double, double) Creates a vector with a given angle and length.
Public method Cross(Vector2d)
Public method DifferentialAngle(Vector2d) Computes the angular difference from this vector to another in the range -PI to +PI.
Public method DirectionalWith(Vector2d, double) Checks if the vector has the same direction as another with a given tolerance.
Public method DotProduct(Vector2d) Computes the dot product between this vector and another. If the vectors are normalized this is the same as cosine of the smallest angle between vectors.
Public method Equals(Vector2d, double) Checks if this vector is about the same as another with a given tolerance.
Public method GetBisector(Vector2d)
Public method Normalize() Normalizes the vector in-place, which means making its length 1.0 maintaining its angle. If the vectors length is 0.0 an exception is thrown.
Public method ParallelWith(Vector2d, double) Checks if the vector is parallel with another with a given tolerance.
Public method PerpendicularDotProduct(Vector2d) Computes the dot product of the vector perpendicular with this one and another. If the vectors are normalized this is the same as sine of the smallest angle between vectors.
Public method Rotate(double)
Public method Rotate270()
Public method Rotate90()
Public method SmallestAngle(Vector2d) Returns the angle between this vector and another. Tha angle returned is always the one less then PI.
Public method ToPoint() Create a point (x,y) from the vector components (x,y).
Public method ToString() Creates a string representation of the vector suitable for debugging.
Public method Transform(Matrix2d) Transforms the vector in-place with a matrix. When transforming a vector, the translation portion of the matrix is ignored, just scaling and rotation is considered.
Top
Name Description
Operator Static Addition Creates a new vector that is a sum of two others.
Operator Static Division Divides the length of the vector with a factor (scales it)
Operator Static Multiply Multiplies the length of the vector with a factor (scales it)
Operator Static Multiply Multiplies the length of the vector with a factor (scales it)
Operator Static Subtraction Subtracts a vector from another into a new vector.
Operator Static UnaryNegation Computes the negation of a vector into a new vector.
Top
Fields
 
Name Description
Public field x The x component of the vector left public for fast access.
Public field y The y component of the vector left public for fast access.
Top
IGS.Genamo.Vector2d

.NET Framework

Supported in: 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8

In this article

Definition