Class Reference math

Mathematic function to use in LayoutEditor C++ Macros. More...

Member

double abs(double x)
double acos(double x)
double asin(double x)
double atan(double x)
double atan2(double x,double y)
double ceil(double x)
double cos(double x)
double cosh(double x)
double exp(double a)
double floor(double a)
double log10(double a)
double log(double x)
double pow(double x,double y)
int random(int maxInt)
double round(double x)
double sin(double x)
double sinh(double x)
double sqrt(double x)
double tan(double x)
double tanh(double x)
double trunc(double x)
const double e
const double ln10
const double ln2
const double log10e
const double log2e
const double pi
const double pi_2
const double pi_4
const double sqrt1_2
const double sqrt2

Detailed Description

math is a static hub of functions and constants, similar to the C library math.h. There is no object to construct: call math::sin, math::sqrt, or math::pi with the class name. Trigonometry uses radians. abs, floor, ceil, round, and trunc fold a value onto the integers; pow, exp, and log cover powers and logarithms; random returns an integer in 0 … maxInt. The constants pi, e, sqrt2, and the others are static const double. This class exists only for LayoutEditor C++ macros. Python scripts use the language's own math module instead.

Example:

double radius = math::acos(0.5678);
double circumference = 2 * math::pi * radius;
double y = math::sin(math::pi_2);
int r = math::random(100);

Member Function Documentation


static double math::abs(double x)

The absolute value of x: x if x is positive, and −x if x is negative.

Returns: abs(x)


static double math::acos(double x)

The arc cosine of x; that is the value whose cosine is x. Also called inverse cosine.

Returns: acos(x)

Example:

double d=math::acos(0.5678);

static double math::asin(double x)

The principal value of the arc sine of x; that is the value whose sine is x. Also called inverse sine.

Returns: asin(x)


static double math::atan(double x)

The principal value of the arc tangent of x; that is the value whose tangent is x.

Returns: atan(x)


static double math::atan2(double x,double y)

The four-quadrant inverse tangent of the pair x, y. Unlike atan, which takes a single ratio, atan2 takes both coordinates. (introduced with release 20260423)

Returns: atan2(x, y)


static double math::ceil(double x)

The smallest integral value that is not less than x.

Returns: ceil(x)


static double math::cos(double x)

The cosine of x, where x is in radians.

Returns: cos(x)


static double math::cosh(double x)

The hyperbolic cosine of x, defined as:

cosh(x) = (exp(x) + exp(-x)) / 2

Returns: cosh(x)


static double math::exp(double a)

e (the base of natural logarithms) raised to the power of a.

Returns: exp(a)


static double math::floor(double a)

The largest integral value that is not greater than a.

Returns: floor(a)


static double math::log10(double a)

The base-10 logarithm of a.

Returns: log10(a)


static double math::log(double x)

The natural logarithm of x.

Returns: log(x)


static double math::pow(double x,double y)

x raised to the power of y.

Returns: pow(x, y)


static int math::random(int maxInt)

Returns: a random integer between 0 and maxInt. (introduced with release 20260423)


static double math::round(double x)

Rounds x to the nearest integer.

Returns: round(x)


static double math::sin(double x)

The sine of x, where x is in radians.

Returns: sin(x)


static double math::sinh(double x)

The hyperbolic sine of x, defined as:

sinh(x) = (exp(x) - exp(-x)) / 2

Returns: sinh(x)


static double math::sqrt(double x)

The non-negative square root of x.

Returns: sqrt(x)


static double math::tan(double x)

The tangent of x, where x is in radians.

Returns: tan(x)


static double math::tanh(double x)

The hyperbolic tangent of x, defined as:

tanh(x) = sinh(x) / cosh(x)

Returns: tanh(x)


static double math::trunc(double x)

The nearest integral value that is not larger in magnitude than x.

Returns: trunc(x)


static const double math::e

Returns: 2.71828182845904523536


static const double math::ln10

Returns: ln(10)=2.30258509299404568402


static const double math::ln2

Returns: ln(2)=0.693147180559945309417


static const double math::log10e

Returns: log10(e)=0.434294481903251827651


static const double math::log2e

Returns: log2(e)=1.44269504088896340736


static const double math::pi

Returns: 3.14159265358979323846


static const double math::pi_2

Returns: pi/2=1.57079632679489661923


static const double math::pi_4

Returns: pi/4=0.785398163397448309616


static const double math::sqrt1_2

Returns: 1/sqrt(2)=0.707106781186547524401


static const double math::sqrt2

Returns: sqrt(2)=1.41421356237309504880