VTK初学一,e_Triangle_CellArray三角形的另一种方法绘制
#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 "vtkTriangle.h"
#include <vtkInteractorStyleTrackballCamera.h>
#include "vtkCellArray.h"
void myShow(vtkPolyData* aGrid)
{
vtkSmartPointer<vtkPolyDataMapper> aMapper=vtkSmartPointer<vtkPolyDataMapper>::New();
aMapper->SetInputData(aGrid);
aMapper->ScalarVisibilityOn();
vtkSmartPointer<vtkActor> anActor=vtkSmartPointer<vtkActor>::New();
anActor->SetMapper(aMapper);
anActor->GetProperty()->SetRepresentationToWireframe();
anActor->GetProperty()->SetDiffuseColor(1,1,1);
// anActor->GetProperty()->SetLineWidth(10);
anActor->GetProperty()->SetPointSize(30);
vtkSmartPointer<vtkRenderer> ren1=vtkSmartPointer<vtkRenderer>::New();
vtkSmartPointer<vtkRenderWindow> renWin=vtkSmartPointer<vtkRenderWindow>::New();
ren1->AddActor(anActor);
ren1->ResetCamera();
renWin->AddRenderer(ren1);
renWin->SetSize(512,512);
vtkSmartPointer<vtkRenderWindowInteractor> iren=vtkSmartPointer<vtkRenderWindowInteractor>::New();
vtkSmartPointer<vtkInteractorStyleTrackballCamera> style=vtkSmartPointer<vtkInteractorStyleTrackballCamera>::New();
iren->SetRenderWindow(renWin);
iren->SetInteractorStyle(style);
iren->Start();
}
int main()
{
//几何数据
vtkSmartPointer<vtkPoints> trianglePoints=vtkSmartPointer<vtkPoints>::New();
trianglePoints->SetNumberOfPoints(3);
trianglePoints->InsertPoint(0,0,0,0);
trianglePoints->InsertPoint(1,1,0,0);
trianglePoints->InsertPoint(2,1,1,1);
//属性数据
vtkSmartPointer<vtkFloatArray> pointsScalars=vtkSmartPointer<vtkFloatArray>::New();
pointsScalars->SetNumberOfTuples(3);
pointsScalars->SetValue(0,0);
pointsScalars->SetValue(1,1);
pointsScalars->SetValue(2,0);
//形成组元数据
vtkSmartPointer<vtkCellArray> lines=vtkSmartPointer<vtkCellArray>::New();
lines->InsertNextCell(4);
lines->InsertCellPoint(0);
lines->InsertCellPoint(1);
lines->InsertCellPoint(2);
lines->InsertCellPoint(0);
//几何轮廓
vtkSmartPointer<vtkPolyData> profile=vtkSmartPointer<vtkPolyData>::New();
profile->SetPoints(trianglePoints);
profile->SetLines(lines);
profile->GetPointData()->SetScalars(pointsScalars);
myShow(profile);
return 0;
}

VTK初学一,e_Triangle_CellArray三角形的另一种方法绘制的更多相关文章
- VTK初学一,b_PolyVertex多个图形点的绘制
#ifndef INITIAL_OPENGL #define INITIAL_OPENGL #include <vtkAutoInit.h> VTK_MODULE_INIT(vtkRend ...
- css三角形实现的几种方法的区别
演变: .triangle{ height: 30px; width: 30px; display: inline-block; border: 30px solid; border-color: # ...
- 今天我们要说的画一个三角形,恩,画一个三角形,第一种呢是利用我们的html标签结合css来实现;而第二种方法就就是我们的html5新增的一个标签canves,这个canves就是网页画幕,那么顾名思义就是在网页里建造一个画板,用来画画,好,那接下来就和我一起去看看吧!
第一种方法:利用我们的html标签结合css来实现 span{ width:0px; height:0px; border-width:7px; border-style:solid; border- ...
- 纯Css绘制三角形箭头三种方法
在制作网页的过程中少不了绘制类似图片的三角形箭头效果,虽然工程量不大,但是确实麻烦.在学习的过程中,总结了以下三种方法,以及相关的例子. 一.三种绘制三角形箭头方法 1.方法一:利用overflow: ...
- VTK初学一,e_Triangle三角形的绘制
#ifndef INITIAL_OPENGL #define INITIAL_OPENGL #include <vtkAutoInit.h> VTK_MODULE_INIT(vtkRend ...
- VTK初学一,比较常见的错误2
我的开发环境: 系统:win8.1 QT:5.4.2MinGW版 VTK:6.3 按照教程生成一个球体显示在,Qt的QVTKWidget控件中,出现如下ERROR: ERROR: In D:\VTK6 ...
- VTK初学一,c_Line_CellArray线段的CellArray绘制
VTK窗口默认坐标方向: #ifndef INITIAL_OPENGL #define INITIAL_OPENGL #include <vtkAutoInit.h> VTK_MODULE ...
- VTK初学一,a_Vertex图形点的绘制
系统:Win8.1 QT版本:2.4.2,Mingw VTK版本:6.3 2. main.cpp #ifndef INITIAL_OPENGL #define INITIAL_OPENGL #incl ...
- VTK初学一,动画加AVI录制终于做出来了
#ifndef INITIAL_OPENGL #define INITIAL_OPENGL #include <vtkAutoInit.h> VTK_MODULE_INIT(vtkRe ...
随机推荐
- PostgreSQL Reading Ad Writing Files、Execution System Instructions Vul
catalog . postgresql简介 . 文件读取/写入 . 命令执行 . 影响范围 . 恶意代码分析 . 缓解方案 1. postgresql简介 PostgreSQL 是一个自由的对象-关 ...
- ADC/DAC的一些参数
1.LSB,Least Significant Bit LSB是指最低位一个bit的权值,比喻ADC是一把尺子,那LSB则是它的最小刻度.LSB=Vfs/(2^N),Vfs为full scale vo ...
- 单向关系中的JoinColumn
1.person与address的一对一单向关系: 在address中没有特殊的注解. 在Person中对应到数据库里面就有一个指向Address的外键. 我们也可以增加注释指定外键的列的名字,如下: ...
- MVVM
MVVM 是 Model-View-ViewModel 的简写,MVVM 模式和 MVC 模式一样,主要目的是分离视图(View)和模型(Model) 接下来给大家分享一个总结的MVVM,来吧---- ...
- 怎样用命令行编译C#程序
1. 把程序拷贝至记事本 2.另存为*cs格式 3.找到VS2015提供的命令提示 4.要把命令行指向程序所在的目录(可以有个小软件) 如果在其他的盘符,先敲D:,然后再cd 5.输入csc hell ...
- char *p = "abcdefg"; p[0] = p[1]出错
参考:http://blog.sina.com.cn/s/blog_5c0172280100ut4o.html 1.char *s="abc"; 看这个赋值: 右边,是" ...
- Github for Windows使用介绍
Git已经变得非常流行,连Codeplex现在也已经主推Git.Github上更是充斥着各种高质量的开源项目,比如ruby on rails,cocos2d等等.对于习惯Windows图形界面的程序员 ...
- Windows7、8无法访问其他计算机共享盘
Windows7.8无法访问其他计算机共享盘 WIN7 访问共享的时候提示用户名和密码不正确,在XP系统上可以正常访问 一.win+r gpedit.msc 进行组策略如图所示 二.wind ...
- Web Api系列教程第2季(OData篇)(一)——OData简介和一个小应用
第一季的链接以及系列导航:http://www.cnblogs.com/fzrain/p/3490137.html 在这里,首先要感谢Taiseer Joudeh不断的为我们带来最新的技术分享,楼主对 ...
- iTunes访问自己应用的沙盒