天天看點

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();
	}
           

繼續閱讀