VTK-type vtkrotationalextrusionfilter: Modeling filter, which uses polygon data as input and generates output polygon data.

Source: Internet
Author: User
Vtkrotationalextrusionfilter is a modeling filter. It uses polygon data as the input and generates the output polygon data. The input dataset is scanned around the Z axis to create a polygon primitive. These elements form a "skirt" or a swept surface. For example, a line is scanned as the input data, and a circle around the Z axis is scanned to create the polygon data of the ring.

This filter has many parameters that can be set. You can control whether a 2D Object (that is, a polygon or triangular area) is scanned to generate instance variables of ry through "capping. In addition, you can control the rotation, angle and rotation, and whether to execute the translation along the Z axis. (Translation is very useful when creating a spiral style model similar to "Spring ). You can also adjust "deltarotation" to generate the radius of the gradient (for example, always-wound model ).

This dress is generated by some topology functions. A free edge (polygon or an edge that uses a triangle band only by a polygon or triangle band) generates a surface. This is a real straight line or line. Vertex generation line.

This filter can be used for model symmetric objects, such as gas cylinders, bottles, and wine glasses; or for translation/rotation symmetric objects such as spring or corkscrews.

Basic method:

Setresolution () is used to set the smoothness parameter of the bottle surface. The surface of the bottle consists of several surfaces.
Setangle () sets the maximum angle for rotating to produce new poly data
Settranslation (0) sets the rotation to generate the orientation along the Z axis. When a new column of poly data is generated, the translation of the column along the z direction is calculated. The default value is 0.
When setdeltaradius (0) is set to rotate to generate a new column polydata, the radius length is extended to the periphery on the x-y plane. Each column is 2 longer than the radius of the previous column. The default value is 0.

Example:

#-*-Coding: UTF-8-*-# rotate # Name: rotationalextrusionfilteractorfactory package # purpose: Test Rotating Filter # Author: ankier # created: 13-12-2012 # copyright: (c) ankier 2012 # licence: <Copyright2004-2012 ankier> # export from actorfactory import actorfactory from glo import globalfrom VTK import * ##@ brief linear actor factoryclass rotationalextrusionfilteractorfactory (actorfactory ): def _ init _ (Self): actorfactory. _ init _ (Self) self. _ polydatapoints = vtkpoints () self. _ polydatacells = vtkcellarray () self. _ polydata = vtkpolydata () self. _ rotationalextrusionfilter = vtkrotationalextrusionfilter () self. _ polydatamapper = vtkpolydatamapper () self. _ initialize () def _ del _ (Self): del self. _ polydatapoints del self. _ polydatacells del self. _ polydata del self. _ rotationalextrusionfilter del self. _ polydatamapper def _ initialize (Self): # defines the coordinate self of the bottle contour line. _ polydatapoints. insertpoint (0, 0.01, 0.0, 0.0) self. _ polydatapoints. insertpoint (1, 1.5, 0.0, 0.0) self. _ polydatapoints. insertpoint (2, 1.5, 0.0, 3.5) self. _ polydatapoints. insertpoint (3, 1.25, 0.0, 3.75) self. _ polydatapoints. insertpoint (4, 0.75, 0.0, 4.00) self. _ polydatapoints. insertpoint (5, 0.6, 0.0, 4.35) self. _ polydatapoints. insertpoint (6, 0.7, 0.0, 4.65) self. _ polydatapoints. insertpoint (7, 1.0, 0.0, 4.75) self. _ polydatapoints. insertpoint (8, 1.0, 0.0, 5.0) self. _ polydatapoints. insertpoint (9, 0.5, 0.0, 5.0) # Build a line unit and draw a line self. _ polydatacells. insertnextcell (10) self. _ polydatacells. insertcellpoint (0) self. _ polydatacells. insertcellpoint (1) self. _ polydatacells. insertcellpoint (2) self. _ polydatacells. insertcellpoint (3) Self. _ polydatacells. insertcellpoint (4) self. _ polydatacells. insertcellpoint (5) self. _ polydatacells. insertcellpoint (6) self. _ polydatacells. insertcellpoint (7) self. _ polydatacells. insertcellpoint (8) self. _ polydatacells. insertcellpoint (9) # use a set of points and cells to form poly data self. _ polydata. setpoints (self. _ polydatapoints) self. _ polydata. setlines (self. _ polydatacells) # suppress the contour to form the bottle entity self. _ rotationalextrusionfilter. setinput (self. _ polydata) # Set the smoothness parameter of the bottle surface. The number of surfaces on the bottle surface constitutes self. _ rotationalextrusionfilter. setresolution (10) # set the maximum angle of rotation to produce new poly data # self. _ rotationalextrusionfilter. setangle (90) # sets the rotation to generate a new column of poly data along the Z axis. When this column is generated, the default value is 0 and the self is not translated. _ rotationalextrusionfilter. settranslation (0) # When setting the rotation to generate a new column polydata, the radius length is extended to the periphery on the x-y plane. Each column is 2 more than the radius of the previous column, the default value is 0 self. _ rotationalextrusionfilter. setdeltaradius (0) self. _ polydatamapper. setinput (self. _ rotationalextrusionfilter. getoutput () # @ brief update line poly data def _ updatedata (Self): Pass ## @ brief override base class method # See actorfactory. _ makeactors def _ makeactors (Self): Actor = self. _ newactor () actor. setmapper (self. _ polydatamapper) actor. getproperty (). setcolor (0.1, 0.1, 0.5) return [Actor]

Running effect:

 

If the following three points are used as the filter input,

Modify the initialization function as follows:

Def _ initialize (Self): # defines the coordinate self of the bottle contour. _ polydatapoints. insertpoint (0, 1.0, 0.0, 0.0) self. _ polydatapoints. insertpoint (1, 1, 0.0, 0.5) self. _ polydatapoints. insertpoint (2, 1, 0.0, 1) # Build a line unit and draw a line self. _ polydatacells. insertnextcell (3) Self. _ polydatacells. insertcellpoint (0) self. _ polydatacells. insertcellpoint (1) self. _ polydatacells. insertcellpoint (2) # use a set of points and cells to form poly data self. _ polydata. setpoints (self. _ polydatapoints) self. _ polydata. setlines (self. _ polydatacells) # suppress the contour to form the bottle entity self. _ rotationalextrusionfilter. setinput (self. _ polydata) # Set the smoothness parameter of the bottle surface. The number of surfaces on the bottle surface constitutes self. _ rotationalextrusionfilter. setresolution (1000) # set the maximum angle self for rotating to produce new poly data. _ rotationalextrusionfilter. setangle (760) # sets the rotation to generate a new column of poly data along the Z axis. When this column is generated, the translation of this column along the z direction is 0 by default. _ rotationalextrusionfilter. settranslation (0) # When setting the rotation to generate a new column polydata, the radius length is extended to the periphery on the x-y plane. Each column is 2 more than the radius of the previous column, the default value is 0 self. _ rotationalextrusionfilter. setdeltaradius (2) self. _ polydatamapper. setinput (self. _ rotationalextrusionfilter. getoutput ())

The running effect is as follows:

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.