Mathematic function to use in LayoutEditor C++ Macros. More...
| 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 |
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);
The absolute value of x: x if x is positive, and −x if x is negative.
Returns: abs(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);
The principal value of the arc sine of x; that is the value whose sine is x. Also called inverse sine.
Returns: asin(x)
The principal value of the arc tangent of x; that is the value whose tangent is x.
Returns: atan(x)
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)
The smallest integral value that is not less than x.
Returns: ceil(x)
The cosine of x, where x is in radians.
Returns: cos(x)
The hyperbolic cosine of x, defined as:
cosh(x) = (exp(x) + exp(-x)) / 2
Returns: cosh(x)
e (the base of natural logarithms) raised to the power of a.
Returns: exp(a)
The largest integral value that is not greater than a.
Returns: floor(a)
The base-10 logarithm of a.
Returns: log10(a)
The natural logarithm of x.
Returns: log(x)
x raised to the power of y.
Returns: pow(x, y)
Returns: a random integer between 0 and maxInt. (introduced with release 20260423)
Rounds x to the nearest integer.
Returns: round(x)
The sine of x, where x is in radians.
Returns: sin(x)
The hyperbolic sine of x, defined as:
sinh(x) = (exp(x) - exp(-x)) / 2
Returns: sinh(x)
The non-negative square root of x.
Returns: sqrt(x)
The tangent of x, where x is in radians.
Returns: tan(x)
The hyperbolic tangent of x, defined as:
tanh(x) = sinh(x) / cosh(x)
Returns: tanh(x)
The nearest integral value that is not larger in magnitude than x.
Returns: trunc(x)
Returns: 2.71828182845904523536
Returns: ln(10)=2.30258509299404568402
Returns: ln(2)=0.693147180559945309417
Returns: log10(e)=0.434294481903251827651
Returns: log2(e)=1.44269504088896340736
Returns: 3.14159265358979323846
Returns: pi/2=1.57079632679489661923
Returns: pi/4=0.785398163397448309616
Returns: 1/sqrt(2)=0.707106781186547524401
Returns: sqrt(2)=1.41421356237309504880