for 0.0.1
Show:

# Vector2 Class

Represents a 2 dimensionnal Euclidean Vector, to be used as 2D positions, 2D directions or 2D Euler angles (rotation).

This class extends the one from Three.js, API available here : http://threejs.org/docs/#Reference/Math/Vector2

## Methods

(
• `v`
)

Vector2

### `addScalar`

(
• `s`
)

Add the scalar value s to this vector's x and y values.

#### Parameters:

• `s` Float

Vector2

### `addScaledVector`

(
• `v`
• `s`
)

#### Parameters:

• `v` Vector2
• `s` Float

Vector2

(
• `a`
• `b`
)

Vector2

()

Float

()

Vector2

### `clamp`

(
• `min`
• `max`
)

If this vector's x or y value is greater than the max vector's x or y value, it is replaced by the corresponding value. If this vector's x or y value is less than the min vector's x or y value, it is replaced by the corresponding value.

Vector2

### `clampScalar`

(
• `min`
• `max`
)

If this vector's x or y values are greater than the max value, they are replaced by the max value. If this vector's x or y values are less than the min value, they are replaced by the min value.

#### Parameters:

• `min` Float
• `max` Float

Vector2

()

Vector2

(
• `v`
)

Vector2

(
• `v`
)

Float

(
• `v`
)

Float

### `divideScalar`

(
• `s`
)

#### Parameters:

• `s` Float

Vector2

(
• `v`
)

Float

(
• `v`
)

Boolean

()

Vector2

### `fromArray`

(
• `array`
)

Sets this vector's x value to be array[0 and y value to be array[1].

#### Parameters:

• `array` Array

Vector2

### `getComponent`

(
• `index`
)

if index equals 0 returns the x value. if index equals 1 returns the y value.

#### Parameters:

• `index` Integer

Float

()

Float

()

Float

()

Float

### `lerp`

(
• `v`
• `alpha`
)

Linear interpolation between this vector and v, where alpha is the percent along the line.

#### Parameters:

• `v` Vector2
• `alpha` Float

Vector2

### `lerpVectors`

(
• `v1`
• `v2`
• `alpha`
)

Sets this vector to be the vector linearly interpolated between v1 and v2 with alpha factor.

#### Parameters:

• `v1` Vector2
• `v2` Vector2
• `alpha` Float

Vector2

### `max`

(
• `v`
)

If this vector's x or y value is less than v's x or y value, replace that value with the corresponding max value.

Vector2

### `min`

(
• `v`
)

If this vector's x or y value is greater than v's x or y value, replace that value with the corresponding min value.

Vector2

### `multiplyScalar`

(
• `s`
)

#### Parameters:

• `s` Float

Vector2

()

Vector2

()

Vector2

()

Vector2

()

Vector2

### `set`

(
• `x`
• `y`
)

#### Parameters:

• `x` Float
• `y` Float

Vector2

### `setComponent`

(
• `index`
• `value`
)

if index equals 0 method replaces this.x with value. if index equals 1 method replaces this.y with value.

#### Parameters:

• `index` Integer
• `value` Float

undefined

### `setLength`

(
• `l`
)

#### Parameters:

• `l` Float

Vector2

### `setX`

(
• `x`
)

replace this vector's x value with x.

#### Parameters:

• `x` Float

Vector2

(
• `v`
)

Vector2

(
• `a`
• `b`
)

Vector2

### `toArray`

(
• `array`
)

Returns an array [x, y]

#### Parameters:

• `array` Array

Array

## Properties

### `one`

Unknown static

Vector2.one returns new Mobilizing.Vector2(1, 1)

### `zero`

Unknown static

Vector2.zero returns new Mobilizing.Vector2(0, 0)