51 lines
1.1 KiB
C
Raw Normal View History

2026-02-01 14:51:16 +08:00
#ifndef CURVE_FITTING_H
#define CURVE_FITTING_H
#include <vector>
#include "VZNL_Types.h"
// 平面选择
enum Plane
{
XY = 0,
XZ = 1,
YZ = 2
};
// 直线拟合结果
struct LineFitResult
{
SVzNL3DPoint point; // 直线上的点
SVzNL3DPoint direction; // 方向向量
double error; // 拟合误差
bool success; // 是否成功
};
// 抛物线拟合结果
struct ParabolaFitResult
{
double a, b, c; // 抛物线系数
double error; // 拟合误差
bool success; // 是否成功
};
// 圆拟合结果
struct CircleFitResult
{
SVzNL3DPoint center; // 圆心
double radius; // 半径
double error; // 拟合误差
bool success; // 是否成功
};
// 直线拟合3D
LineFitResult FitLine3D(const std::vector<SVzNL3DPosition>& points);
// 抛物线拟合
ParabolaFitResult FitParabola(const std::vector<SVzNL3DPosition>& points, Plane plane);
// 圆拟合
CircleFitResult FitCircle(const std::vector<SVzNL3DPosition>& points, Plane plane);
#endif // CURVE_FITTING_H