CBlueUI  
C++ 跨平台跨框架的数据可视化工具
载入中...
搜索中...
未找到
UtilsMath 命名空间参考

函数

UI_EXP void ComputeAxis (double *axis_min, double *axis_max, double *step_unit, double y_min, double y_max, int tick_count=5, double padding_ratio=0.05, int round_flag=1)
 根据输入的范围,获得最恰当的坐标轴边界
UI_EXP void LinearFit (VecFloat2 *points, int len, double &k, double &b)
 线性拟合-最小二乘法。拟合结果为 y= k * x + b
UI_EXP void LinearFitExp (VecFloat2 *points, int len, double &a, double &b)
 非线性拟合指数函数-最小二乘法。拟合结果为 y= a * b^x
UI_EXP void LinearFitPower (VecFloat2 *points, int len, double &a, double &b)
 非线性拟合幂函数-最小二乘法。拟合结果为 y= a * x^b
UI_EXP double InterpolationLagrange (VecFloat2 *points, int len, double xp)
 拉格朗日插值,求任意点xp的Y坐标
UI_EXP BOOL PtInLine (POINT pt, POINT p1, POINT p2, int distance)
 判断点是否在线段上
UI_EXP BOOL PtInRegion (POINT pt, std::vector< POINT > &points)
 判断点是否在points点围成的区域内
UI_EXP BOOL PtInRegion (POINT pt, const POINT points[], int len)
UI_EXP BOOL LineCrossPoint (POINT line1_p1, POINT line1_p2, POINT line2_p1, POINT line2_p2, POINT &pt_cross)
 线段在各自延长线上存在交点
UI_EXP BOOL LineCrossPointInside (POINT line1_p1, POINT line1_p2, POINT line2_p1, POINT line2_p2, POINT &pt_cross)
 线段上的交点,不包括各自延长线
UI_EXP void RectLayoutCalculator (LayoutPosition *objs, int len, RECT rc_box, UINT align, BOOL is_horz, int interval, BOOL is_reverse)
 根据尺寸列表,计算在区域中的位置
UI_EXP void TrianglePoint (POINT pt[], RECT rect, int dir, int size)
 三角形顶点源
UI_EXP BOOL IsSameSign (double v1, double v2)
 同号
UI_EXP double VectorAngle (double x1, double y1, double x2, double y2)
 向量基于x轴的夹角

函数说明

◆ ComputeAxis()

UI_EXP void UtilsMath::ComputeAxis ( double * axis_min,
double * axis_max,
double * step_unit,
double y_min,
double y_max,
int tick_count = 5,
double padding_ratio = 0.05,
int round_flag = 1 )

根据输入的范围,获得最恰当的坐标轴边界

参数
axis_min: 输出左值
axis_max: 输出右值
step_unit: 输出最小单位
y_min: 最小值
y_max: 最大值
tick_count刻度数量
padding_ratiomargin比例。默认为5%
round_flag是否四舍五入

◆ InterpolationLagrange()

UI_EXP double UtilsMath::InterpolationLagrange ( VecFloat2 * points,
int len,
double xp )

拉格朗日插值,求任意点xp的Y坐标

参数
point输入点
len输入点个数
xp任意点X

◆ IsSameSign()

UI_EXP BOOL UtilsMath::IsSameSign ( double v1,
double v2 )

同号

◆ LinearFit()

UI_EXP void UtilsMath::LinearFit ( VecFloat2 * points,
int len,
double & k,
double & b )

线性拟合-最小二乘法。拟合结果为 y= k * x + b

参数
point输入点
len输入点个数
k直线斜率
b直线截距

◆ LinearFitExp()

UI_EXP void UtilsMath::LinearFitExp ( VecFloat2 * points,
int len,
double & a,
double & b )

非线性拟合指数函数-最小二乘法。拟合结果为 y= a * b^x

参数
point输入点
len输入点个数
k直线斜率
b直线截距

◆ LinearFitPower()

UI_EXP void UtilsMath::LinearFitPower ( VecFloat2 * points,
int len,
double & a,
double & b )

非线性拟合幂函数-最小二乘法。拟合结果为 y= a * x^b

参数
point输入点
len输入点个数
k直线斜率
b直线截距

◆ LineCrossPoint()

UI_EXP BOOL UtilsMath::LineCrossPoint ( POINT line1_p1,
POINT line1_p2,
POINT line2_p1,
POINT line2_p2,
POINT & pt_cross )

线段在各自延长线上存在交点

◆ LineCrossPointInside()

UI_EXP BOOL UtilsMath::LineCrossPointInside ( POINT line1_p1,
POINT line1_p2,
POINT line2_p1,
POINT line2_p2,
POINT & pt_cross )

线段上的交点,不包括各自延长线

◆ PtInLine()

UI_EXP BOOL UtilsMath::PtInLine ( POINT pt,
POINT p1,
POINT p2,
int distance )

判断点是否在线段上

参数
pt测试点
p1线段起点
p2线段终点
distance线宽
返回
BOOL TRUE 在线段上

◆ PtInRegion() [1/2]

UI_EXP BOOL UtilsMath::PtInRegion ( POINT pt,
const POINT points[],
int len )

◆ PtInRegion() [2/2]

UI_EXP BOOL UtilsMath::PtInRegion ( POINT pt,
std::vector< POINT > & points )

判断点是否在points点围成的区域内

◆ RectLayoutCalculator()

UI_EXP void UtilsMath::RectLayoutCalculator ( LayoutPosition * objs,
int len,
RECT rc_box,
UINT align,
BOOL is_horz,
int interval,
BOOL is_reverse )

根据尺寸列表,计算在区域中的位置

参数
objs元素数组
len个数
rc_box显示区域
align对齐方式
is_horz水平布局 Or 垂直布局
interval元素之间的间距
is_reverse正向 Or 反向

◆ TrianglePoint()

UI_EXP void UtilsMath::TrianglePoint ( POINT pt[],
RECT rect,
int dir,
int size )

三角形顶点源

参数
pt[]三角形顶点

◆ VectorAngle()

UI_EXP double UtilsMath::VectorAngle ( double x1,
double y1,
double x2,
double y2 )

向量基于x轴的夹角

返回
值域(-PI, PI]
鄂公网安备42018502007752 鄂ICP备2024082886
Copyright © 2026 · CBlueStudio 版权所有