FreeMat
vtkSphereWidget

Section: Visualization Toolkit Widget Classes

Usage

This 3D widget defines a sphere that can be interactively placed in a scene.

To use this object, just invoke SetInteractor() with the argument of the method a vtkRenderWindowInteractor. You may also wish to invoke "PlaceWidget()" to initially position the widget. The interactor will act normally until the "i" key (for "interactor") is pressed, at which point the vtkSphereWidget will appear. (See superclass documentation for information about changing this behavior.) Events that occur outside of the widget (i.e., no part of the widget is picked) are propagated to any other registered obsevers (such as the interaction style). Turn off the widget by pressing the "i" key again (or invoke the Off() method).

The vtkSphereWidget has several methods that can be used in conjunction with other VTK objects. The Set/GetThetaResolution() and Set/GetPhiResolution() methods control the number of subdivisions of the sphere in the theta and phi directions; the GetPolyData() method can be used to get the polygonal representation and can be used for things like seeding streamlines. The GetSphere() method returns a sphere implicit function that can be used for cutting and clipping. Typical usage of the widget is to make use of the StartInteractionEvent, InteractionEvent, and EndInteractionEvent events. The InteractionEvent is called on mouse motion; the other two events are called on button down and button up (any mouse button).

Some additional features of this class include the ability to control the properties of the widget. You can set the properties of the selected and unselected representations of the sphere.

To create an instance of class vtkSphereWidget, simply invoke its constructor as follows

  obj = vtkSphereWidget

Methods

The class vtkSphereWidget has several methods that can be used. They are listed below. Note that the documentation is translated automatically from the VTK sources, and may not be completely intelligible. When in doubt, consult the VTK website. In the methods listed below, obj is an instance of the vtkSphereWidget class.

  • string = obj.GetClassName ()
  • int = obj.IsA (string name)
  • vtkSphereWidget = obj.NewInstance ()
  • vtkSphereWidget = obj.SafeDownCast (vtkObject o)
  • obj.SetEnabled (int ) - Methods that satisfy the superclass' API.
  • obj.PlaceWidget (double bounds[6]) - Methods that satisfy the superclass' API.
  • obj.PlaceWidget () - Methods that satisfy the superclass' API.
  • obj.PlaceWidget (double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) - Set the representation of the sphere. Different representations are useful depending on the application. The default is VTK_SPHERE_WIREFRAME.
  • obj.SetRepresentation (int ) - Set the representation of the sphere. Different representations are useful depending on the application. The default is VTK_SPHERE_WIREFRAME.
  • int = obj.GetRepresentationMinValue () - Set the representation of the sphere. Different representations are useful depending on the application. The default is VTK_SPHERE_WIREFRAME.
  • int = obj.GetRepresentationMaxValue () - Set the representation of the sphere. Different representations are useful depending on the application. The default is VTK_SPHERE_WIREFRAME.
  • int = obj.GetRepresentation () - Set the representation of the sphere. Different representations are useful depending on the application. The default is VTK_SPHERE_WIREFRAME.
  • obj.SetRepresentationToOff () - Set the representation of the sphere. Different representations are useful depending on the application. The default is VTK_SPHERE_WIREFRAME.
  • obj.SetRepresentationToWireframe () - Set the representation of the sphere. Different representations are useful depending on the application. The default is VTK_SPHERE_WIREFRAME.
  • obj.SetRepresentationToSurface () - Set/Get the resolution of the sphere in the Theta direction. The default is 16.
  • obj.SetThetaResolution (int r) - Set/Get the resolution of the sphere in the Theta direction. The default is 16.
  • int = obj.GetThetaResolution () - Set/Get the resolution of the sphere in the Phi direction. The default is 8.
  • obj.SetPhiResolution (int r) - Set/Get the resolution of the sphere in the Phi direction. The default is 8.
  • int = obj.GetPhiResolution () - Set/Get the radius of sphere. Default is .5.
  • obj.SetRadius (double r) - Set/Get the radius of sphere. Default is .5.
  • double = obj.GetRadius () - Set/Get the center of the sphere.
  • obj.SetCenter (double x, double y, double z) - Set/Get the center of the sphere.
  • obj.SetCenter (double x[3]) - Set/Get the center of the sphere.
  • double = obj.GetCenter () - Set/Get the center of the sphere.
  • obj.GetCenter (double xyz[3]) - Enable translation and scaling of the widget. By default, the widget can be translated and rotated.
  • obj.SetTranslation (int ) - Enable translation and scaling of the widget. By default, the widget can be translated and rotated.
  • int = obj.GetTranslation () - Enable translation and scaling of the widget. By default, the widget can be translated and rotated.
  • obj.TranslationOn () - Enable translation and scaling of the widget. By default, the widget can be translated and rotated.
  • obj.TranslationOff () - Enable translation and scaling of the widget. By default, the widget can be translated and rotated.
  • obj.SetScale (int ) - Enable translation and scaling of the widget. By default, the widget can be translated and rotated.
  • int = obj.GetScale () - Enable translation and scaling of the widget. By default, the widget can be translated and rotated.
  • obj.ScaleOn () - Enable translation and scaling of the widget. By default, the widget can be translated and rotated.
  • obj.ScaleOff () - Enable translation and scaling of the widget. By default, the widget can be translated and rotated.
  • obj.SetHandleVisibility (int ) - The handle sits on the surface of the sphere and may be moved around the surface by picking (left mouse) and then moving. The position of the handle can be retrieved, this is useful for positioning cameras and lights. By default, the handle is turned off.
  • int = obj.GetHandleVisibility () - The handle sits on the surface of the sphere and may be moved around the surface by picking (left mouse) and then moving. The position of the handle can be retrieved, this is useful for positioning cameras and lights. By default, the handle is turned off.
  • obj.HandleVisibilityOn () - The handle sits on the surface of the sphere and may be moved around the surface by picking (left mouse) and then moving. The position of the handle can be retrieved, this is useful for positioning cameras and lights. By default, the handle is turned off.
  • obj.HandleVisibilityOff () - The handle sits on the surface of the sphere and may be moved around the surface by picking (left mouse) and then moving. The position of the handle can be retrieved, this is useful for positioning cameras and lights. By default, the handle is turned off.
  • obj.SetHandleDirection (double , double , double ) - Set/Get the direction vector of the handle relative to the center of the sphere. The direction of the handle is from the sphere center to the handle position.
  • obj.SetHandleDirection (double a[3]) - Set/Get the direction vector of the handle relative to the center of the sphere. The direction of the handle is from the sphere center to the handle position.
  • double = obj. GetHandleDirection () - Set/Get the direction vector of the handle relative to the center of the sphere. The direction of the handle is from the sphere center to the handle position.
  • double = obj. GetHandlePosition () - Get the position of the handle.
  • obj.GetPolyData (vtkPolyData pd) - Grab the polydata (including points) that defines the sphere. The polydata consists of n+1 points, where n is the resolution of the sphere. These point values are guaranteed to be up-to-date when either the InteractionEvent or EndInteraction events are invoked. The user provides the vtkPolyData and the points and polysphere are added to it.
  • obj.GetSphere (vtkSphere sphere) - Get the spherical implicit function defined by this widget. Note that vtkSphere is a subclass of vtkImplicitFunction, meaning that it can be used by a variety of filters to perform clipping, cutting, and selection of data.
  • vtkProperty = obj.GetSphereProperty () - Get the sphere properties. The properties of the sphere when selected and unselected can be manipulated.
  • vtkProperty = obj.GetSelectedSphereProperty () - Get the sphere properties. The properties of the sphere when selected and unselected can be manipulated.
  • vtkProperty = obj.GetHandleProperty () - Get the handle properties (the little ball on the sphere is the handle). The properties of the handle when selected and unselected can be manipulated.
  • vtkProperty = obj.GetSelectedHandleProperty () - Get the handle properties (the little ball on the sphere is the handle). The properties of the handle when selected and unselected can be manipulated.