zoukankan      html  css  js  c++  java
  • vtk类之vtkShrinkFilter :收缩构成对其质心任意数据集的单元格,返回vtkUnstructuredGrid数据集

    收缩构成一个任意的数据集的单元格

    vtkShrinkFilter 收缩构成对其质心任意数据集的单元格。单元格点的平均位置作为计算单元的质心。萎缩中断开另一个单元格的结果。此筛选器的输出是的一般数据集类型 vtkUnstructuredGrid。

    警告:

    它是可能打开细胞里面翻出来,或在特殊情况下造成自我交集。
    例子:
    #-*- coding: UTF-8 -*-
    #-------------------------------------------------------------------------------
    # Name:        模块2
    # Purpose:
    #
    # Author:      ankier
    #
    # Created:     18-12-2012
    # Copyright:   (c) Administrator 2012
    # Licence:     <your licence>
    #-------------------------------------------------------------------------------
    
    from ActorFactory import ActorFactory
    
    from vtk import *
    ## @detal 
    class TransformActorFactory(ActorFactory):
        def __init__(self):
            ActorFactory.__init__(self)        
            self.__ElevationFilter = vtkElevationFilter()   
            
            self.__ElevationFilter.SetLowPoint(0, 0, -0.5)
            self.__ElevationFilter.SetHighPoint(0, 0, 0.5)     
            
        def _MakeActors(self):
            sphere = vtkSphereSource()
            sphere.SetThetaResolution(8)
            sphere.SetPhiResolution(8)
            sphere.SetRadius(20)
            transform = vtkTransform()
            transform.Scale(0.5, 1.5, 2.0)
            transformFilter = vtkTransformFilter()
            transformFilter.SetInput(sphere.GetOutput())
            transformFilter.SetTransform(transform)
            
            shrinkFilter = vtkShrinkFilter()
            shrinkFilter.SetInput(transformFilter.GetOutput())
            shrinkFilter.SetShrinkFactor(0.8)
            
            self.__ElevationFilter.SetInput(shrinkFilter.GetOutput())
            
            dataSetMapper = vtkDataSetMapper()
            dataSetMapper.SetInput(self.__ElevationFilter.GetOutput())
            actor = self._NewActor()
            actor.SetMapper(dataSetMapper)
            #actor.GetProperty().SetColor((0.5, 0.7, 0.2))
            
            return [actor]
        
        def __del__(self):
            del self.__EarthSource
            

    运行结果:

  • 相关阅读:
    MySQL数据库的完全备份与恢复
    MySQL数据库之索引、事务、存储引擎详细讲解
    LNMP架构介绍与部署
    Haproxy搭建Web集群
    LAMP环境之MySQL服务安装详细过程
    MySQL主从复制详解
    LAMP环境之编译安装httpd服务
    搭建yum软件仓库,让你维护轻松自如
    Shell脚本一键安装Samba服务
    Shell脚本之冒泡排序
  • 原文地址:https://www.cnblogs.com/ankier/p/2824089.html
Copyright © 2011-2022 走看看