天天看点

opencascade绘制B样条插值曲线

opencascade绘制B样条插值曲线

opencascade提供了B样条曲线曲面的绘制方法,涉及的类有

opencascade绘制B样条插值曲线

下面以绘制B样条插值曲线为例:

opencascade绘制B样条插值曲线
QVector<gp_Pnt> points;
   points.push_back(gp_Pnt(0,0,1));
   points.push_back(gp_Pnt(0,1,1));
   points.push_back(gp_Pnt(1,2,1));
   points.push_back(gp_Pnt(1,3,1));
   int size=points.length();
	TColgp_Array1OfPnt array1(1, size);//一维点数组
	for (int i = 0; i < size; i++)
	{
		array1.SetValue(i + 1, points[i]);//赋值
	}
   GeomAPI_PointsToBSpline outline(array1);
	if (outline.IsDone())
	{
		Handle(Geom_BSplineCurve) hCurve = outline.Curve();//绘制
		TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge(hCurve);//显示
		Handle(AIS_Shape)ais_shape = new AIS_Shape(anEdge);
		m_context->Display(ais_shape, Standard_True);
		m_view->FitAll();
	}
           

继续阅读