Math¶
Math functions, in doubles, with the usual names. Angles are in radians.
sin¶
double Math::sin(double)
The sine of an angle.
Example
double y = Math::sin(angle) * radius;
cos¶
double Math::cos(double)
The cosine of an angle.
Example
double x = Math::cos(angle) * radius;
tan¶
double Math::tan(double)
The tangent of an angle.
Example
double slope = Math::tan(angle);
asin¶
double Math::asin(double)
The angle whose sine this is.
Example
double angle = Math::asin(0.5);
acos¶
double Math::acos(double)
The angle whose cosine this is.
Example
double angle = Math::acos(0.5);
atan¶
double Math::atan(double)
The angle whose tangent this is.
Example
double angle = Math::atan(slope);
atan2¶
double Math::atan2(double, double)
The angle of the point (x, y) from the x axis: atan2(y, x), in the right quarter.
Example
double yaw = Math::atan2(dy, dx) * 180 / 3.14159265;
sqrt¶
double Math::sqrt(double)
The square root.
Example
double distance = Math::sqrt(dx * dx + dy * dy);
pow¶
double Math::pow(double, double)
A number to a power.
Example
double cubed = Math::pow(x, 3);
abs¶
double Math::abs(double)
The size of a number, without its sign.
Example
double gap = Math::abs(a - b);
floor¶
double Math::floor(double)
The whole number at or below.
Example
int whole = int(Math::floor(x));
ceil¶
double Math::ceil(double)
The whole number at or above.
Example
int pages = int(Math::ceil(count / 10.0));