2-dimensional vector class

### `staticdegrees:Float`

The angle formed by the vector with the horizontal axis (in degrees)

### `staticread onlydx:Float`

The horizontal component of the unit vector

### `staticread onlydy:Float`

The vertical component of the unit vector

### `staticlength:Float`

Length of the vector

### `staticread onlylengthSquared:Float`

length of the vector squared

### `staticread onlylx:Float`

The horizontal component of the left normal of the vector

### `staticread onlyly:Float`

The vertical component of the left normal of the vector

### `staticradians:Float`

The angle formed by the vector with the horizontal axis (in radians)

### `staticread onlyrx:Float`

The horizontal component of the right normal of the vector

### `staticread onlyry:Float`

The vertical component of the right normal of the vector

### `@:value({ y : 0, x : 0 })staticinlineadd(this:FlxPoint, x:Float = 0, y:Float = 0):FlxVector`

Adds to the coordinates of this point.

Parameters:

`x` Amount to add to x Amount to add to y

Returns:

This point.

### `staticinlineaddNew(this:FlxPoint, v:FlxVector):FlxVector`

Return new vector which equals to sum of this vector and passed v vector.

Parameters:

`v` vector to add

Returns:

### `staticinlineaddPoint(this:FlxPoint, point:FlxPoint):FlxVector`

Adds the coordinates of another point to the coordinates of this point.

Parameters:

`point` The point to add to this point

Returns:

This point.

### `@:value({ bounceCoeff : 1 })staticinlinebounce(this:FlxPoint, normal:FlxVector, bounceCoeff:Float = 1):FlxVector`

Reflect the vector with respect to the normal of the "wall".

Parameters:

`normal` left normal of the "wall". It must be normalized (no checks) bounce coefficient (0 <= bounceCoeff <= 1)

Returns:

reflected vector (angle of incidence equals to angle of reflection)

### `@:value({ friction : 0, bounceCoeff : 1 })staticinlinebounceWithFriction(this:FlxPoint, normal:FlxVector, bounceCoeff:Float = 1, friction:Float = 0):FlxVector`

Reflect the vector with respect to the normal. This operation takes "friction" into account.

Parameters:

`normal` left normal of the "wall". It must be normalized (no checks) bounce coefficient (0 <= bounceCoeff <= 1) friction coefficient

Returns:

reflected vector

### `staticinlineceil(this:FlxPoint):FlxVector`

Rounds x and y using Math.ceil()

### `staticclone(this:FlxPoint, ?vec:FlxVector):FlxVector`

Copies this vector.

Parameters:

`vec` optional vector to copy this vector to

Returns:

copy of this vector

### `staticinlinecopyFrom(this:FlxPoint, point:FlxPoint):FlxVector`

Helper function, just copies the values from the specified point.

Parameters:

`point` Any FlxPoint.

Returns:

A reference to itself.

### `staticinlinecopyFromFlash(this:FlxPoint, flashPoint:Point):FlxVector`

Helper function, just copies the values from the specified Flash point.

Parameters:

`Point` Any Point.

Returns:

A reference to itself.

### `staticinlinecrossProductLength(this:FlxPoint, v:FlxVector):Float`

Find the length of cross product between two vectors.

Parameters:

`v` vector to multiply

Returns:

the length of cross product of two vectors

### `staticinlinedegreesBetween(this:FlxPoint, v:FlxVector):Float`

The angle between vectors (in degrees).

Parameters:

`v` second vector, which we find the angle

Returns:

the angle in radians

### `staticinlinedist(this:FlxPoint, v:FlxVector):Float`

The distance between points

### `staticinlinedistSquared(this:FlxPoint, v:FlxVector):Float`

The squared distance between points

### `staticinlinedotProdWithNormalizing(this:FlxPoint, v:FlxVector):Float`

Dot product of vectors with normalization of the second vector.

Parameters:

`v` vector to multiply

Returns:

dot product of two vectors

### `staticinlinedotProduct(this:FlxPoint, v:FlxVector):Float`

Dot product between two vectors.

Parameters:

`v` vector to multiply

Returns:

dot product of two vectors

### `staticfindIntersection(this:FlxPoint, a:FlxVector, b:FlxVector, v:FlxVector, ?intersection:FlxVector):FlxVector`

Finding the point of intersection of vectors.

Parameters:

`a` start point of the vector start point of the v vector the second vector

Returns:

the point of intersection of vectors

### `staticfindIntersectionInBounds(this:FlxPoint, a:FlxVector, b:FlxVector, v:FlxVector, ?intersection:FlxVector):FlxVector`

Finding the point of intersection of vectors if it is in the "bounds" of the vectors.

Parameters:

`a` start point of the vector start point of the v vector the second vector

Returns:

the point of intersection of vectors if it is in the "bounds" of the vectors

### `staticinlinefloor(this:FlxPoint):FlxVector`

Rounds x and y using Math.floor()

### `@:value({ y : 0, x : 0 })staticinlineget(x:Float = 0, y:Float = 0):FlxVector`

Recycle or create new FlxVector. Be sure to put() them back into the pool after you're done with them!

Parameters:

`x` The X-coordinate of the point in space. The Y-coordinate of the point in space.

### `staticinlineisNormalized(this:FlxPoint):Bool`

Check the vector for unit length

### `staticinlineisParallel(this:FlxPoint, v:FlxVector):Bool`

Check for parallelism of two vectors.

Parameters:

`v` vector to check

Returns:

true - if they are parallel

### `staticinlineisPerpendicular(this:FlxPoint, v:FlxVector):Bool`

Check the perpendicularity of two vectors.

Parameters:

`v` vector to check

Returns:

true - if they are perpendicular

### `staticinlineisValid(this:FlxPoint):Bool`

Checking if this is a valid vector.

Returns:

true - if the vector is valid

### `staticinlineisZero(this:FlxPoint):Bool`

Check if this vector has zero length.

Returns:

true - if the vector is zero

### `staticleftNormal(this:FlxPoint, ?vec:FlxVector):FlxVector`

Left normal of the vector

### `staticinlinenegate(this:FlxPoint):FlxVector`

Change direction of the vector to opposite

### `staticnormalize(this:FlxPoint):FlxVector`

Normalization of the vector (reduction to unit length)

### `staticinlineperpProduct(this:FlxPoint, v:FlxVector):Float`

Dot product of left the normal vector and vector v.

### `staticprojectTo(this:FlxPoint, v:FlxVector, ?proj:FlxVector):FlxVector`

The projection of this vector to vector that is passed as an argument (without modifying the original Vector!).

Parameters:

`v` vector to project optional argument - result vector

Returns:

projection of the vector

### `staticprojectToNormalized(this:FlxPoint, v:FlxVector, ?proj:FlxVector):FlxVector`

Projecting this vector on the normalized vector v.

Parameters:

`v` this vector has to be normalized, ie have unit length optional argument - result vector

Returns:

projection of the vector

### `staticinlineradiansBetween(this:FlxPoint, v:FlxVector):Float`

Get the angle between vectors (in radians).

Parameters:

`v` second vector, which we find the angle

Returns:

the angle in radians

### `staticinlineratio(this:FlxPoint, a:FlxVector, b:FlxVector, v:FlxVector):Float`

Find the ratio between the perpProducts of this vector and v vector. This helps to find the intersection point.

Parameters:

`a` start point of the vector start point of the v vector the second vector

Returns:

the ratio between the perpProducts of this vector and v vector

### `staticrightNormal(this:FlxPoint, ?vec:FlxVector):FlxVector`

Right normal of the vector

### `staticrotate(this:FlxPoint, pivot:FlxPoint, angle:Float):FlxVector`

Rotates this point clockwise in 2D space around another point by the given angle.

Parameters:

`Pivot` The pivot you want to rotate this point around Rotate the point by this many degrees clockwise.

Returns:

A FlxPoint containing the coordinates of the rotated point.

### `staticinlinerotateByDegrees(this:FlxPoint, degs:Float):FlxVector`

Rotate the vector for a given angle.

Parameters:

`degs` angle to rotate

Returns:

rotated vector

### `staticinlinerotateByRadians(this:FlxPoint, rads:Float):FlxVector`

Rotate the vector for a given angle.

Parameters:

`rads` angle to rotate

Returns:

rotated vector

### `staticinlinerotateWithTrig(this:FlxPoint, sin:Float, cos:Float):FlxVector`

Rotate the vector with the values of sine and cosine of the angle of rotation.

Parameters:

`sin` the value of sine of the angle of rotation the value of cosine of the angle of rotation

Returns:

rotated vector

### `staticinlineround(this:FlxPoint):FlxVector`

Rounds x and y using Math.round()

### `staticinlinescale(this:FlxPoint, k:Float):FlxVector`

Scale this vector.

Parameters:

`k` scale coefficient

Returns:

scaled vector

### `staticinlinescaleNew(this:FlxPoint, k:Float):FlxVector`

Returns scaled copy of this vector.

Parameters:

`k` scale coefficient

Returns:

scaled vector

### `@:value({ y : 0, x : 0 })staticinlineset(this:FlxPoint, x:Float = 0, y:Float = 0):FlxVector`

Set the coordinates of this point object.

Parameters:

`x` The X-coordinate of the point in space. The Y-coordinate of the point in space.

### `staticinlinesetPolarDegrees(this:FlxPoint, length:Float, degrees:Float):FlxVector`

Sets the polar coordinates of the vector

Parameters:

`length` The length to set the vector The angle to set the vector, in degrees

Returns:

The rotated vector

Available since

4.10.0

.

### `staticsetPolarRadians(this:FlxPoint, length:Float, radians:Float):FlxVector`

Sets the polar coordinates of the vector

Parameters:

`length` The length to set the vector The angle to set the vector, in radians

Returns:

The rotated vector

Available since

4.10.0

.

### `staticsign(this:FlxPoint, a:FlxVector, b:FlxVector):Int`

The sign of half-plane of point with respect to the vector through the a and b points.

Parameters:

`a` start point of the wall-vector end point of the wall-vector

### `@:value({ y : 0, x : 0 })staticinlinesubtract(this:FlxPoint, x:Float = 0, y:Float = 0):FlxVector`

Subtracts from the coordinates of this point.

Parameters:

`x` Amount to subtract from x Amount to subtract from y

Returns:

This point.

### `staticinlinesubtractNew(this:FlxPoint, v:FlxVector):FlxVector`

Returns new vector which is result of subtraction of v vector from this vector.

Parameters:

`v` vector to subtract

Returns:

subtraction result

### `staticinlinesubtractPoint(this:FlxPoint, point:FlxPoint):FlxVector`

Subtracts the coordinates of another point from the coordinates of this point.

Parameters:

`point` The point to subtract from this point

Returns:

This point.

### `staticinlinetransform(this:FlxPoint, matrix:Matrix):FlxVector`

Applies transformation matrix to this point

Parameters:

`matrix` transformation matrix

Returns:

transformed point

### `staticinlinetruncate(this:FlxPoint, max:Float):FlxVector`

Limit the length of this vector.

Parameters:

`max` maximum length of this vector

### `@:value({ y : 0, x : 0 })staticinlineweak(x:Float = 0, y:Float = 0):FlxVector`

Recycle or create a new FlxVector which will automatically be released to the pool when passed into a flixel function.

Parameters:

`x` The X-coordinate of the point in space. The Y-coordinate of the point in space.
Available since

4.6.0

.

Vector reset