32#if QT_VERSION >= 0x060000
38#define M_PI 3.14159265358979323846264338327950288
42#define M_PI_2 1.57079632679489661923132169163975144
46#define M_PI_4 0.785398163397448309615660845819875721
50#define M_LN10 2.30258509299404568401799145468436421
54#define M_LN2 0.693147180559945309417232121458176568
63#define RMAXDOUBLE 1e300
64#define RMINDOUBLE -1e300
66#define RMAXDOUBLE std::numeric_limits<double>::max()
67#define RMINDOUBLE -std::numeric_limits<double>::max()
70#define RMAXINT INT_MAX
71#define RMININT INT_MIN
74#define RNANDOUBLE std::numeric_limits<double>::quiet_NaN()
78#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);
160 static RVector parseCoordinate(
const QString& coordinateString,
const RVector& relativeZero);
162 static QString getMd5Hash(
const QString& data);
167 static void getQuadRoots(
double p[],
double r[][5]);
171 static void getCubicRoots(
double p[],
double r[][5]);
175 static void getBiQuadRoots(
double p[],
double r[][5]);
180#if QT_VERSION >= 0x060000
181 static QJSEngine* jsEngine;
void init(void basePath)
Definition AddBlockInit.js:2
Q_DECLARE_METATYPE(RMath *)
Math functions.
Definition RMath.h:88
static QString mathExt
Definition RMath.h:178
static int mround(double v)
Rounds the given double to the next int.
Definition RMath.h:96
static QString lastError
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RMath.h:177
static void swap(T &a, T &b)
Swaps two given values.
Definition RMath.h:109
static const double PointTolerance
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RS.h:920
static const double AngleTolerance
Definition RS.h:921
Represents a 3d vector (x/y/z).
Definition RVector.h:47
#define QCADCORE_EXPORT
Definition core_global.h:10
void angleToString(void num, void decimals)
Definition library.js:1059
void rad2deg(void val)
Converts radiant to degrees.
Definition library.js:256
void deg2rad(void val)
Converts degrees to radiant.
Definition library.js:759
char s
Definition opennurbs_string.cpp:32
#define NULL
Definition opennurbs_system.h:256