当前位置:网站首页>VTK例子--三個相交的平面
VTK例子--三個相交的平面
2022-06-11 00:11:00 【黑山老妖的博客】
VTK筆記-圖形相關-平面-vtkPlaneSource_黑山老妖的博客的博客-CSDN博客_vtkplanevtkPlaneSource創建比特於平面中的四邊形陣列vtkPlaneSource創建一個由四邊形組成的m x n數組,這些四邊形排列為平面中的規則平鋪。該平面是通過指定一個原點來定義的,然後指定另外兩個與原點一起定義平面的兩個軸的點。這些軸不必是正交的-所以你可以創建一個平行四邊形(軸不能平行。)平面的分辨率(即細分的數量)由ivars X分辨率和Y分辨率控制。默認情况下,平面以原點為中心並垂直於z軸,寬度和高度的長度為1,分辨率設置為1。有三種方便的方法可以讓你輕松地移動飛機。第一個SetNorhttps://blog.csdn.net/liushao1031177/article/details/117110232 在之前的例子中,可以繪制一個平面;現在使用vtkPlaneSource繪制三個相交的平面;
vtkNew<vtkPlaneSource> planeSource_xy;
planeSource_xy->SetOrigin(-1, -1, 0.0);
planeSource_xy->SetPoint1(1, -1, 0);
planeSource_xy->SetPoint2(-1, 1, 0);
planeSource_xy->Update();
vtkNew<vtkPolyDataMapper> planeMapper_xy;
planeMapper_xy->SetInputConnection(planeSource_xy->GetOutputPort());
vtkNew<vtkActor> planeActor_xy;
planeActor_xy->SetMapper(planeMapper_xy);
planeActor_xy->GetProperty()->SetColor(0, 255, 0);
vtkNew<vtkPlaneSource> planeSource_yz;
planeSource_yz->SetOrigin(0.0, -1, -1);
planeSource_yz->SetPoint1(0, 1, -1);
planeSource_yz->SetPoint2(0, -1, 1);
planeSource_yz->Update();
vtkNew<vtkPolyDataMapper> planeMapper_yz;
planeMapper_yz->SetInputConnection(planeSource_yz->GetOutputPort());
vtkNew<vtkActor> planeActor_yz;
planeActor_yz->SetMapper(planeMapper_yz);
vtkNew<vtkPlaneSource> planeSource_xz;
planeSource_xz->SetOrigin(-1, 0, -1);
planeSource_xz->SetPoint1(1, 0, -1);
planeSource_xz->SetPoint2(-1, 0, 1);
planeSource_xz->Update();
vtkNew<vtkPolyDataMapper> planeMapper_xz;
planeMapper_xz->SetInputConnection(planeSource_xz->GetOutputPort());
vtkNew<vtkActor> planeActor_xz;
planeActor_xz->SetMapper(planeMapper_xz);
planeActor_xz->GetProperty()->SetColor(255, 0, 0);
vtkNew<vtkRenderer> renderer;
renderer->AddActor(planeActor_xy);
renderer->AddActor(planeActor_yz);
renderer->AddActor(planeActor_xz);
vtkNew<vtkRenderWindow> renderWindow;
renderWindow->AddRenderer(renderer);
renderWindow->SetWindowName("PlaneSourceDemo");
renderWindow->SetSize(640, 480);
vtkNew<vtkRenderWindowInteractor> interactor;
interactor->SetRenderWindow(renderWindow);
renderWindow->Render();
renderer->GetActiveCamera()->SetPosition(1, 0, 0);
renderer->GetActiveCamera()->SetFocalPoint(0, 1, 0);
renderer->GetActiveCamera()->SetViewUp(0, 0, 1);
renderer->GetActiveCamera()->Azimuth(30);
renderer->GetActiveCamera()->Elevation(30);
renderer->ResetCamera();
renderWindow->Render();
interactor->Start();
旋轉紅色平面,繞z軸旋轉45°;
planeActor_xz->RotateWXYZ(45, 0, 0, 1);
紅色平面再繞(1,1,0)方向旋轉45°和90°;(1,1,0)方向為初次旋轉後,紅色平面與綠色平面的交線;旋轉90°後,紅色平面和綠色平面相交;


边栏推荐
- MP框架基本操作(自用)
- IGBT与三代半导体SiC双脉冲测试方案
- 选择排序
- 【Pygame小游戏】剧情流推荐:什么样的游戏才能获得大家的喜欢呢?(魔鬼恋人、霸总娇妻版)
- 【Opencv实战】这个印章“神器”够牛,节省了时间提高了效率,厉害~(附完整源码)
- Bluetooth development (8) -- avdtp connection process
- [pyGame] can the little dinosaur on chrome be played with code? It looks like fun~
- 示波器和频谱分析仪的区别
- Merge sort
- From the perspective of Confucius Temple IP crossover, we can see how the six walnuts become "butterflies" for the second time
猜你喜欢

【Turtle表白合集】“海底月是天上月,眼前人是心上人。”余生多喜乐,长平安~(附3款源码)

【Pygame小游戏】不怕你走不过系列:极致AI走迷宫,学习完带你打开新世界大门~(附游戏源码)

vtk.js中vtp下载

Things about Bluetooth development (10) -- getting to know ble for the first time

【Pygame小游戏】激荡大脑思维,一起来玩转奇思妙想“24点”叭~(超赞滴)
![[pyGame games] don't look for it. Here comes the leisure game topic - bubble dragon widget - recommendation for leisure game research and development](/img/fb/a966b4bf52cdab4030578d4595e09b.png)
[pyGame games] don't look for it. Here comes the leisure game topic - bubble dragon widget - recommendation for leisure game research and development
![[pyGame games] I'm not afraid you can't walk the maze series: the ultimate AI walks the maze. After learning, it will take you to open the door to a new world ~ (with game source code)](/img/57/dcf291b044b5e5860a7fdc817076d5.jpg)
[pyGame games] I'm not afraid you can't walk the maze series: the ultimate AI walks the maze. After learning, it will take you to open the door to a new world ~ (with game source code)

【漫天烟花】绚烂烟花点亮夜空也太美了叭、某程序员携带烟花秀给大家拜年啦~

Leetcode-15 sum of three numbers

Basic operation of OpenCV actual combat image: this effect amazed everyone (with code analysis)
随机推荐
[MVC&Core]ASP.NET Core MVC 视图传值入门
Lambda learning records
【Pygame小游戏】首月破亿下载 一款高度融合了「超休闲游戏特性」的佳作~
【数据库】Nosql数据库的种类
Method of converting file to multipartfile
数据库表结构
【Go语言学习】——并发编程
[pyGame collection] please check the game guide through childhood: are there any games you have played? (attach five source codes for self access)
插入排序
【Pygame小游戏】不怕你走不过系列:极致AI走迷宫,学习完带你打开新世界大门~(附游戏源码)
[pyGame games] don't look for it. Here comes the leisure game topic - bubble dragon widget - recommendation for leisure game research and development
Bluetooth development (3) -- look at the air bag
【漫天烟花】绚烂烟花点亮夜空也太美了叭、某程序员携带烟花秀给大家拜年啦~
IGBT与三代半导体SiC双脉冲测试方案
Hyperleger fabric installation
[opencv practice] this seal "artifact" is awesome, saving time and improving efficiency. It is powerful ~ (complete source code attached)
【Pygame小游戏】剧情流推荐:什么样的游戏才能获得大家的喜欢呢?(魔鬼恋人、霸总娇妻版)
对接请求方式
Basic introduction and core components of kubernetes
Merge sort