VTK-based vtksuperquadricsource: Create poly data for a polygon superquadratic surface centered on the Origin

Source: Internet
Author: User

Vtksuperquadricsource: Create a polygon superquadratic surface centered on the origin. You can set the size. You can set the resolution of two (?) latitudes and the longitude (?) Direction ).The latitude round and longitude round parameters control the shape of the superquadratic surface. The Boolean value of the ring determines whether to generate a circular superquadratic surface. If yes, the thickness parameter controls the thickness of the ring: 0 is the thinnest ring, and 1 has the smallest size of the hole. The scale parameter allows scaling over a Quadratic Surface on X, Y, and Z (in any case, the normal vector is correctly generated. The size of the superquadratic surface controlled by the size parameter.

The principle is based on the "rigid physical-based superquadratic surface", Ah Bala, in the "graphic gem III", David Kirk, editor, Science Press, 1992.

Basic method:

Setcenter () sets the center point

The setthickness () thickness parameter controls the thickness of the ring: 0 is the thinnest ring, and 1 has the smallest size of the hole

Toroideon () Enable Ring

Setphiroundness () and setthetaroundness set the latitude and longitude Ring

Setscale () is set to the tensile coefficient of the superquadratic surface in the X, Y, and Z directions.

Example:

 #  -*-Coding: UTF-8 -*-  # -------------------------------------------------------------------------------  #  Name: module 2  #  Purpose:  ##  Author: ankier  ##  Created: 12-12-2012  #  Copyright: (c) ankier 2012  #  Licence: <your licence>  # -------------------------------------------------------------------------------  From Actorfactory Import  Actorfactory  From VTK Import * #  # @ Detal produce superquadratic Surface  Class  Superquadricactorfactory (actorfactory ):  Def   _ Init __  (Self): actorfactory. _ Init __  (Self) self.  _ Superquadricsource = Vtksuperquadricsource ()  Def  _ Makeactors (Self): Self.  _ Superquadricsource  . Setcenter (0, 0, 0) self.  _ Superquadricsource . Setthickness (0.8 ) Self.  _ Superquadricsource . Setsize (20 ) Self. _ Superquadricsource  . Toroideon () self.  _ Superquadricsource . Setphiroundness (10 ) Self.  _ Superquadricsource . Setthetaroundness (1 ) Self.  _ Superquadricsource . Setscale (1, 0.5, 1 ) Polydatamapper = Vtkpolydatamapper () polydatamapper. setinput (self.  _ Superquadricsource  . Getoutput () actor =Self. _ newactor () actor. setmapper (polydatamapper) actor. getproperty (). setcolor (( 1.0, 0.7, 0.2 ))  Return  [Actor]  Def   _ Del __  (Self ):  Del Self. _ Superquadricsource 

Running effect:

 

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.