Vtkplanesource
Create a quadrilateral array of a plane.
Vtkplanesource creates a quadrilateral on a plane represented by an m × n Array. A plane is a vector of two axes defined by specifying a starting point and then two other points. These two vectors are not necessarily orthogonal, but must be non-parallel quadrilateral. Ivars xresolution and yresolution that can be controlled to adjust the resolution of the plane (that is, the fine score ).
By default, the center of the plane is at the origin and perpendicular to the Z axis. The length is 1 and the resolution is set to the width and height of 1.
There are three convenient methods for you to easily set the plane. First, setnormal () allows you to specify the normal vector of the plane. Rotate the plane along the normal vector. Second, setcenter (), which is translated to the specified center point. The third method, push (), allows you to translate a certain distance along the plane method vector.
Basic usage:
1. Use setorigin () setpoint1 () and setpoint2 () to determine the three points that are not in a straight line and determine a quadrilateral plane.
2. Use setcenter (), setnormal (), push (), and so on to rotate and translate the space position of the plane.
Example:
#-*-Coding: UTF-8-*-# partition # Name: planeactorfactory package # purpose: Create a flat # Author: ankier # created: 12-12-2012 # copyright: (c) ankier 2012 # licence: <your licence> # revoke from actorfactory import actorfactory from glo import globalfrom VTK import * ##@ brief linear actor factoryclass planeactorfactory (actorfactory ): def _ init _ (Self): actorfactory. _ init _ (Self) self. _ planesource = vtkplanesource () def _ del _ (Self): del self. _ planesource # @ brief updates the poly data def _ updatedata (Self): globalinstance = Global. getinstance () self. _ planesource. setorigin (-50,-50, 0) self. _ planesource. setpoint1 (50,-50, 0) self. _ planesource. setpoint2 (-50, 50, 0) self. _ planesource. setxresolution (50) self. _ planesource. setyresolution (50) ## @ brief translate the plane to the specified position def setcenter (self, position): Self. _ planesource. setcenter (position [0], position [1], position [2]) def getcenter (Self): return self. _ planesource. getcenter () # @ brief sets the new method vector def setnormal (self, normal) of the plane: Self. _ planesource. setnormal (normal [0], normal [1], normal [2]) # @ brief move the distance def push (self, distance) along the normal vector direction of the plane ): self. _ planesource. push (distance) def getnormal (Self): return self. _ planesource. getnormal () # @ brief override the base class method # See actorfactory. _ makeactors def _ makeactors (Self): Self. _ updatedata () polydatamapper = vtkpolydatamapper () polydatamapper. setinputconnection (self. _ planesource. getoutputport () actor = self. _ newactor () actor. setmapper (polydatamapper) actor. getproperty (). setcolor (1, 0.1, 0.5) del polydatamapper return [Actor]
Running effect: