bool CFreeform_CurveView::Create_Nodes_Vector(int n, int m, int SplineType, float nodes[]) { if (SplineType != 0 && SplineType != 1) { return false; // 非法参数 }

if (SplineType == 0) { // 均匀B样条曲线
	for (int i = 0; i < n + m; i++) {
		nodes[i] = i;
	}
} else { // 开放均匀B样条曲线
	for (int i = 0; i < m; i++) {
		nodes[i] = 0;
		nodes[n + m + 1 + i] = n - m + 2;
	}
	for (int i = m; i <= n - m + 1; i++) {
		nodes[i] = i - m + 1;
	}
}

return true;

}

C++ B样条曲线节点向量生成函数优化

原文地址: https://www.cveoy.top/t/topic/ng0L 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录