一、vtkQuadRotationalExtrusionFilter

Detailed Description

sweep polygonal data creating "skirt" from free edges and lines, and lines from vertices

vtkQuadRotationalExtrusionFilter is a modeling filter. It takes polygonal data as input and generates polygonal data on output. The input dataset is swept around the z-axis to create new polygonal primitives. These primitives form a "skirt" or swept surface. For example, sweeping a line results in a cylindrical shell, and sweeping a circle creates a torus.

There are a number of control parameters for this filter. You can control whether the sweep of a 2D object (i.e., polygon or triangle strip) is capped with the generating geometry via the "Capping" instance variable. Also, you can control the angle of rotation, and whether translation along the z-axis is performed along with the rotation. (Translation is useful for creating "springs".) You also can adjust the radius of the generating geometry using the "DeltaRotation" instance variable.

The skirt is generated by locating certain topological features. Free edges (edges of polygons or triangle strips only used by one polygon or triangle strips) generate surfaces. This is true also of lines or polylines. Vertices generate lines.

This filter can be used to model axisymmetric objects like cylinders, bottles, and wine glasses; or translational/rotational symmetric objects like springs or corkscrews.

Warning:
If the object sweeps 360 degrees, radius does not vary, and the object does not translate, capping is not performed. This is because the cap is unnecessary.
Some polygonal objects have no free edges (e.g., sphere). When swept, this will result in two separate surfaces if capping is on, or no surface if capping is off.
See also:
vtkLinearExtrusionFilter vtkRotationalExtrusionFilter
Thanks:
This class was initially developed by Daniel Aguilera, CEA/DIF Ported and modified by Philippe Pebay, Kitware, 2011
Tests:
vtkQuadRotationalExtrusionFilter (Tests)

Definition at line 74 of file vtkQuadRotationalExtrusionFilter.h.

示例代码:

#ifndef INITIAL_OPENGL
#define INITIAL_OPENGL
#include <vtkAutoInit.h>
VTK_MODULE_INIT(vtkRenderingOpenGL)
VTK_MODULE_INIT(vtkInteractionStyle)
#endif
#include <iostream> using namespace std;
#include "vtkCamera.h"
#include "vtkInformation.h"
#include "vtkLineSource.h"
#include "vtkMultiBlockDataSet.h"
#include "vtkNew.h"
#include "vtkPolyDataMapper.h"
#include "vtkPolyDataNormals.h"
#include "vtkProperty.h"
#include "vtkRegressionTestImage.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkQuadRotationalExtrusionFilter.h"
#include "vtkTestUtilities.h"
int main()
{
// Create a line source
vtkNew<vtkLineSource> line;
line->SetPoint1( ., ., . );
line->SetPoint2( ., ., . );
line->SetResolution( );
line->Update(); // Create mapper for line segment
vtkNew<vtkPolyDataMapper> lineMapper;
lineMapper->SetInputConnection( line->GetOutputPort() ); // Create actor for line segment
vtkNew<vtkActor> lineActor;
lineActor->SetMapper( lineMapper.GetPointer() );
lineActor->GetProperty()->SetLineWidth( );
lineActor->GetProperty()->SetColor( ., ., . ); // deep sky blue // Create multi-block data set for quad-based sweep
vtkNew<vtkMultiBlockDataSet> lineMB;
lineMB->SetNumberOfBlocks( );
lineMB->GetMetaData( static_cast<unsigned>( ) )->Set( vtkCompositeDataSet::NAME(), "Line" );
lineMB->SetBlock( , line->GetOutput() ); // Create 3/4 of a cylinder by rotational extrusion
vtkNew<vtkQuadRotationalExtrusionFilter> lineSweeper;
lineSweeper->SetResolution( );
lineSweeper->SetInputData( lineMB.GetPointer() );
lineSweeper->SetDefaultAngle( );
lineSweeper->Update(); // Retrieve polydata output
vtkMultiBlockDataSet* cylDS = vtkMultiBlockDataSet::SafeDownCast( lineSweeper->GetOutputDataObject( ) );
vtkPolyData* cyl = vtkPolyData::SafeDownCast( cylDS->GetBlock( ) ); // Create normals for smooth rendering
vtkNew<vtkPolyDataNormals> normals;
normals->SetInputData( cyl ); // Create mapper for surface representation
vtkNew<vtkPolyDataMapper> cylMapper;
cylMapper->SetInputConnection( normals->GetOutputPort() );
cylMapper->SetResolveCoincidentTopologyToPolygonOffset(); // Create mapper for wireframe representation
vtkNew<vtkPolyDataMapper> cylMapperW;
cylMapperW->SetInputData( cyl );
cylMapperW->SetResolveCoincidentTopologyToPolygonOffset(); // Create actor for surface representation
vtkNew<vtkActor> cylActor;
cylActor->SetMapper( cylMapper.GetPointer() );
cylActor->GetProperty()->SetRepresentationToSurface();
cylActor->GetProperty()->SetInterpolationToGouraud();
cylActor->GetProperty()->SetColor( ., 0.3882, . ); // tomato // Create actor for wireframe representation
vtkNew<vtkActor> cylActorW;
cylActorW->SetMapper( cylMapperW.GetPointer() );
cylActorW->GetProperty()->SetRepresentationToWireframe();
cylActorW->GetProperty()->SetColor( ., ., .);
cylActorW->GetProperty()->SetAmbient( . );
cylActorW->GetProperty()->SetDiffuse( . );
cylActorW->GetProperty()->SetSpecular( . ); // Create a renderer, add actors to it
vtkNew<vtkRenderer> ren1;
ren1->AddActor( lineActor.GetPointer() );
ren1->AddActor( cylActor.GetPointer() );
ren1->AddActor( cylActorW.GetPointer() );
ren1->SetBackground( ., ., . ); // Create a renderWindow
vtkNew<vtkRenderWindow> renWin;
renWin->AddRenderer( ren1.GetPointer() );
renWin->SetSize( , );
renWin->SetMultiSamples( ); // Create a good view angle
vtkNew<vtkCamera> camera;
camera->SetClippingRange( 0.576398, 28.8199 );
camera->SetFocalPoint( 0.0463079, -0.0356571, 1.01993 );
camera->SetPosition( -2.47044, 2.39516, -3.56066 );
camera->SetViewUp( 0.607296, -0.513537, -0.606195 );
ren1->SetActiveCamera( camera.GetPointer() ); // Create interactor
vtkNew<vtkRenderWindowInteractor> iren;
iren->SetRenderWindow( renWin.GetPointer() );
// Render and test
renWin->Render();
iren->Start(); return ;
}

运行显示结果:

2、vtkRotationalExtrusionFilter

Detailed Description

sweep polygonal data creating "skirt" from free edges and lines, and lines from vertices

vtkRotationalExtrusionFilter is a modeling filter. It takes polygonal data as input and generates polygonal data on output. The input dataset is swept around the z-axis to create new polygonal primitives. These primitives form a "skirt" or swept surface. For example, sweeping a line results in a cylindrical shell, and sweeping a circle creates a torus.

There are a number of control parameters for this filter. You can control whether the sweep of a 2D object (i.e., polygon or triangle strip) is capped with the generating geometry via the "Capping" instance variable. Also, you can control the angle of rotation, and whether translation along the z-axis is performed along with the rotation. (Translation is useful for creating "springs".) You also can adjust the radius of the generating geometry using the "DeltaRotation" instance variable.

The skirt is generated by locating certain topological features. Free edges (edges of polygons or triangle strips only used by one polygon or triangle strips) generate surfaces. This is true also of lines or polylines. Vertices generate lines.

This filter can be used to model axisymmetric objects like cylinders, bottles, and wine glasses; or translational/rotational symmetric objects like springs or corkscrews.

Warning:
If the object sweeps 360 degrees, radius does not vary, and the object does not translate, capping is not performed. This is because the cap is unnecessary.
Some polygonal objects have no free edges (e.g., sphere). When swept, this will result in two separate surfaces if capping is on, or no surface if capping is off.
See also:
vtkLinearExtrusionFilter
Examples:
vtkRotationalExtrusionFilter (Examples)
Tests:
vtkRotationalExtrusionFilter (Tests)

示例代码:

#include <iostream>
#ifndef INITIAL_OPENGL
#define INITIAL_OPENGL
#include <vtkAutoInit.h>
VTK_MODULE_INIT(vtkRenderingOpenGL)
VTK_MODULE_INIT(vtkInteractionStyle)
#endif
using namespace std;
// .SECTION Thanks
// This test was written by Philippe Pebay, Kitware SAS 2011 #include "vtkCamera.h"
#include "vtkLineSource.h"
#include "vtkNew.h"
#include "vtkPolyDataMapper.h"
#include "vtkPolyDataNormals.h"
#include "vtkProperty.h"
#include "vtkRegressionTestImage.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkRotationalExtrusionFilter.h" int main()
{
// Create a line source
vtkNew<vtkLineSource> line;
line->SetPoint1( ., ., . );
line->SetPoint2( ., ., . );
line->SetResolution( ); // Create mapper for line segment
vtkNew<vtkPolyDataMapper> lineMapper;
lineMapper->SetInputConnection( line->GetOutputPort() ); // Create actor for line segment
vtkNew<vtkActor> lineActor;
lineActor->SetMapper( lineMapper.GetPointer() );
lineActor->GetProperty()->SetLineWidth( );
lineActor->GetProperty()->SetColor( ., ., . ); // deep sky blue // Create 3/4 of a cylinder by rotational extrusion
vtkNew<vtkRotationalExtrusionFilter> lineSweeper;
lineSweeper->SetResolution( );
lineSweeper->SetInputConnection( line->GetOutputPort() );
lineSweeper->SetAngle( ); // Create normals for smooth rendering
vtkNew<vtkPolyDataNormals> normals;
normals->SetInputConnection( lineSweeper->GetOutputPort() ); // Create mapper for surface representation
vtkNew<vtkPolyDataMapper> cylMapper;
cylMapper->SetInputConnection( normals->GetOutputPort() );
cylMapper->SetResolveCoincidentTopologyToPolygonOffset(); // Create mapper for wireframe representation
vtkNew<vtkPolyDataMapper> cylMapperW;
cylMapperW->SetInputConnection( lineSweeper->GetOutputPort() );
cylMapperW->SetResolveCoincidentTopologyToPolygonOffset();
// Create actor for surface representation
vtkNew<vtkActor> cylActor;
cylActor->SetMapper( cylMapper.GetPointer() );
cylActor->GetProperty()->SetRepresentationToSurface();
cylActor->GetProperty()->SetInterpolationToGouraud();
cylActor->GetProperty()->SetColor( ., ., . ); // tomato
// Create actor for wireframe representation
vtkNew<vtkActor> cylActorW;
cylActorW->SetMapper( cylMapperW.GetPointer() );
cylActorW->GetProperty()->SetRepresentationToWireframe();
cylActorW->GetProperty()->SetColor( ., ., .);
cylActorW->GetProperty()->SetAmbient( . );
cylActorW->GetProperty()->SetDiffuse( . );
cylActorW->GetProperty()->SetSpecular( . );
// Create a renderer, add actors to it
vtkNew<vtkRenderer> ren1;
ren1->AddActor( lineActor.GetPointer() );
ren1->AddActor( cylActor.GetPointer() );
ren1->AddActor( cylActorW.GetPointer() );
ren1->SetBackground( ., ., . ); // Create a renderWindow
vtkNew<vtkRenderWindow> renWin;
renWin->AddRenderer( ren1.GetPointer() );
renWin->SetSize( , );
renWin->SetMultiSamples( );
// Create a good view angle
vtkNew<vtkCamera> camera;
camera->SetClippingRange( 0.576398, 28.8199 );
camera->SetFocalPoint( 0.0463079, -0.0356571, 1.01993 );
camera->SetPosition( -2.47044, 2.39516, -3.56066 );
camera->SetViewUp( 0.607296, -0.513537, -0.606195 );
ren1->SetActiveCamera( camera.GetPointer() ); // Create interactor
vtkNew<vtkRenderWindowInteractor> iren;
iren->SetRenderWindow( renWin.GetPointer() ); // Render and test
renWin->Render();
iren->Start(); return ;
}

代码运行结果:

vtk旋转扫描实体示例:vtkQuadRotationalExtrusionFilter、vtkRotationalExtrusionFilter的更多相关文章

  1. 应用程序框架实战三十四:数据传输对象(DTO)介绍及各类型实体比较

    本文将介绍DDD分层架构中广泛使用的数据传输对象Dto,并且与领域实体Entity,查询实体QueryObject,视图实体ViewModel等几种实体进行比较. 领域实体为何不能一统江湖? 当你阅读 ...

  2. 数据传输对象(DTO)介绍及各类型实体比较

    数据传输对象(DTO)介绍及各类型实体比较 本文将介绍DDD分层架构中广泛使用的数据传输对象Dto,并且与领域实体Entity,查询实体QueryObject,视图实体ViewModel等几种实体进行 ...

  3. Rookey.Frame之实体类

    上周跟大家分享了Rookey.Frame框架的初始化功能,今天继续给大家介绍实体类的设计. 先看下下面菜单实体示例代码: using Rookey.Frame.EntityBase; using Ro ...

  4. ABP框架 - 数据过滤

    文档目录 本节内容: 简介 预定义过滤 ISoftDelete 何时可用? IMustHaveTenant 何时可用? IMayHaveTenant 何时可用? 禁用过滤 关于using声明 关于多租 ...

  5. EF CodeFirst EntityTypeConfiguration 自关联映射配置

    实体示例代码: public class Message { public Message() { } public int ID { get; private set; } public strin ...

  6. c# SqlHelper Class

    using System;using System.Collections;using System.Collections.Generic;using System.Data;using Syste ...

  7. WPF学习之路初识

    WPF学习之路初识   WPF 介绍 .NET Framework 4 .NET Framework 3.5 .NET Framework 3.0 Windows Presentation Found ...

  8. Entity Framework Core 2.0 全局查询过滤器

    不定时更新翻译系列,此系列更新毫无时间规律,文笔菜翻译菜求各位看官老爷们轻喷,如觉得我翻译有问题请挪步原博客地址 本博文翻译自: http://gunnarpeipman.com/2017/08/ef ...

  9. 基于EF Core的Code First模式的DotNetCore快速开发框架

    前言 最近接了几个小单子,因为是小单子,项目规模都比较小,业务相对来说,也比较简单.所以在选择架构的时候,考虑到效率方面的因素,就采取了asp.net+entity framework中的code f ...

随机推荐

  1. [uboot] (番外篇)uboot relocation介绍(转)

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/ooonebook/article/det ...

  2. Centos安装nmap端口查看工具

    CentOS安装nmap端口查看工具 一.安装nmap yum install nmap    #输入y安装 二.使用nmap      nmap localhost    #查看主机当前开放的端口  ...

  3. 封装ORM.py与mysql_client.py代码

    ORM.py ''' ORM: 对象关系映射 ---> 映射到数据库MySQL中的数据表 类名 ---> 表名 对象 ---> 一条记录 对象.属性 ---> 字段 模拟Dja ...

  4. 使用IDEA搭建一个 Spring + Spring MVC + Mybatis 的Web项目 ( 零配置文件 )

    前言: 除了mybatis 不是零配置,有些还是有xml的配置文件在里面的. 注解是Spring的一个构建的一个重要手段,减少写配置文件,下面解释一下一些要用到的注解: @Configuration  ...

  5. JVM启动参数大全及默认值

    Java启动参数共分为三类: 其一是标准参数(-),所有的JVM实现都必须实现这些参数的功能,而且向后兼容: 其二是非标准参数(-X),默认jvm实现这些参数的功能,但是并不保证所有jvm实现都满足, ...

  6. 【Winform-ComboBox】实现ComboBox下拉框与数据库的绑定

    实现效果如下: 1.设计窗体 下拉框的名称cmbName 2.连接数据库 DBHelper类代码: class DBHelper { /// <summary> /// 创建静态连接字符串 ...

  7. 【WinForm-无边框窗体】实现Panel移动窗体,没有边框的窗体

    没有边框的窗体怎么移动?其实方法有很多,下面介绍一种用控件来移动窗体,Panel或PictureBox都可.主要设置控件的MouseDowm和MouseLeave事件. 第一步:窗体设计 窗体最上面是 ...

  8. 32.把数组排成最小的数(python)

    题目描述 输入一个正整数数组,把数组里所有数字拼接起来排成一个数,打印能拼接出的所有数字中最小的一个.例如输入数组{3,32,321},则打印出这三个数字能排成的最小数字为321323. # -*- ...

  9. vs 2019 调试web项目 浏览器

  10. StreamWriter、StreamReader

    IO流操作文件内容,using System.IO;//引入命名空间 private void button1_Click(object sender, EventArgs e) { if (text ...