### EndGate.Vector2d

** Description**: Defines a two dimensional vector object which specifies an X and Y.

** Implements**: EndGate.ICloneable

#### Constructors

**Vector2d ()**

*Creates a new instance of Vector2d with the X and Y components initialized to 0.*

**Vector2d (x, y)**

*Creates a new instance of Vector2d.*

**x**: number

*Initial value of the X component of the Vector2d.*

**y**: number

*Initial value of the Y component of the Vector2d.*

#### Fields

**X**: number

*Gets or sets the X component of the vector.*

**Y**: number

*Gets or sets the Y component of the vector.*

#### Methods

**Reflect()**

*Returns a Vector2d that's reflected over the normal.*

**ProjectOnto()**

*Returns a Vector2d that represents the current Vector2d projected onto the provided Vector2d.*

**RotateAround()**

*Returns a Vector2d that represents the current Vector2d rotated around the provided point and angle.*

**Apply()**

*Executes the action with the X and Y components of this Vector2d and sets the X and Y components to the corresponding return values.*

**Trigger()**

*Executes the action with the X and Y components of this Vector2d.*

**Normalized()**

*Returns the current vector as a unit vector. The result is a vector one unit in length pointing in the same direction as the original vector.*

**Magnitude()**

*Calculates the magnitude or length of the vector*

**Length()**

*Calculates the length or magnitude of the vector*

**Dot()**

*Calculates dot product.*

**Abs()**

*Returns a Vector2d that has the current Vector2d's X and Y components as positive values.*

**Sign()**

*Returns a Vector2d that has its X and Y components converted to -1, 0 or 1 depending on the current Vector2d's component values.*

**Unit()**

*Returns the unit vector of the current vector.*

**Distance()**

*Calculates the distance between the current vector and the provided one.*

**Add()**

*Returns a Vector2d that is the result of adding the X and Y of this Vector2d to the X and Y of the provided Vector2d.*

**Multiply()**

*Returns a Vector2d that is the result of multiplying the X and Y of this Vector2d by the X and Y of the provided Vector2d.*

**Subtract()**

*Returns a Vector2d that is the result of subtracting the X and Y of this Vector2d by the X and Y of the provided Vector2d.*

**SubtractFrom()**

*Returns a Vector2d that is the result of subtracting the X and Y of this Vector2d from the X and Y of the provided Vector2d.*

**Divide()**

*Returns a Vector2d that is the result of dividing the X and Y of this Vector2d by the X and Y of the provided Vector2d.*

**DivideFrom()**

*Returns a Vector2d that is the result of dividing the X and Y of this Vector2d from the X and Y of the provided Vector2d.*

**IsZero()**

*Determines whether this Vector2d's X and Y components are zero.*

**Negate()**

*Returns a Vector2d that is the negated version of this Vector2d.*

**Equivalent()**

*Determines whether this Vector2d has the same X and Y of the provided Vector2d.*

**Clone()**

*Returns a Vector2d that has an identical X and Y component as the current Vector2d.*

**toString()**

*Overridden toString method to display Vector2d in the (X, Y) format.*

#### Examples

The following code example demonstrates the creation of a Vector2d.

**Snippet Author**: *N. Taylor Mullen*