Skip to content

Misc

The Misc package introduces various helper functions that did not fit into any other package.

Dependencies

Initialization

N/A

Implementation

Misc.d on GitHub

Constants

Misc package implements the phi constant

const int phi = 1070141312; // PI/2
which is actually pi divided by 2 saved as an ikarus float.

Decimal: 1.5707...

Functions

atan2f

Calculates the arcus tangent of an angle between the origin and (x, y) point.

func int atan2f(var int x, var int y)
Parameters
  • var int x
    X-coordinate
  • var int y
    Y-coordinate

Return value

The function returns arcus tangent in radians as Ikarus float.

sin

Calculates the sine of an angle given in radians.

func int sin(var int angle)
Parameters
  • var int angle
    The angle in radians as a Ikarus float

Return value

The function returns sine of the angle as Ikarus float.

cos

Calculates the cosine of an angle given in radians.

func int cos(var int angle)
Parameters
  • var int angle
    The angle in radians as a Ikarus float

Return value

The function returns cosine of the angle as Ikarus float.

tan

Calculates the tangent of an angle given in radians.

func int tan(var int angle)
Parameters
  • var int angle
    The angle in radians as a Ikarus float

Return value

The function returns tangent of the angle as Ikarus float.

asin

Calculates the arcus sine.

func int asin(var int sine)
Parameters
  • var int sine
    The sine of an angle as a Ikarus float

Return value

The function returns arcus sine of the angle as Ikarus float.

acos

Calculates the arcus cosine

func int acos(var int cosine)
Parameters
  • var int cosine
    The cosine of an angle as a Ikarus float

Return value

The function returns arcus cosine of the angle as Ikarus float.

distance2D

Calculates the distance between two points on a two-dimensional plane.

func int distance2D(var int x1, var int x2, var int y1, var int y2)
Parameters
  • var int x1
    X-coordinate of the first point
  • var int x2
    X-coordinate of the second point
  • var int y1
    Y-coordinate of the first point
  • var int y2
    Y-coordinate of the second point

Return value

The function returns the distance between the two points.

distance2Df

Calculates the distance between two points on a two-dimensional plane but parameters and return values are Ikarus floats.

func int distance2Df(var int x1, var int x2, var int y1, var int y2)
Parameters
  • var int x1
    X-coordinate of the first point
  • var int x2
    X-coordinate of the second point
  • var int y1
    Y-coordinate of the first point
  • var int y2
    Y-coordinate of the second point

Return value

The function returns the distance between the two points as Ikarus float.