Vtkpointsource is used to create a sphere composed of a specific center point, a specific diameter, and a specific number of points. The default point is randomly distributed in the sphere. The points that can be produced are only distributed on the sphere.
Basic usage:
Setradius (): Set the sphere radius
Setcenter () sets the sphere center point
Setnumberofpoints (): set the number of vertices in the ball.
Setdistributiontouniform () sets the distribution of points in the Sphere
Setdistributiontoshell () sets the Point Distribution on the sphere.
Example:
#-*-Coding: UTF-8-*-# features # Name: module 2 # purpose: # Author: ankier # created: 12-12-2012 # copyright: (c) ankier 2012 # licence: <your licence> # events from actorfactory import actorfactoryfrom VTK import * ##@ detal: Class pointactorfactory (actorfactory ): def _ init _ (Self): actorfactory. _ init _ (Self) self. _ pointsource = vtkpointsource () def _ makeactors (Self): Self. _ pointsource. setradius (20) self. _ pointsource. setcenter (0, 0, 0) self. _ pointsource. setnumberofpoints (10000) self. _ pointsource. setdistributiontouniform () # self. _ pointsource. setdistributiontoshell () polydatamapper = vtkpolydatamapper () polydatamapper. setinput (self. _ pointsource. getoutput () actor = self. _ newactor () actor. setmapper (polydatamapper) actor. getproperty (). setcolor (1.0, 0.7, 0.2) return [Actor] def _ del _ (Self): del self. _ pointsource
Running result: