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

Windows Qt C++ VTK 绘制三维曲线

Qt  自带数据可视化从文档上看,只能实现三维曲面。

QwtPlot3D在Qt6.6.0上没编译通过。

QCustomPlot 只能搞二维。

VTK~搞起。抄官网demo。

后续需求:

1、对数轴

2、Y轴逆序

3、Z轴值给色带,类似等高线图的色带

期待各位大佬多多指导。

 vtkNew<vtkNamedColors> colors;// Create the data.vtkNew<vtkTable> table;vtkNew<vtkTable> table1;vtkNew<vtkFloatArray> arrX0;arrX0->SetName("X");table->AddColumn(arrX0);vtkNew<vtkFloatArray> arrX1;arrX1->SetName("Y");table->AddColumn(arrX1);vtkNew<vtkFloatArray> arrX2;arrX2->SetName("Z");table->AddColumn(arrX2);vtkNew<vtkFloatArray> arrX3;arrX3->SetName("-Z");table->AddColumn(arrX3);vtkNew<vtkFloatArray> arrX4;arrX4->SetName("-Y");table->AddColumn(arrX4);const unsigned int numberOfTimePoints = 128;table->SetNumberOfRows(numberOfTimePoints);for (unsigned int ii = 0; ii < numberOfTimePoints; ++ii){double value = ii;double value1 = rand() % 100;table->SetValue(ii, 0, ii);table->SetValue(ii, 1, ii);table->SetValue(ii, 2, sin(value));table->SetValue(ii, 3, sin(value) + 10);table->SetValue(ii, 4, sin(value) + 20);}// Set up a 3D scene and add an XYZ chart to it.vtkNew<vtkContextView> contextView;contextView->GetRenderWindow()->SetSize(1024, 1024);contextView->GetRenderWindow()->SetWindowName("PlotLine3D");vtkNew<vtkChartXYZ> chartXYZ;chartXYZ->SetGeometry(vtkRectf(5.0, 5.0, 635.0, 475.0));contextView->GetScene()->AddItem(chartXYZ);// Add a line plot.vtkNew<vtkPlotLine3D> plotLine3D;plotLine3D->SetInputData(table, 0, 1, 2);contextView->GetRenderWindow()->SetMultiSamples(0);plotLine3D->GetPen()->SetWidth(1.0);chartXYZ->AddPlot(plotLine3D);// Add a line plot.vtkNew<vtkPlotLine3D> plotLine3D1;plotLine3D1->SetInputData(table, 0, 1, 3);plotLine3D1->GetPen()->SetWidth(2.0);chartXYZ->AddPlot(plotLine3D1);// Add a line plot.vtkNew<vtkPlotLine3D> plotLine3D2;plotLine3D2->SetInputData(table, 0, 1, 4);plotLine3D2->GetPen()->SetWidth(3.0);chartXYZ->AddPlot(plotLine3D2);chartXYZ->SetXAxisLabel("振幅");chartXYZ->SetVisible(true);// Finally render the scene.contextView->GetRenderer()->SetBackground(colors->GetColor3d("DarkOliveGreen").GetData());contextView->GetRenderWindow()->Render();contextView->GetInteractor()->Initialize();contextView->GetInteractor()->Start();

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

相关文章:

  • Android T 远程动画显示流程(更新中)
  • 【计算机网络】【练习题及解答】【新加坡南洋理工大学】【Computer Control Network】
  • 云计算HCIE备考经验分享
  • Threejs API——`OrbitControls`相机控件
  • 远程教育:低代码在教育技术领域的重塑之力
  • vue 模板语法值class操作
  • MySQL的原生API实现插入数据后在可视化工具上不显示的问题解决
  • Blender教程(基础)-内插面、分离、环切、倒角-08
  • Unity 自动轮播、滑动轮播
  • 纯html+js+css个人博客
  • 二百二十一、HiveSQL报错:return code 2 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask
  • JavaEE学习笔记 2024-1-25 --VUE的入门使用
  • php-fpm详细讲解
  • 小白水平理解面试经典题目LeetCode 455 Assign Cookies【Java实现】
  • uniapp 问题汇总-问题数(2)
  • [AG32VF407]国产MCU+FPGA Verilog编写控制2路gpio输出不同频率方波实验
  • python coding with ChatGPT 打卡第15天| 二叉树:翻转二叉树、对称二叉树
  • Python(19)Excel表格操作Ⅰ
  • HiveSQL题——聚合函数(sum/count/max/min/avg)
  • 计算机是什么做的
  • C++多线程1(复习向笔记)
  • 代理IP在游戏中的作用有哪些?
  • SVN Previous operation has not finished; run ‘cleanup‘ if it was interrupted
  • MATLAB知识点:MATLAB的文件管理
  • 【深度学习】MNN ImageProcess处理图像顺序,逻辑,均值,方差
  • 代码随想录算法训练营29期Day35|LeetCode 860,406,452
  • 20240130金融读报1分钟小得01
  • 刷力扣题过程中发现的不熟的函数
  • native2ascii命令详解
  • 什么是Vue Vue入门案例