Class Vector2d
Represents a 2-dimensional vector.
Inheritance
Namespace: Paramdigma.Core.Geometry
Assembly: Paramdigma.Core.dll
Syntax
public class Vector2d : object
Constructors
| Improve this Doc View SourceVector2d(Point2d)
Initializes a new instance of the Vector2d class from a point.
Declaration
public Vector2d(Point2d point)
Parameters
Type | Name | Description |
---|---|---|
Point2d | point | Point to convert. |
Vector2d(Vector2d)
Initializes a new instance of the Vector2d class from another vector.
Declaration
public Vector2d(Vector2d vector)
Parameters
Type | Name | Description |
---|---|---|
Vector2d | vector | Vector to duplicate. |
Vector2d(Double, Double)
Initializes a new instance of the Vector2d class.
Declaration
public Vector2d(double x, double y)
Parameters
Type | Name | Description |
---|---|---|
System.Double | x | X coordinate. |
System.Double | y | Y coordinate. |
Properties
| Improve this Doc View SourceLength
Gets the length of the vector.
Declaration
public double Length { get; }
Property Value
Type | Description |
---|---|
System.Double |
LengthSquared
Gets the squared length of the vector.
Declaration
public double LengthSquared { get; }
Property Value
Type | Description |
---|---|
System.Double |
WorldX
Gets a vector in the World X direction {1;0}.
Declaration
public static Vector2d WorldX { get; }
Property Value
Type | Description |
---|---|
Vector2d |
WorldY
Gets a vector in the World Y direction {0;1}.
Declaration
public static Vector2d WorldY { get; }
Property Value
Type | Description |
---|---|
Vector2d |
X
Gets or sets the X Coordininate of the vector.
Declaration
public double X { get; set; }
Property Value
Type | Description |
---|---|
System.Double | X coordinate. |
Y
Gets or sets the Y coordinate of the vector.
Declaration
public double Y { get; set; }
Property Value
Type | Description |
---|---|
System.Double | Y coordinate. |
Methods
| Improve this Doc View SourceDotProduct(Vector2d)
Computes the dot product between this vector and the given one.
Declaration
public double DotProduct(Vector2d vector)
Parameters
Type | Name | Description |
---|---|---|
Vector2d | vector | Vector to compute dot-product with. |
Returns
Type | Description |
---|---|
System.Double | Dot product result. |
Equals(Object)
Checks if the vector is equal to an object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | Object to compare. |
Returns
Type | Description |
---|---|
System.Boolean | True if equal. |
GetHashCode()
Get the hashCode of the vector.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Perp()
Returns a CCW perpendicular vector to the current instance.
Declaration
public Vector2d Perp()
Returns
Type | Description |
---|---|
Vector2d |
PerpProduct(Vector2d)
Computes the perp product between this vector and the given one.
Declaration
public double PerpProduct(Vector2d vector)
Parameters
Type | Name | Description |
---|---|---|
Vector2d | vector | Vector to compute perp-product with. |
Returns
Type | Description |
---|---|
System.Double | Perp product result. |
ToString()
Gets the string representation of the vector.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Unit()
Returns a unit vector of this vector.
Declaration
public Vector2d Unit()
Returns
Type | Description |
---|---|
Vector2d | New vector of unit lenght. |
Unitize()
Force this vector to be unit length.
Declaration
public void Unitize()
Operators
| Improve this Doc View SourceAddition(Vector2d, Vector2d)
Sums two vectors together.
Declaration
public static Vector2d operator +(Vector2d v, Vector2d v2)
Parameters
Type | Name | Description |
---|---|---|
Vector2d | v | Vector A. |
Vector2d | v2 | Vector B. |
Returns
Type | Description |
---|---|
Vector2d |
Division(Vector2d, Double)
Divides a vector with a number.
Declaration
public static Vector2d operator /(Vector2d v, double scalar)
Parameters
Type | Name | Description |
---|---|---|
Vector2d | v | Vector. |
System.Double | scalar | Number to divide vector with. |
Returns
Type | Description |
---|---|
Vector2d |
Equality(Vector2d, Vector2d)
Checks for equality between two vectors.
Declaration
public static bool operator ==(Vector2d v, Vector2d w)
Parameters
Type | Name | Description |
---|---|---|
Vector2d | v | Vector A. |
Vector2d | w | Vector B. |
Returns
Type | Description |
---|---|
System.Boolean |
Inequality(Vector2d, Vector2d)
Checks for inequality between two vectors.
Declaration
public static bool operator !=(Vector2d v, Vector2d w)
Parameters
Type | Name | Description |
---|---|---|
Vector2d | v | Vector A. |
Vector2d | w | Vector B. |
Returns
Type | Description |
---|---|
System.Boolean |
Multiply(Vector2d, Double)
Multiplies a vector with a number.
Declaration
public static Vector2d operator *(Vector2d v, double scalar)
Parameters
Type | Name | Description |
---|---|---|
Vector2d | v | Vector. |
System.Double | scalar | Number to multiply vector with. |
Returns
Type | Description |
---|---|
Vector2d |
Multiply(Double, Vector2d)
Multiplies a vector with a number.
Declaration
public static Vector2d operator *(double scalar, Vector2d v)
Parameters
Type | Name | Description |
---|---|---|
System.Double | scalar | Number to multiply vector with. |
Vector2d | v | Vector. |
Returns
Type | Description |
---|---|
Vector2d |
Subtraction(Vector2d, Vector2d)
Substracts one vector from another.
Declaration
public static Vector2d operator -(Vector2d v, Vector2d v2)
Parameters
Type | Name | Description |
---|---|---|
Vector2d | v | Vector A. |
Vector2d | v2 | Vector B. |
Returns
Type | Description |
---|---|
Vector2d |
UnaryNegation(Vector2d)
Negates the values of the vector.
Declaration
public static Vector2d operator -(Vector2d v)
Parameters
Type | Name | Description |
---|---|---|
Vector2d | v | Vector. |
Returns
Type | Description |
---|---|
Vector2d |