BIMHome v1.0.0
BIMHome接口文档说明
Calculate.h
浏览该文件的文档.
1/************************************************************************
2* @file Calculate.h
3*
4* @brief 数学计算类
5*
6* @details 数学计算类
7*
8* @author wukx
9*
10* @version v1.0
11*
12* @date 2016.9.29
13*
14* @license 北京华科软科技有限公司
15*
16*************************************************************************/
17
18#ifndef BIMHOMEBASE_CALCULATE_H
19#define BIMHOMEBASE_CALCULATE_H
20
21#include <boost/filesystem.hpp>
22#include <string>
23#include <vector>
24#include <Base/TimeInfo.h>
25#include <QString>
26#include "QMap"
27
28#define RAD_TO_DEG(rad) ((rad) * (180.0 / M_PI))
29#define DEG_TO_RAD(angle) ((angle) * (M_PI / 180.0))
30
31namespace Base
32{
33
39 class BaseExport Calculate
40 {
41 public:
47
53
54 public:
55
63 static std::string doubleToString(double value, int bit = 2);
64
71 static int determineQuadrant(double angle);
72
79 static double normalizeAngle(double rad);
80
88 static double calculateSectorArea(double radius, double theta);
89
97 static int gcd(int a, int b);
98
105 static std::string radiansToDMS(double angle);
106
113 static std::string floatToFraction(double gradient);
114
121 static double qRadiansToDegrees(double radians);
122
129 static double qDegreesToRadians(double degree);
130
138 static bool hasDecimal(double num, double epsilon = 1e-9);
139
146 static int sgn(double x);
147
155 static double distance(const QPointF& point1, const QPointF& point2);
156
164 static double round(const double v, const double precision);
165
172 static bool isNumeric(const std::string& value);
173
181 static double truncateDoubleByDecimal(double value, int n);
182 };
183
184} //namespace Base
185
186
187#endif // BIMHOMEBASE_CALCULATE_H
static double qRadiansToDegrees(double radians)
将弧度值转换为角度值
static std::string doubleToString(double value, int bit=2)
将 double 类型数值保留指定小数位后转换为 std::string
static bool isNumeric(const std::string &value)
判断字符串是否为数字
static int determineQuadrant(double angle)
判断角度值所在的象限
Calculate()
默认构造函数
static int sgn(double x)
判断浮点数的正负性
~Calculate()
默认析构函数
static double normalizeAngle(double rad)
将角度值归一化到 0 到 2π 之间
static double calculateSectorArea(double radius, double theta)
计算扇形面积
static std::string floatToFraction(double gradient)
将小数转换为分数形式(以 1 为分子)
static double qDegreesToRadians(double degree)
将角度值转换为弧度值
static double truncateDoubleByDecimal(double value, int n)
截断浮点数的小数部分
static std::string radiansToDMS(double angle)
将角度值从弧度转换为度分秒格式
static bool hasDecimal(double num, double epsilon=1e-9)
判断浮点数是否包含小数部分
static double distance(const QPointF &point1, const QPointF &point2)
计算两点之间的欧几里得距离
static double round(const double v, const double precision)
按指定精度对浮点数进行四舍五入
static int gcd(int a, int b)
计算两个整数的最大公约数(GCD)
提供各种数学计算和转换功能的工具类
Definition Calculate.h:40
Definition BaseFigureFactory.h:24