VTK初学一,a_Vertex图形点的绘制
系统:Win8.1
QT版本:2.4.2,Mingw
VTK版本:6.3
2. main.cpp
#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 "vtkVertex.h"
#include "vtkInteractorStyleTrackballCamera.h"
void myShow(vtkSmartPointer<vtkUnstructuredGrid> aGrid);
int main()
{
// create a scene with one of each cell type
//Vertex
vtkPoints *vertexPoints=vtkPoints::New();
vertexPoints-> SetNumberOfPoints (1);
vertexPoints-> InsertPoint( 0, 0, 0, 0);
vtkFloatArray *vertexScalars=vtkFloatArray::New();
vertexScalars-> SetNumberOfTuples (1);
vertexScalars-> InsertValue (0, 1);
vtkVertex *aVertex=vtkVertex::New();
aVertex-> GetPointIds()-> SetId (0, 0);
vtkUnstructuredGrid *aVertexGrid=vtkUnstructuredGrid::New();
aVertexGrid-> Allocate (1, 1);
aVertexGrid-> InsertNextCell (aVertex-> GetCellType(), aVertex ->GetPointIds());
aVertexGrid ->SetPoints (vertexPoints);
aVertexGrid-> GetPointData() ->SetScalars (vertexScalars);
myShow(aVertexGrid);
return 0;
}
void myShow(vtkSmartPointer<vtkUnstructuredGrid> aGrid)
{
//设置映射器
vtkSmartPointer<vtkDataSetMapper> aMapper=vtkSmartPointer<vtkDataSetMapper>::New();
aMapper->SetInputData(aGrid);
aMapper->ScalarVisibilityOn();
vtkSmartPointer<vtkActor> anActor=vtkSmartPointer<vtkActor>::New();
anActor->SetMapper(aMapper);
anActor->GetProperty()->SetRepresentationToPoints();
// anActor->GetProperty()->SetRepresentationToWireframe();
anActor->GetProperty()->SetDiffuseColor(1,0,0);
// anActor->GetProperty()->SetLineWidth(5);
// anActor->GetProperty()->SetEdgeColor(1,0,0);
anActor->GetProperty()->SetPointSize(10);
//创建显示窗口
vtkSmartPointer<vtkRenderer> ren1=vtkSmartPointer<vtkRenderer>::New();
vtkSmartPointer<vtkRenderWindow> renWin=vtkSmartPointer<vtkRenderWindow>::New();
ren1->AddActor(anActor);
renWin->AddRenderer(ren1);
vtkSmartPointer<vtkRenderWindowInteractor> iren=vtkSmartPointer<vtkRenderWindowInteractor>::New();
vtkSmartPointer<vtkInteractorStyleTrackballCamera> style=vtkSmartPointer<vtkInteractorStyleTrackballCamera>::New();
iren->SetInteractorStyle(style);
iren->SetRenderWindow(renWin);
renWin->SetSize(700,700);
ren1->ResetCamera();
renWin->Render();
iren->Start();
}

VTK初学一,a_Vertex图形点的绘制的更多相关文章
- VTK初学一,e_Triangle三角形的绘制
#ifndef INITIAL_OPENGL #define INITIAL_OPENGL #include <vtkAutoInit.h> VTK_MODULE_INIT(vtkRend ...
- 借助Photoshop,Illustrator等设计软件进行WPF图形图像的绘制
原文:借助Photoshop,Illustrator等设计软件进行WPF图形图像的绘制 本文所示例子是借助第三方设计软件,制作复杂的矢量图形,转成与XAML酷似的SVG,再转换成xaml而实现的. 这 ...
- VTK初学一,b_PolyVertex多个图形点的绘制
#ifndef INITIAL_OPENGL #define INITIAL_OPENGL #include <vtkAutoInit.h> VTK_MODULE_INIT(vtkRend ...
- VTK初学一,c_Line_CellArray线段的CellArray绘制
VTK窗口默认坐标方向: #ifndef INITIAL_OPENGL #define INITIAL_OPENGL #include <vtkAutoInit.h> VTK_MODULE ...
- VTK初学一,b_PolyVertex_CellArray多个点的绘制
#ifndef INITIAL_OPENGL #define INITIAL_OPENGL #include <vtkAutoInit.h> VTK_MODULE_INIT(vtkRend ...
- VTK初学一,e_Triangle_CellArray三角形的另一种方法绘制
#ifndef INITIAL_OPENGL #define INITIAL_OPENGL #include <vtkAutoInit.h> VTK_MODULE_INIT(vtkRend ...
- Matlab绘图基础——利用axes(坐标系图形对象)绘制重叠图像 及 一图多轴(一幅图绘制多个坐标轴)
描述 axes在当前窗口中创建一个包含默认属性坐标系 axes('PropertyName',propertyvalue,...)创建坐标系时,同时指定它的一些属性,没有指定的使用DefaultAxe ...
- VTK初学一,比较常见的错误2
我的开发环境: 系统:win8.1 QT:5.4.2MinGW版 VTK:6.3 按照教程生成一个球体显示在,Qt的QVTKWidget控件中,出现如下ERROR: ERROR: In D:\VTK6 ...
- SVG关注复杂图形的网页绘制技术
SVG 是使用 XML 来描述二维图形和绘图程序的语言. 学习之前应具备的基础知识: 继续学习之前,你应该对以下内容有基本的了解: HTML XML 基础 如果希望首先学习这些内容,请在本站的首页选择 ...
随机推荐
- 认识http协议
http:Hyper Text Transfer Protocol,超文本传输协议.是互联网上应用最为广泛的一种网络协议.所有的WWW文件都必须遵守这个标准.设计HTTP最初的目的是为了提供一种发布和 ...
- tyvj2018 小猫爬山
之前做过一道题"破锣摇滚乐队",把猫都编了号,每辆车只能装一些编号递增的猫,而且前一辆车的猫编号都比后一辆车小.那道题的DP状态是:f[i][j]表示装了前i只猫,使用了j辆车时第 ...
- C++自问自答
1.为什么派生层次上的类,同一个虚函数在各个类的虚表中的位置一样? 因为:对虚函数的调用是通过虚指针+偏移地址构成,由于对虚函数的调用都是通过这种方式,所以对同一个虚函数的偏移值就必须 ...
- gzip、bzip2、tar压缩命令使用
1. gzip gzip test.txt //压缩 gzip -d test.txt.gz //解压缩 gzip -9 test.txt //设置压缩等级(9最好,1最差,默认6) 相关:zcat ...
- A.Kaw矩阵代数初步学习笔记 6. Gaussian Elimination
“矩阵代数初步”(Introduction to MATRIX ALGEBRA)课程由Prof. A.K.Kaw(University of South Florida)设计并讲授. PDF格式学习笔 ...
- JavaScript 单线程相关
众所周知,Javascript是单线程执行的,这也就是说:JavaScript在同一个时间上只能处理一件事.他不像C,Java等这些多线程的,可以开不同的线程去同时处理多件事情. 那么为什么别的语言都 ...
- RNN 入门教程 Part 2 – 使用 numpy 和 theano 分别实现RNN模型
转载 - Recurrent Neural Networks Tutorial, Part 2 – Implementing a RNN with Python, Numpy and Theano 本 ...
- uC/OS-II汇编代码
;*************************************************************************************************** ...
- Java数据结构——哈希表
- 第4章 jQuery的事件和动画(二)
二. jQuery中的动画 动画在前面几章案例中是回避不了的问题.此处结合一些简便的写法稍作系统的分析. 1. show()和hide()(1)介绍——不用过多的介绍了jQuery最基本的方法.本质是 ...