VTK窗口默认坐标方向:


#ifndef INITIAL_OPENGL
#define INITIAL_OPENGL
#include <vtkAutoInit.h>
VTK_MODULE_INIT(vtkRenderingOpenGL)
VTK_MODULE_INIT(vtkInteractionStyle)
#endif
#include <iostream>
using namespace std;
#include "vtkPolyDataMapper.h"
#include "vtkWin32OpenGLRenderWindow.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkRenderer.h"
#include "vtkPoints.h"
#include "vtkWin32RenderWindowInteractor.h"
#include "vtkProperty.h"
#include "vtkFloatArray.h"
#include "vtkPolyData.h"
#include "vtkDataSetMapper.h"
#include "vtkActor2D.h"
#include "vtkContourFilter.h"
#include "vtkContourValues.h"
#include "vtkUnstructuredGrid.h"
#include "vtkPointData.h"
#include "vtkLine.h"
#include <vtkInteractorStyleTrackballCamera.h>
#include <vtkCellArray.h>
void myShow(vtkPolyData* polydata)
{
//设置映射器
vtkSmartPointer<vtkPolyDataMapper> amapper=vtkSmartPointer<vtkPolyDataMapper>::New();
amapper->SetInputData(polydata);
// amapper->SetScalarVisibility(0);
amapper->ScalarVisibilityOn();
//声明一个演员
vtkSmartPointer<vtkActor> anActor=vtkSmartPointer<vtkActor>::New();
anActor->SetMapper(amapper);
anActor->GetProperty()->SetRepresentationToWireframe();
anActor->GetProperty()->SetDiffuseColor(,,);
anActor->GetProperty()->SetLineWidth();
anActor->GetProperty()->SetPointSize();
//创建显示窗口
vtkSmartPointer<vtkRenderer> ren1=vtkSmartPointer<vtkRenderer>::New();
ren1->AddActor(anActor);
vtkSmartPointer<vtkRenderWindow> renWin=vtkSmartPointer<vtkRenderWindow>::New();
renWin->AddRenderer(ren1);
vtkSmartPointer<vtkRenderWindowInteractor> iren=vtkSmartPointer<vtkRenderWindowInteractor>::New();
iren->SetRenderWindow(renWin);
vtkSmartPointer<vtkInteractorStyleTrackballCamera>style=vtkSmartPointer<vtkInteractorStyleTrackballCamera>::New();
iren->SetInteractorStyle(style);
renWin->SetSize(,);
ren1->ResetCamera();
iren->Start();
}
int main()
{
//几何数据
float pts[][]={{,,},{,,}};
vtkSmartPointer<vtkPoints> Pointes=vtkSmartPointer<vtkPoints>::New();
Pointes->SetNumberOfPoints();
Pointes->InsertPoint(,pts[]);
Pointes->InsertPoint(,pts[]);
//属性数据
vtkSmartPointer<vtkFloatArray> lineScalars=vtkSmartPointer<vtkFloatArray>::New();
lineScalars->SetNumberOfTuples();
lineScalars->InsertValue(,);
lineScalars->InsertValue(,);
//拓扑结构
vtkSmartPointer<vtkLine> aLine=vtkSmartPointer<vtkLine>::New();
aLine->GetPointIds()->SetNumberOfIds();
aLine->GetPointIds()->SetId(,);
aLine->GetPointIds()->SetId(,);
//创建单元数组
vtkSmartPointer<vtkCellArray> lineCells=vtkSmartPointer<vtkCellArray>::New();
lineCells->InsertNextCell(aLine);
//将以上数据组合成一个vtkPolyData
vtkSmartPointer<vtkPolyData> polydata=vtkSmartPointer<vtkPolyData>::New();
polydata->SetPoints(Pointes);
polydata->SetLines(lineCells);
polydata->GetPointData()->SetScalars(lineScalars);
/**********在窗口中显示该结构元****************************************/
myShow(polydata);
return ;
}
												

VTK初学一,c_Line_CellArray线段的CellArray绘制的更多相关文章

  1. VTK初学一,e_Triangle三角形的绘制

    #ifndef INITIAL_OPENGL #define INITIAL_OPENGL #include <vtkAutoInit.h> VTK_MODULE_INIT(vtkRend ...

  2. VTK初学一,a_Vertex图形点的绘制

    系统:Win8.1 QT版本:2.4.2,Mingw VTK版本:6.3 2. main.cpp #ifndef INITIAL_OPENGL #define INITIAL_OPENGL #incl ...

  3. VTK初学一,b_PolyVertex_CellArray多个点的绘制

    #ifndef INITIAL_OPENGL #define INITIAL_OPENGL #include <vtkAutoInit.h> VTK_MODULE_INIT(vtkRend ...

  4. VTK初学一,e_Triangle_CellArray三角形的另一种方法绘制

    #ifndef INITIAL_OPENGL #define INITIAL_OPENGL #include <vtkAutoInit.h> VTK_MODULE_INIT(vtkRend ...

  5. VTK初学一,b_PolyVertex多个图形点的绘制

    #ifndef INITIAL_OPENGL #define INITIAL_OPENGL #include <vtkAutoInit.h> VTK_MODULE_INIT(vtkRend ...

  6. VTK初学一,比较常见的错误2

    我的开发环境: 系统:win8.1 QT:5.4.2MinGW版 VTK:6.3 按照教程生成一个球体显示在,Qt的QVTKWidget控件中,出现如下ERROR: ERROR: In D:\VTK6 ...

  7. VTK初学一,动画加AVI录制终于做出来了

      #ifndef INITIAL_OPENGL #define INITIAL_OPENGL #include <vtkAutoInit.h> VTK_MODULE_INIT(vtkRe ...

  8. VTK初学一,vtkDelaunay2D创建球冠曲面

    #ifndef INITIAL_OPENGL #define INITIAL_OPENGL #include <vtkAutoInit.h> VTK_MODULE_INIT(vtkRend ...

  9. VTK初学一,比较常见的错误1

      错误原因: 通常是在文件头部没有初始化 #ifndef INITIAL_OPENGL #define INITIAL_OPENGL #include <vtkAutoInit.h> V ...

随机推荐

  1. 向列布局动态添加F7

    function initBuildingEntryF7(sellId){ var comId = "buildingEntry"; var filter = "&quo ...

  2. ubantu eclipe

    sudo tar zxvf '/tmp/eclipse-inst-linux64.tar.gz' -C/usr/lib 4.在终端输入: $ sudo gedit /usr/share/applica ...

  3. Guava集合-BiMap

    在本篇文章中我们将介绍Guava集合中的BiMap这个接口. com.google.common.collect Interface BiMap<K,V> BiMap接口的父接口是Map& ...

  4. Codeforces Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) B. Batch Sort(暴力)

    传送门 Description You are given a table consisting of n rows and m columns. Numbers in each row form a ...

  5. Gated Recurrent Unit (GRU)公式简介

    update gate $z_t$: defines how much of the previous memory to keep around. \[z_t = \sigma ( W^z x_t+ ...

  6. Linux系统被入侵后处理经历

    服务器托管在外地机房. 突然,频繁收到一组服务器ping监控不可达邮件,赶紧登陆zabbix监控系统查看流量状况. 可见流量已经达到了800M左右,肯定不正常,马上尝试SSH登陆系统,不幸的事,这种情 ...

  7. 前端必备:FastStoneCapture 和 Licecap

    前端必备:FastStoneCapture 和 Licecap FastStoneCapture这个软件非常小,只有2M多,并且其功能很强大,包括截图,录制视频,量尺,取色等等,对于前端工程师绝对是必 ...

  8. EmgnCv进行轮廓寻找和计算物体凸包

    http://blog.csdn.net/qq_22033759/article/details/48029493 一.轮廓寻找 用的是FindContours函数,在CvInvoke中 不过需要用到 ...

  9. 异步-学习笔记3 Task

    1. 通过Task启动多线程 2. 解决多线程的几大应用场景 private void btnTask_Click(object sender, EventArgs e) { Console.Writ ...

  10. thinkphp 语言包丢失

    Thinkphp 语言包丢失 造成的原因有那些 1.复制模板 预览时内容出现英文状态 如:show.html 解决:找到lang ,在zh-cn 复制想对应的文件包 改下名称就有可以 如:admin_ ...