occ点云显示
// 创建点云数据 float sacle =1; const long num_points = 1000000; std::vector<gp_Pnt> points; for(int i=0;i<100;i++){ for(int j=0;j<100;j++){ for(int k=0;k<100;k++){ points.push_back(gp_Pnt(i*sacle, j*sacle, k*sacle)); } } } // 创建Graphic3d_ArrayOfPoints对象 Handle(Graphic3d_ArrayOfPoints) array_of_points = new Graphic3d_ArrayOfPoints(num_points); for (long i = 0; i < num_points; i++) { const gp_Pnt& p = points[i]; array_of_points->AddVertex(p.X(), p.Y(), p.Z()); } Handle(AIS_PointCloud) ais_pointcloud = new AIS_PointCloud(); ais_pointcloud->SetDisplayMode(Aspect_TOM_POINT); ais_pointcloud->SetColor(Quantity_Color(255/255,1/255,1/255,Quantity_TypeOfColor::Quantity_TOC_RGB)); ais_pointcloud->SetPoints(array_of_points); Graphic3d_MaterialAspect material(Graphic3d_NOM_GOLD); ais_pointcloud->SetMaterial(material); myContext->Display(ais_pointcloud, true); updateView(); QTimer* timer=new QTimer(this); connect(timer,&QTimer::timeout, this, [=](){ gp_Trsf aTrsf_Translation; //aTrsf_Translation.SetTranslation(gp_XYZ({-0.5,0,0})); aTrsf_Translation.SetRotation(gp_Ax1({0,0,0},{0,0,1}),0.01); BRepBuilderAPI_Transform trans(bShape->Shape(),aTrsf_Translation,false); bShape->SetShape(trans.Shape()); // aShape->SetShape(cut_thread->cshape); // myContext->Redisplay(aShape,true); myContext->Redisplay(bShape,true); updateView(); }); timer->start(10);
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了