# class LM_Vector2

The Vector2 class is used to represent a 2D vector or point.

## Member Variables

`x (float)`

The x (or horizontal) coordinate of the vector.

`y (float)`

The y (or vertical) coordinate of the vector.

## Member Functions

`void Set(x, y)`

Set the value of a vector. This function is an alternative to setting the x and y values individually.

```x (float): the x value you wish to set
y (float): the y value you wish to set
Return value: none```

`void Set(vec)`

Set the value of a vector by copying an existing vector.

```vec (Vector2): another Vector2 object whose value you wish to copy
Return value: none```

`float Dot(vec)`

Computes the dot product of this vector and a second one.

```vec (Vector2): a Vector2 object
Return value (float): the dot product of the calling vector and the passed in argument```

`float Mag()`

Computes the magnitude of a vector.

`Return value (float): the vector's magnitude (length)`

`float SquaredMag()`

Computes the squared magnitude of a vector.

`Return value (float): the vector's squared magnitude`

`Vector2 Norm()`

Returns a normalized copy of the vector. The vector object is unchanged, and normalized copy is returned. The normalized vector will have a length of 1.0.

`Return value (Vector2): a normalized copy of the original vector`

`void NormMe()`

Normalizes a vector. The vector is normalized (adjusted so that it points in the same direction, but has a length of one) in place, adjusting the x and y values as necessary.

`Return value: none`

`Vector2 GetOrthogonal()`

Returns a vector that points 90 degrees away from the orignal vector.

`Return value (Vector2): a new vector, pointing 90 degrees away from the original`

`void Rotate(angle)`

Rotates the vector by the specified angle.

```angle (float): the angle (in radians) to rotate the vector
Return value: none```

`Vector2 operator+(vec)`

Adds two vectors and returns the result as a new vector. This operator makes it possible to add two vectors as if they were regular numbers. Example: c = a + b.

```vec (Vector2): a vector to add to the first one
Return value (Vector2): the sum of two vectors```

`Vector2 operator-(vec)`

Subtracts one vector from another and returns the result as a new vector. This operator makes it possible to subtract vectors as if they were regular numbers. Example: c = a - b.

```vec (Vector2): a vector to subtract from the first one
Return value (Vector2): the difference of two vectors```

`Vector2 operator*(num)`

Multiplies a vector by a number, returning the result as a new vector. Example: v2 = v * 3.

```num (float): a number to multiply the vector by
Return value (Vector2): the original vector, multiplied by the number "num"```

`Vector2 operator/(num)`

Divides a vector by a number, returning the result as a new vector. Example: v2 = v / 3.

```num (float): a number to divide the vector by
Return value (Vector2): the original vector, divided by the number "num"```
```
class LM_Vector2 @ Vector2 {
LM_Vector2();
~LM_Vector2();

void Set(real vx, real vy);
void Set(const LM_Vector2 &vec2);

real Dot(const LM_Vector2 &vec2);

real Mag();
real SquaredMag();

LM_Vector2 Norm();
void NormMe();

LM_Vector2 GetOrthogonal();
void Rotate(real angle);

LM_Vector2 operator+(const LM_Vector2 &vec2);
LM_Vector2 operator-(const LM_Vector2 &vec2);
LM_Vector2 operator*(real f);
LM_Vector2 operator/(real f);

real  x;
real  y;
};```