User Tools

Site Tools


addons:using_libs:mathex

Mathex Library

The mathex library exposes more functions to the built-in Lua math library.

The following functions are exposed by this library:

number Distance2D(number x1, number y1, number x2, number y2);

  • Parameters
    • x1 - The first coords X axis.
    • y1 - The first coords Y axis.
    • x2 - The second coords X axis.
    • y2 - The second coords Y axis.
  • Returns
    • number - The distance between the two given coords.

number Distance3D(number x1, number y1, number z1, number x2, number y2, number z2);

  • Parameters
    • x1 - The first coords X axis.
    • y1 - The first coords Y axis.
    • z1 - The first coords Z axis.
    • x2 - The second coords X axis.
    • y2 - The second coords Y axis.
    • z2 - The second coords Z axis.
  • Returns
    • number - The distance between the two given coords.

number DegreeToRadian(number deg);

  • Parameters
    • deg - The degree to convert to a radian.
  • Returns
    • number - The converted radian.

number RadianToDegree(number rad);

  • Parameters
    • rad - The radian to convert to a degree.
  • Returns
    • number - The converted degree.

number Clamp(number num, number l, number h);

  • Parameters
    • num - The number to clamp.
    • l - The low value to clamp within.
    • h - The high value to clamp within.
  • Returns
    • number - The clamped value.

number Round(number num, number dp);

  • Parameters
    • num - The number to round.
    • dp - The number of decimal places to round to.
  • Returns
    • number - The rounded value.

number ToD3DColor(number a, number r, number g, number b);

  • Parameters
    • a - The alpha color.
    • r - The red color.
    • g - The green color.
    • b - The blue color.
  • Returns
    • number - The 32bit color code.
addons/using_libs/mathex.txt · Last modified: 2015/11/19 23:05 by atom0s