Angle object

Holds an angle value.

Angle values are constructed by global rad(float) or deg(integer) functions.

Angle literals are numeric values with unit designators. All these expressions evaluate to true:

360deg instanceof Angle;
360deg == Math.PI * 2 * 1rad;
360deg == 400grad;
360deg == 1turn;
1turn / 2 == 180deg;

TIScript supports all angle units defined by CSS:

  • deg  - degree, there are 360 degrees in full circle;
  • rad - radians, 2*π radians in full circle;
  • grad - gradians, 400 gradians in full circle;
  • turn - turns, 1 turn is exactly 360 degree - one full circle
  • Constants

    N/A

    Properties

    degrees
    read-only, float, number of degrees.
    radians
    read-only, float, number of radians.

    Methods

    parse

    (s: string) : angle

    Static method (of the class), parses the string using CSS rules.

    toFloat

    () : float

    Returns number of radians.

    toInteger()

    () : integer

    Returns number of degrees.

    toString()

    () : string

    Returns "NNNrad" string where NNN is a number of radians.

    morph

    ( from : angle, to:angle, ratio: float ) : angle

    Computes the average angle using the formula: (to - from) * ratio + from .