当前位置: 首页 > news >正文

北京中国建设部网站权威解读当前经济热点问题

北京中国建设部网站,权威解读当前经济热点问题,手机网址怎么复制到电脑上,网络科技是做什么的开发环境: Windows 11 家庭中文版Microsoft Visual Studio Community 2019VTK-9.3.0.rc0vtk-example参考代码目的:学习与总结 demo解决问题:通过自定义vtkInteractorStyle类中成员函数OnLeftButtonDown,判断鼠标当前选中的是哪个…

开发环境:

  1. Windows 11 家庭中文版
  2. Microsoft Visual Studio Community 2019
  3. VTK-9.3.0.rc0
  4. vtk-example
  5. 参考代码
  6. 目的:学习与总结

demo解决问题:通过自定义vtkInteractorStyle类中成员函数OnLeftButtonDown,判断鼠标当前选中的是哪个actor;同理可自定义鼠标右键、滚轮、键盘等事件
关键类:vtkInteractorStyleTrackballActor允许用户与场景中彼此独立的对象进行交互(旋转、平移等);根据实际应用场景有如下常见替换对象:

vtkInteractorStyleTrackballActor作用对象:actor; 形式:Trackball
vtkInteractorStyleTrackballCamera作用对象:Camera; 形式:Trackball
vtkInteractorStyleJoystickActor作用对象:actor; 形式:Joystick
vtkInteractorStyleJoystickCamera作用对象:Camera; 形式:Joystick
vtkInteractorStyleImage作用对象:vtkImageActor; 形式:绑定使相机的视图平面垂直于x-y平面

参考:vtkInteractorStyle详细介绍


#include <vtkActor.h>
#include <vtkCamera.h>
#include <vtkCubeSource.h>
#include <vtkInteractorStyleTrackballActor.h>
#include <vtkNamedColors.h>
#include <vtkNew.h>
#include <vtkPolyDataMapper.h>
#include <vtkProperty.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>
#include <vtkSphereSource.h>namespace {// Handle mouse events.
class MouseInteractorStyle5 : public vtkInteractorStyleTrackballActor
{
public:static MouseInteractorStyle5* New();vtkTypeMacro(MouseInteractorStyle5, vtkInteractorStyleTrackballActor);virtual void OnLeftButtonDown() override{// Forward events.vtkInteractorStyleTrackballActor::OnLeftButtonDown();if (this->InteractionProp == this->Cube){std::cout << "Picked cube." << std::endl;}else if (this->InteractionProp == this->Sphere){std::cout << "Picked sphere." << std::endl;}}vtkActor* Cube;vtkActor* Sphere;
};vtkStandardNewMacro(MouseInteractorStyle5);} // namespaceint main(int, char*[])
{vtkNew<vtkNamedColors> colors;// Create a cube.vtkNew<vtkCubeSource> cubeSource;cubeSource->Update();vtkNew<vtkPolyDataMapper> cubeMapper;cubeMapper->SetInputConnection(cubeSource->GetOutputPort());vtkNew<vtkActor> cubeActor;cubeActor->SetMapper(cubeMapper);cubeActor->GetProperty()->SetColor(colors->GetColor3d("MistyRose").GetData());// Create a sphere.vtkNew<vtkSphereSource> sphereSource;sphereSource->SetCenter(2, 0, 0);sphereSource->Update();// Create a mapper.vtkNew<vtkPolyDataMapper> sphereMapper;sphereMapper->SetInputConnection(sphereSource->GetOutputPort());// Create an actor.vtkNew<vtkActor> sphereActor;sphereActor->SetMapper(sphereMapper);sphereActor->GetProperty()->SetColor(colors->GetColor3d("LightGoldenrodYellow").GetData());// A renderer and render window.vtkNew<vtkRenderer> renderer;vtkNew<vtkRenderWindow> renderWindow;renderWindow->AddRenderer(renderer);renderWindow->SetWindowName("SelectAnActor");// An interactor.vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;renderWindowInteractor->SetRenderWindow(renderWindow);// Set the custom stype to use for interaction.vtkNew<MouseInteractorStyle5> style;style->SetDefaultRenderer(renderer);style->Cube = cubeActor;style->Sphere = sphereActor;renderWindowInteractor->SetInteractorStyle(style);renderer->AddActor(cubeActor);renderer->AddActor(sphereActor);renderer->SetBackground(colors->GetColor3d("SlateGray").GetData());renderer->ResetCamera();renderer->GetActiveCamera()->Zoom(0.9);// Render and interact.renderWindow->Render();renderWindowInteractor->Initialize();renderWindowInteractor->Start();return EXIT_SUCCESS;
}
http://www.mmbaike.com/news/110161.html

相关文章:

  • 网站欢迎页制作班级优化大师下载安装最新版
  • wordpress 关键词排名关键词优化的作用
  • 微信网站制作入门seo视频教程百度云
  • 广州营销型网站建设哪家好本地免费发布信息网站
  • W做网站淘宝怎么优化关键词排名
  • 帮人负责做网站叫什么工作在线建站平台
  • 海纳网站建设外链收录网站
  • wordpress插件删除六年级上册数学优化设计答案
  • 中国电子商务网站建设情况磁力岛引擎
  • 淘宝店铺装网站导航怎么做做小程序公司哪家好
  • 怎么查看网站跳出率全网网站快速排名推广软件
  • excel做网站网络推广有效果吗
  • wd wordpress优化方法
  • 怎么做网站web免费的网站软件
  • 实训网站建设的心得总结友情链接如何交换
  • 做网站都需要什么东西郑州百度快照优化排名
  • 阿里巴巴专门做外贸的网站百度浏览器网址
  • 权威的网站建设手机版百度入口
  • 男女做的那个真实的视频网站拉新注册app拿佣金
  • wordpress更换域名图片杭州优化关键词
  • 完整酒店网站开发怎么在百度上做广告
  • wordpress 755优化网络的软件
  • 网站架构价格女生做sem还是seo
  • 如果做网站报价百度引流怎么推广
  • 福永自适应网站建免费关键词挖掘工具
  • 阿里云有了域名 网站建设厦门谷歌seo公司有哪些
  • 南通装饰网站建设微信公众号seo
  • 郑州网站建设优化企业备案域名
  • 网站建设自助建站制作管理系统
  • 网站开发设计师培训网站设计方案模板