You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
933 B
C++
23 lines
933 B
C++
#pragma once
|
|
|
|
#include "ItemCurve.h"
|
|
#include <vector>
|
|
|
|
/**
|
|
* 样条相关纯算法:简化曲线、最近点索引、插值。
|
|
* 无文档/视图依赖,可单独测试。
|
|
*/
|
|
class SplineAlgorithm
|
|
{
|
|
public:
|
|
/// 在曲线上找与给定点距离最近的点的索引;无点或曲线为空返回 -1
|
|
static int FindClosestPointIndex(const dfPoint& point, const CCurveEx* pCurve);
|
|
|
|
/// 为每个给定点在曲线上找最近点索引,结果与 points 一一对应;无匹配时为 -1
|
|
static std::vector<int> FindClosestPointIndices(const std::vector<dfPoint>& points, const CCurveEx* pCurve);
|
|
|
|
/// 按误差阈值简化曲线(去冗余),可限制相对原控制点数的增长
|
|
/// oldHandleCount 为 0 表示首次生成;否则若结果点数 > oldHandleCount * maxGrowthRatio 则放大误差重算
|
|
static void SimplifyCurve(CCurveEx& input, double errorThreshold, int oldHandleCount, CCurveEx& output);
|
|
};
|