|
QCAD
Open Source 2D CAD
|
Go to the documentation of this file.
23 #include "../core_global.h"
35 #define M_PI 3.14159265358979323846264338327950288
39 #define M_PI_2 1.57079632679489661923132169163975144
43 #define M_PI_4 0.785398163397448309615660845819875721
47 #define M_LN10 2.30258509299404568401799145468436421
51 #define M_LN2 0.693147180559945309417232121458176568
60 #define RMAXDOUBLE 1e300
61 #define RMINDOUBLE -1e300
63 #define RMAXDOUBLE std::numeric_limits<double>::max()
64 #define RMINDOUBLE -std::numeric_limits<double>::max()
67 #define RMAXINT INT_MAX
68 #define RMININT INT_MIN
71 #define RNANDOUBLE std::numeric_limits<double>::quiet_NaN()
75 #define RINFDOUBLE std::numeric_limits<double>::infinity()
97 #if defined(__GCC2x__) || defined(_MSC_VER)
98 return (v-floor(v)<0.5 ? (
int)floor(v) : (
int)ceil(v));
100 return (
int) round(v);
109 static void swap( T &a, T &b) {
115 static double trunc(
double v);
117 static double pow(
double x,
double y);
119 static bool isNormal(
double v);
120 static bool isNaN(
double v);
121 static bool isInf(
double v);
123 static bool isSane(
double v);
125 static double eval(
const QString& expression,
bool* ok = NULL);
126 static QString getError();
127 static bool hasError();
130 static QString trimTrailingZeroes(
const QString& s);
132 static double rad2deg(
double a);
133 static double deg2rad(
double a);
134 static double rad2gra(
double a);
135 static double gra2deg(
double a);
137 static bool isBetween(
double value,
double limit1,
double limit2,
bool inclusive,
double tolerance =
RS::PointTolerance);
139 static int getGcd(
int a,
int b);
140 static bool isAngleBetween(
double a,
double a1,
double a2,
bool reversed);
141 static double getNormalizedAngle(
double a);
142 static double getRelativeAngle(
double a,
double baseAngle);
143 static double getAngleDifference(
double a1,
double a2);
144 static double getAngleDifference180(
double a1,
double a2);
145 static double makeAngleReadable(
double angle,
bool readable =
true,
bool* corrected = NULL);
146 static bool isAngleReadable(
double angle,
double tolerance = 0.01);
147 static bool isSameDirection(
double dir1,
double dir2,
double tol =
RS::AngleTolerance);
148 static int absmod(
int a,
int b);
150 static QString toFractionString(
double v,
int maxDenominator);
151 static void toFraction(
double v,
int maxDenominator,
int& number,
int& numerator,
int& denominator);
152 static void simplify(
int numerator,
int denominator,
int& numeratorRes,
int& denominatorRes);
154 static bool fuzzyCompare(
double v1,
double v2,
double tolerance =
RS::PointTolerance);
155 static bool fuzzyAngleCompare(
double v1,
double v2,
double tolerance =
RS::AngleTolerance);
157 static bool containsFuzzy(
const QList<double>& values,
double v,
double tol =
RS::PointTolerance);
159 static double parseScale(
const QString& scaleString);
165 static void getQuadRoots(
double p[],
double r[][5]);
169 static void getCubicRoots(
double p[],
double r[][5]);
173 static void getBiQuadRoots(
double p[],
double r[][5]);
void deg2rad(void val)
Converts degrees to radiant.
Definition: library.js:343
static const double AngleTolerance
Definition: RS.h:700
static void uninit()
Definition: RMath.h:90
static const RVector nullVector
null vector
Definition: RVector.h:327
static const double PointTolerance
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RS.h:699
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
static int mround(double v)
Rounds the given double to the next int.
Definition: RMath.h:96
void rad2deg(void val)
Converts radiant to degrees.
Definition: library.js:597
Q_DECLARE_METATYPE(RMath *)
static void init()
Definition: RMath.h:87
static QString lastError
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RMath.h:175
static void swap(T &a, T &b)
Swaps two given values.
Definition: RMath.h:109
static QString mathExt
Definition: RMath.h:176
Math functions.
Definition: RMath.h:85
#define QCADCORE_EXPORT
Definition: core_global.h:10
void angleToString(void num, void decimals)
Definition: library.js:132