A set of functions related to angle calculations.

### Static variables

### Static methods

`staticangleBetween(SpriteA:FlxSprite, SpriteB:FlxSprite, AsDegrees:Bool = false):Float`

Find the angle (in radians) between the two FlxSprite, taking their x/y and origin into account. The angle is calculated in clockwise positive direction (down = 90 degrees positive, right = 0 degrees positive, up = 90 degrees negative)

Parameters:

`SpriteA` | The FlxSprite to test from |
---|---|

`SpriteB` | The FlxSprite to test to |

`AsDegrees` | If you need the value in degrees instead of radians, set to true |

Returns:

The angle (in radians unless asDegrees is true)

`staticangleBetweenMouse(Object:FlxObject, AsDegrees:Bool = false):Float`

Find the angle (in radians) between an FlxSprite and the mouse, taking their x/y and origin into account. The angle is calculated in clockwise positive direction (down = 90 degrees positive, right = 0 degrees positive, up = 90 degrees negative)

Parameters:

`Object` | The FlxObject to test from |
---|---|

`AsDegrees` | If you need the value in degrees instead of radians, set to true |

Returns:

The angle (in radians unless AsDegrees is true)

`staticangleBetweenPoint(Sprite:FlxSprite, Target:FlxPoint, AsDegrees:Bool = false):Float`

Find the angle (in radians) between an FlxSprite and an FlxPoint. The source sprite takes its x/y and origin into account. The angle is calculated in clockwise positive direction (down = 90 degrees positive, right = 0 degrees positive, up = 90 degrees negative)

Parameters:

`Sprite` | The FlxSprite to test from |
---|---|

`Target` | The FlxPoint to angle the FlxSprite towards |

`AsDegrees` | If you need the value in degrees instead of radians, set to true |

Returns:

The angle (in radians unless AsDegrees is true)

`staticangleBetweenTouch(Object:FlxObject, Touch:FlxTouch, AsDegrees:Bool = false):Float`

Find the angle (in radians) between an FlxSprite and a FlxTouch, taking their x/y and origin into account. The angle is calculated in clockwise positive direction (down = 90 degrees positive, right = 0 degrees positive, up = 90 degrees negative)

Parameters:

`Object` | The FlxObject to test from |
---|---|

`Touch` | The FlxTouch to test to |

`AsDegrees` | If you need the value in degrees instead of radians, set to true |

Returns:

The angle (in radians unless AsDegrees is true)

`staticangleFromFacing(FacingBitmask:Int, AsDegrees:Bool = false):Float`

Translate an object's facing to angle.

Parameters:

`FacingBitmask` | Bitmask from which to calculate the angle, as in FlxSprite::facing |
---|---|

`AsDegrees` | If you need the value in degrees instead of radians, set to true |

Returns:

The angle (in radians unless AsDegrees is true)

`staticinlineasDegrees(radians:Float):Float`

Converts a Radian value into a Degree Converts the radians value into degrees and returns

Parameters:

`radians` | The value in radians |
---|

Returns:

Degrees

`staticinlineasRadians(degrees:Float):Float`

Converts a Degrees value into a Radian Converts the degrees value into radians and returns

Parameters:

`degrees` | The value in degrees |
---|

Returns:

Radians

`staticgetCartesianCoords(Radius:Float, Angle:Float, ?point:FlxPoint):FlxPoint`

Convert polar coordinates (radius + angle) to cartesian coordinates (x + y)

Parameters:

`Radius` | The radius |
---|---|

`Angle` | The angle, in degrees |

`point` | Optional FlxPoint if you don't want a new one created |

Returns:

The point in cartesian coords

`staticgetPolarCoords(X:Float, Y:Float, ?point:FlxPoint):FlxPoint`

Convert cartesian coordinates (x + y) to polar coordinates (radius + angle)

Parameters:

`X` | x position |
---|---|

`Y` | y position |

`point` | Optional FlxPoint if you don't want a new one created |

Returns:

The point in polar coords (x = Radius (degrees), y = Angle)

`staticsinCosGenerator(length:Dynamic, sinAmplitude:Dynamic, cosAmplitude:Dynamic, frequency:Dynamic):Dynamic`

Generate a sine and cosine table during compilation

The parameters allow you to specify the length, amplitude and frequency of the wave. You have to call this function with constant parameters and either use it on your own or assign it to FlxAngle.sincos

Parameters:

`length` | The length of the wave |
---|---|

`sinAmplitude` | The amplitude to apply to the sine table (default 1.0) if you need values between say -+ 125 then give 125 as the value |

`cosAmplitude` | The amplitude to apply to the cosine table (default 1.0) if you need values between say -+ 125 then give 125 as the value |

`frequency` | The frequency of the sine and cosine table data |

Returns:

Returns the cosine/sine table in a FlxSinCos

`staticwrapAngle(angle:Float):Float`

Keeps an angle value between -180 and +180 by wrapping it e.g an angle of +270 will be converted to -90 Should be called whenever the angle is updated on a FlxSprite to stop it from going insane.

Parameters:

`angle` | The angle value to check |
---|

Returns:

The new angle value, returns the same as the input angle if it was within bounds