这里是我如何做到这一点
- 使曲线
一个。创建曲线对象(维,理性标志(它具有权重),曲线+1度,多少控制点你有)
ON_NurbsCurve thisCurve(3, false, order, controlPoints.size());
湾添加控制点到曲线
for(int i = 0; i <controlPoints.size(); ++i)
{
ON_3dPoint cpPosition = controlPoints[i];
thisCurve.SetCV(i, cpPosition.x);
}
c。添加结
一,如果你有knot_count = cv_count +学历+ 1
for (int i = 1; i < knotValues.size() - 1; ++i)
thisCurve.SetKnot(i - 1, knotValues[i]);
II。如果你有knot_count = cv_count +度 - 1
for (int i = 0; i < knotValues.size(); ++i)
thisCurve.SetKnot(i, knotValues[i]);
- 样品的曲线
一个。检查曲线是否有效
if (thisCurve.IsValid())
{
b。得到曲线的参数范围
double maxU = knotValues.back();
double minU = knotValues.front();
c。插入
double quadrature = 10;
for (unsigned int i = 0; i < quadrature; ++i)
{
double t = ((maxU - minU) * (i)/(quadrature - 1)) + minU;
double pointsOut[3];
d。评估这需要(参数的曲线,采取多少衍生物,什么尺寸,存储值的双阵列)
bool successful = thisCurve.Evaluate(t, 0, 3, pointsOut);
if (successful)
curvePoints.push_back(ON_3dPoint(pointsOut[0], pointsOut[1], pointsOut[2]));
else
std::cout << "evaluation not successful " << std::endl;
e。清理
delete [] pointsOut;
}
thisCurve.Destroy();
我会试试这个并报告回来。我已经下载了几次,但我没有完整阅读这些例子。 – 2012-08-07 13:37:29
不,那件事情是不可能编译的,每次我尝试编译时都会遇到数千个错误,它已经过时了,无法修复。 – 2012-08-08 06:38:47
也许你做错了什么。你有什么样的错误? – Tutankhamen 2012-08-08 08:18:40