|
QCAD Application Framework
CAD Application Development and Automation.
|
Math functions. More...
#include <RMath.h>
Static Public Member Functions | |
| static int | absmod (int a, int b) |
| static QString | angleToString (double a) |
| Converts the given string to an angle. | |
| static double | deg2rad (double a) |
| Converts degrees to radians. | |
| static double | eval (const QString &expression, bool *ok=NULL) |
| static bool | fuzzyCompare (double v1, double v2, double tolerance=RS::PointTolerance) |
| static double | getAngleDifference (double a1, double a2) |
| static double | getAngleDifference180 (double a1, double a2) |
| static void | getBiQuadRoots (double p[], double r[][5]) |
| static void | getCubicRoots (double p[], double r[][5]) |
| static QString | getError () |
| static int | getGcd (int a, int b) |
| Finds greatest common divider using Euclid's algorithm. | |
| static double | getNormalizedAngle (double a) |
Gets the normalized angle from a. | |
| static void | getQuadRoots (double p[], double r[][5]) |
| static double | gra2deg (double a) |
| Converts grads to degrees. | |
| static bool | hasError () |
| static bool | isAngleBetween (double a, double a1, double a2, bool reversed) |
| Tests if angle a is between a1 and a2. | |
| static bool | isAngleReadable (double angle, double tolerance=RS::AngleTolerance) |
| static bool | isInf (double v) |
| static bool | isNaN (double v) |
| static bool | isNormal (double v) |
| static bool | isSameDirection (double dir1, double dir2, double tol=RS::AngleTolerance) |
| Tests if two angels point approximately in the same direction. | |
| static double | makeAngleReadable (double angle, bool readable=true, bool *corrected=NULL) |
| Adds 180° to the given angle if a text constructed with that angle otherwise wouldn't be readable. | |
| static int | mround (double v) |
| Rounds the given double to the next int. | |
| static double | parseScale (const QString &scaleString) |
| static double | pow (double x, double y) |
| Safe pow function. | |
| static double | rad2deg (double a) |
| Converts radians to degrees. | |
| static double | rad2gra (double a) |
| Converts radians to gradians. | |
| static void | simplify (int numerator, int denominator, int &numeratorRes, int &denominatorRes) |
| template<class T > | |
| static void | swap (T &a, T &b) |
| Swaps two given values. | |
| static void | toFraction (double v, int maxDenominator, int &number, int &numerator, int &denominator) |
| static QString | toFractionString (double v, int maxDenominator) |
| static double | trunc (double v) |
Static Private Attributes | |
| static QString | lastError = "" |
Math functions.
|
static |
|
static |
Converts the given string to an angle.
Accepted formats are: #.## for an angle in degrees, #.##r for an angle in rad, #.##g for an angle in gon,
|
static |
Converts degrees to radians.
| a | angle in degrees |
|
static |
|
static |
|
static |
| a1 | first angle in rad |
| a2 | s second angle in rad |
|
static |
| a1 | first angle in rad |
| a2 | s second angle in rad |
|
static |
\par Non-Scriptable:
This function is not available in script environments.
|
static |
\par Non-Scriptable:
This function is not available in script environments.
|
static |
|
static |
Finds greatest common divider using Euclid's algorithm.
| a | the first number |
| b | the second number |
a and b.
|
static |
Gets the normalized angle from a.
Used to make sure that an angle is in the range between 0 and 2 pi.
| a | the unnormalized angle, e.g. 8 |
a normalized to the range of
, e.g. normalized angle from 8 is 1.716.
|
static |
\par Non-Scriptable:
This function is not available in script environments.
|
static |
Converts grads to degrees.
| a | angle in grad (gon) |
|
static |
|
static |
Tests if angle a is between a1 and a2.
a, a1 and a2 must be in the range between 0 and 2*PI. All angles in rad.
| a | the test angle |
| a1 | the lower limiting angle |
| a2 | the upper limiting angle |
| reversed | True for clockwise testing. False for ccw testing. |
|
static |
| angle | the angle in rad |
| tolerance | The tolerance by which the angle still maybe in the unreadable range. |
|
static |
|
static |
|
static |
|
static |
Tests if two angels point approximately in the same direction.
| dir1 | first direction |
| dir2 | second direction |
| tolerance | Tolerance in rad. |
| true | The two angles point in the same direction. |
| false | The difference between the two angles is at least tolerance radians. |
|
static |
Adds 180° to the given angle if a text constructed with that angle otherwise wouldn't be readable.
Used for dimension texts and for mirroring texts.
| angle | the original angle |
| readable | true: make angle readable, false: unreadable |
| corrected | Pointer to boolean that will point to true if the given angle was corrected, false otherwise, or null. |
angle + pi, depending which one is readable from the bottom or right.
|
inlinestatic |
Rounds the given double to the next int.
|
static |
|
static |
Safe pow function.
| x | the base |
| y | the exponent |
|
static |
Converts radians to degrees.
| a | angle in radians |
|
static |
Converts radians to gradians.
| a | angle in radians |
|
static |
|
inlinestatic |
Swaps two given values.
\par Non-Scriptable:
This function is not available in script environments.
|
static |
|
static |
|
static |
|
staticprivate |