FreeMat: vtkPlaneWidget

FreeMat

- Main Page
- Related Pages

vtkPlaneWidget

Section: Visualization Toolkit Widget Classes

# Usage

This 3D widget defines a finite (bounded) plane that can be interactively placed in a scene. The plane has four handles (at its corner vertices), a normal vector, and the plane itself. The handles are used to resize the plane; the normal vector to rotate it, and the plane can be picked and translated. Selecting the plane while pressing CTRL makes it spin around the normal. A nice feature of the object is that the vtkPlaneWidget, like any 3D widget, will work with the current interactor style. That is, if vtkPlaneWidget does not handle an event, then all other registered observers (including the interactor style) have an opportunity to process the event. Otherwise, the vtkPlaneWidget will terminate the processing of the event that it handles.

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. If the "i" key (for "interactor") is pressed, the vtkPlaneWidget will appear. (See superclass documentation for information about changing this behavior.) By grabbing the one of the four handles (use the left mouse button), the plane can be resized. By grabbing the plane itself, the entire plane can be arbitrarily translated. Pressing CTRL while grabbing the plane will spin the plane around the normal. If you select the normal vector, the plane can be arbitrarily rotated. Selecting any part of the widget with the middle mouse button enables translation of the plane along its normal. (Once selected using middle mouse, moving the mouse in the direction of the normal translates the plane in the direction of the normal; moving in the direction opposite the normal translates the plane in the direction opposite the normal.) Scaling (about the center of the plane) is achieved by using the right mouse button. By moving the mouse "up" the render window the plane will be made bigger; by moving "down" the render window the widget will be made smaller. 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 vtkPlaneWidget has several methods that can be used in conjunction with other VTK objects. The Set/GetResolution() methods control the number of subdivisions of the plane; the GetPolyData() method can be used to get the polygonal representation and can be used for things like seeding stream lines. GetPlane() can be used to update a vtkPlane implicit function. 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 (either left or right 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 plane. For example, you can set the property for the handles and plane. In addition there are methods to constrain the plane so that it is perpendicular to the x-y-z axes.

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

      obj = vtkPlaneWidget

# Methods

The class vtkPlaneWidget 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 vtkPlaneWidget class.

- `string = obj.GetClassName ()`
- `int = obj.IsA (string name)`
- `vtkPlaneWidget = obj.NewInstance ()`
- `vtkPlaneWidget = 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/Get the resolution (number of subdivisions) of the plane.
- `obj.SetResolution (int r)` - Set/Get the resolution (number of subdivisions) of the plane.
- `int = obj.GetResolution ()` - Set/Get the resolution (number of subdivisions) of the plane.
- `obj.SetOrigin (double x, double y, double z)` - Set/Get the origin of the plane.
- `obj.SetOrigin (double x[3])` - Set/Get the origin of the plane.
- `double = obj.GetOrigin ()` - Set/Get the origin of the plane.
- `obj.GetOrigin (double xyz[3])` - Set/Get the origin of the plane.
- `obj.SetPoint1 (double x, double y, double z)` - Set/Get the position of the point defining the first axis of the plane.
- `obj.SetPoint1 (double x[3])` - Set/Get the position of the point defining the first axis of the plane.
- `double = obj.GetPoint1 ()` - Set/Get the position of the point defining the first axis of the plane.
- `obj.GetPoint1 (double xyz[3])` - Set/Get the position of the point defining the first axis of the plane.
- `obj.SetPoint2 (double x, double y, double z)` - Set/Get the position of the point defining the second axis of the plane.
- `obj.SetPoint2 (double x[3])` - Set/Get the position of the point defining the second axis of the plane.
- `double = obj.GetPoint2 ()` - Set/Get the position of the point defining the second axis of the plane.
- `obj.GetPoint2 (double xyz[3])` - Set/Get the position of the point defining the second axis of the plane.
- `obj.SetCenter (double x, double y, double z)` - Get the center of the plane.
- `obj.SetCenter (double x[3])` - Get the center of the plane.
- `double = obj.GetCenter ()` - Get the center of the plane.
- `obj.GetCenter (double xyz[3])` - Get the center of the plane.
- `obj.SetNormal (double x, double y, double z)` - Get the normal to the plane.
- `obj.SetNormal (double x[3])` - Get the normal to the plane.
- `double = obj.GetNormal ()` - Get the normal to the plane.
- `obj.GetNormal (double xyz[3])` - Get the normal to the plane.
- `obj.SetRepresentation (int )` - Control how the plane appears when GetPolyData() is invoked. If the mode is "outline", then just the outline of the plane is shown. If the mode is "wireframe" then the plane is drawn with the outline plus the interior mesh (corresponding to the resolution specified). If the mode is "surface" then the plane is drawn as a surface.
- `int = obj.GetRepresentationMinValue ()` - Control how the plane appears when GetPolyData() is invoked. If the mode is "outline", then just the outline of the plane is shown. If the mode is "wireframe" then the plane is drawn with the outline plus the interior mesh (corresponding to the resolution specified). If the mode is "surface" then the plane is drawn as a surface.
- `int = obj.GetRepresentationMaxValue ()` - Control how the plane appears when GetPolyData() is invoked. If the mode is "outline", then just the outline of the plane is shown. If the mode is "wireframe" then the plane is drawn with the outline plus the interior mesh (corresponding to the resolution specified). If the mode is "surface" then the plane is drawn as a surface.
- `int = obj.GetRepresentation ()` - Control how the plane appears when GetPolyData() is invoked. If the mode is "outline", then just the outline of the plane is shown. If the mode is "wireframe" then the plane is drawn with the outline plus the interior mesh (corresponding to the resolution specified). If the mode is "surface" then the plane is drawn as a surface.
- `obj.SetRepresentationToOff ()` - Control how the plane appears when GetPolyData() is invoked. If the mode is "outline", then just the outline of the plane is shown. If the mode is "wireframe" then the plane is drawn with the outline plus the interior mesh (corresponding to the resolution specified). If the mode is "surface" then the plane is drawn as a surface.
- `obj.SetRepresentationToOutline ()` - Control how the plane appears when GetPolyData() is invoked. If the mode is "outline", then just the outline of the plane is shown. If the mode is "wireframe" then the plane is drawn with the outline plus the interior mesh (corresponding to the resolution specified). If the mode is "surface" then the plane is drawn as a surface.
- `obj.SetRepresentationToWireframe ()` - Control how the plane appears when GetPolyData() is invoked. If the mode is "outline", then just the outline of the plane is shown. If the mode is "wireframe" then the plane is drawn with the outline plus the interior mesh (corresponding to the resolution specified). If the mode is "surface" then the plane is drawn as a surface.
- `obj.SetRepresentationToSurface ()` - Force the plane widget to be aligned with one of the x-y-z axes. Remember that when the state changes, a ModifiedEvent is invoked. This can be used to snap the plane to the axes if it is orginally not aligned.
- `obj.SetNormalToXAxis (int )` - Force the plane widget to be aligned with one of the x-y-z axes. Remember that when the state changes, a ModifiedEvent is invoked. This can be used to snap the plane to the axes if it is orginally not aligned.
- `int = obj.GetNormalToXAxis ()` - Force the plane widget to be aligned with one of the x-y-z axes. Remember that when the state changes, a ModifiedEvent is invoked. This can be used to snap the plane to the axes if it is orginally not aligned.
- `obj.NormalToXAxisOn ()` - Force the plane widget to be aligned with one of the x-y-z axes. Remember that when the state changes, a ModifiedEvent is invoked. This can be used to snap the plane to the axes if it is orginally not aligned.
- `obj.NormalToXAxisOff ()` - Force the plane widget to be aligned with one of the x-y-z axes. Remember that when the state changes, a ModifiedEvent is invoked. This can be used to snap the plane to the axes if it is orginally not aligned.
- `obj.SetNormalToYAxis (int )` - Force the plane widget to be aligned with one of the x-y-z axes. Remember that when the state changes, a ModifiedEvent is invoked. This can be used to snap the plane to the axes if it is orginally not aligned.
- `int = obj.GetNormalToYAxis ()` - Force the plane widget to be aligned with one of the x-y-z axes. Remember that when the state changes, a ModifiedEvent is invoked. This can be used to snap the plane to the axes if it is orginally not aligned.
- `obj.NormalToYAxisOn ()` - Force the plane widget to be aligned with one of the x-y-z axes. Remember that when the state changes, a ModifiedEvent is invoked. This can be used to snap the plane to the axes if it is orginally not aligned.
- `obj.NormalToYAxisOff ()` - Force the plane widget to be aligned with one of the x-y-z axes. Remember that when the state changes, a ModifiedEvent is invoked. This can be used to snap the plane to the axes if it is orginally not aligned.
- `obj.SetNormalToZAxis (int )` - Force the plane widget to be aligned with one of the x-y-z axes. Remember that when the state changes, a ModifiedEvent is invoked. This can be used to snap the plane to the axes if it is orginally not aligned.
- `int = obj.GetNormalToZAxis ()` - Force the plane widget to be aligned with one of the x-y-z axes. Remember that when the state changes, a ModifiedEvent is invoked. This can be used to snap the plane to the axes if it is orginally not aligned.
- `obj.NormalToZAxisOn ()` - Force the plane widget to be aligned with one of the x-y-z axes. Remember that when the state changes, a ModifiedEvent is invoked. This can be used to snap the plane to the axes if it is orginally not aligned.
- `obj.NormalToZAxisOff ()` - Force the plane widget to be aligned with one of the x-y-z axes. Remember that when the state changes, a ModifiedEvent is invoked. This can be used to snap the plane to the axes if it is orginally not aligned.
- `obj.GetPolyData (vtkPolyData pd)` - Grab the polydata (including points) that defines the plane. The polydata consists of (res+1)*(res+1) points, and res*res quadrilateral polygons, where res is the resolution of the plane. 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 polyplane are added to it.
- `obj.GetPlane (vtkPlane plane)` - Get the planes describing the implicit function defined by the plane widget. The user must provide the instance of the class vtkPlane. Note that vtkPlane is a subclass of vtkImplicitFunction, meaning that it can be used by a variety of filters to perform clipping, cutting, and selection of data.
- `vtkPolyDataAlgorithm = obj.GetPolyDataAlgorithm ()` - Satisfies superclass API. This returns a pointer to the underlying PolyData. Make changes to this before calling the initial PlaceWidget() to have the initial placement follow suit. Or, make changes after the widget has been initialised and call UpdatePlacement() to realise.
- `obj.UpdatePlacement (void )` - Satisfies superclass API. This will change the state of the widget to match changes that have been made to the underlying PolyDataSource
- `vtkProperty = obj.GetHandleProperty ()` - Get the handle properties (the little balls are the handles). The properties of the handles when selected and normal can be manipulated.
- `vtkProperty = obj.GetSelectedHandleProperty ()` - Get the handle properties (the little balls are the handles). The properties of the handles when selected and normal can be manipulated.
- `obj.SetPlaneProperty (vtkProperty )` - Get the plane properties. The properties of the plane when selected and unselected can be manipulated.
- `vtkProperty = obj.GetPlaneProperty ()` - Get the plane properties. The properties of the plane when selected and unselected can be manipulated.
- `vtkProperty = obj.GetSelectedPlaneProperty ()` - Get the plane properties. The properties of the plane when selected and unselected can be manipulated.