[MSCE C++]创建通过点的B样条曲线

符老师好!

请问在MS开发中的MSBsplineCurve类下怎么创建一条通过点的B样条曲线。

我已经试了在这个类下的很多创建曲线的函数,但是得到的结果都是控制点类型的曲线。

希望可以得到一个使用通过点方法创建的B样条曲线。

Parents Reply Children
  • 如下代码为测试样例:

    	DPoint3d points[6];
    	points[0] = DPoint3d::From(0, 0, 0);
    	points[1] = DPoint3d::From(100, -100, 0);
    	points[2] = DPoint3d::From(200, 100, 0);
    	points[3] = DPoint3d::From(300, -100, 0);
    	points[4] = DPoint3d::From(400, 100, 0);
    	points[5] = DPoint3d::From(500, -100, 0);
    	DPoint3d tangents[2];
    	tangents[0].Init(0.0, 0.0, 0.0);
    	tangents[1].Init(0.0, 0.0, 0.0);
    
    	MSInterpolationCurvePtr curve = MSInterpolationCurve::CreatePtr();
    	curve->InitFromPointsAndEndTangents(points, 6, false, 0.0, tangents, false, true, false, false);
    
    	EditElementHandle eeh;
    	BSplineCurveHandler::CreateBSplineCurveElement(eeh, NULL, *curve, ACTIVEMODEL->Is3d(), *ACTIVEMODEL);
    	eeh.AddToModel();
    	

    生成的图形即对应的FitPoints如下:



    Answer Verified By: ywq