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

vtk- 数据类型(一) 三角链实例代码

 三角链实例代码

#include <iostream>
#include <string>
#include <regex>
#include "tuex.h"
#include "vtkCylinderSource.h"
#include "vtkPolyDataMapper.h"
#include "vtkActor.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkProperty.h"
#include "vtkCamera.h"
#include <vtkAutoInit.h>
#include<vtkPNGReader.h>
#include<vtkTexture.h>
#include<vtkPlaneSource.h>
#include<vtkStringArray.h>
#include<vtkPoints.h>#include<vtkTecplotReader.h>
#include <iostream>
#include "vtkLine.h"
#include "vtkTriangle.h"
#include "vtkPolyLine.h"//VTK_MODULE_INIT(vtkRenderingOpenGL);
VTK_MODULE_INIT(vtkRenderingOpenGL2);
VTK_MODULE_INIT(vtkInteractionStyle);
VTK_MODULE_INIT(vtkRenderingFreeType)
using namespace std;
#include <fstream>int main(int agrv, char * agrc) {vtkNew<vtkPoints> points;points->InsertPoint(0, 0.0, 0.0, 0.0);points->InsertPoint(1, 0.0, 1.0, 0.0);points->InsertPoint(2, 1.0, 0.0, 0.0);points->InsertPoint(3, 1.0, 1.0, 0.0);points->InsertPoint(4, 2.0, 0.0, 0.0);points->InsertPoint(5, 2.0, 1.0, 0.0);points->InsertPoint(6, 3.0, 0.0, 0.0);points->InsertPoint(7, 3.0, 1.0, 0.0);vtkNew<vtkCellArray> strips;strips->InsertNextCell(8);strips->InsertCellPoint(0);strips->InsertCellPoint(1);strips->InsertCellPoint(2);strips->InsertCellPoint(3);strips->InsertCellPoint(4);strips->InsertCellPoint(5);strips->InsertCellPoint(6);strips->InsertCellPoint(7);vtkNew<vtkPolyData> poly;poly->SetPoints(points);poly->SetStrips(strips);vtkNew<vtkPolyDataMapper> mapper;mapper->SetInputData(poly);vtkNew<vtkActor> actor; //演员actor->SetMapper(mapper); vtkNew<vtkRenderer> render; //设置舞台render->AddActor(actor);  //演员上舞台render->SetBackground(0.0, 0.0, 0.0);//设置舞台背景vtkNew<vtkRenderWindow> renWin; //renWin->AddRenderer(render);//舞台搬进戏院renWin->SetSize(640, 480);//戏院大小renWin->Render(); //戏院渲染renWin->SetWindowName("vtkPipelineDemo");//戏院起名vtkNew<vtkRenderWindowInteractor> interactor; //与看客交互interactor->SetRenderWindow(renWin);interactor->Initialize();interactor->Start();}

单元数据分成两个写,如下,结果一样。 

	vtkNew<vtkCellArray> strips;strips->InsertNextCell(5);strips->InsertCellPoint(0);strips->InsertCellPoint(1);strips->InsertCellPoint(2);strips->InsertCellPoint(3);strips->InsertCellPoint(4);strips->InsertNextCell(5);strips->InsertCellPoint(3);strips->InsertCellPoint(4);strips->InsertCellPoint(5);strips->InsertCellPoint(6);strips->InsertCellPoint(7);vtkNew<vtkPolyData> poly;

运行结果:

按w键,查看线结构:

 在线性结构里面,属于下图;f) Triangle strip(n triangles)

http://www.lryc.cn/news/174614.html

相关文章:

  • Git大全
  • Touch命令使用指南:创建、更新和修改文件时间戳
  • Windows开启 10 Telnet
  • 高教杯数学建模A题程序设计要点与思路
  • Spring Boot的新篇章:探索2.0版的创新功能
  • 5、SpringBoot_热部署
  • 【kohya】训练自己的LoRA模型
  • [尚硅谷React笔记]——第1章 React简介
  • Debezium系列之:快照参数详解
  • redis单机版搭建
  • 物联网边缘网关
  • docker部署springboot程序时遇到的network问题
  • RASP hook插桩原理解析
  • Pygame中Sprite的使用方法6-5
  • 浅谈为什么多态只能是指针或引用
  • js看代码说输出
  • Java笔记:使用javassist修改class文件内方法
  • 华为云云耀云服务器L实例评测 |云服务器性能评测
  • iphone的safari浏览器实现全屏的pwa模式,并修改顶部状态栏背景颜色
  • springboot对接rabbitmq并且实现动态创建队列和消费
  • Spring的后处理器-BeanFactoryPostprocessor
  • Flutter 必备知识点
  • 什么是FMEA(失效模式和影响分析)?
  • Redis面试题(三)
  • Python错误处理指南:优雅应对异常情况
  • MySQL学习笔记12
  • 【owt】构建m79的owt-client-native:使用vs2017
  • Cpp/Qt-day020918Qt
  • Spring面试题10:Spring的XMLBeanFactory怎么使用
  • 自定义数据类型