[vtkusers] Help displaying Plane

Meehan, Bernard MEEHANBT at nv.doe.gov
Thu Aug 25 20:47:50 EDT 2016


According to the vtkPlaneSource documentation, you aren’t really supposed to define the plane with the SetNormal function. You are supposed to define it with SetPoint1, SetPoint2 and SetCenter. Another popular way of making the plane you want is to start out with the default plane – which is centered at the origin, perpendicular to the z axis, and has an x-direction measurement of 1, and a y-direction measurement of 1. You then use vtkTransform to make it the shape you want it to be.

I was going to give you a working example, but ran into something that I didn’t understand.
I thought this would make a plane that was 2 units in x, 1 unit in y, and had a center at (1, 0.5) - which seems to be what ParaView does with it … however it seems to come out as a parallelogram?

import vtk

plane = vtk.vtkPlaneSource()
plane.SetPoint1(2.0, 0.0, 0.0)
plane.SetPoint2(0.0, 1.0, 0.0)
plane.SetCenter(0.0, 0.0, 0.0)
plane.Update()

mapper = vtk.vtkPolyDataMapper()
mapper.SetInputData(plane.GetOutput())

actor = vtk.vtkActor()
actor.SetMapper(mapper)

renderer = vtk.vtkRenderer()
renderer.AddActor(actor)

render_window = vtk.vtkRenderWindow()
render_window.AddRenderer(renderer)

render_window_interactor = vtk.vtkRenderWindowInteractor()
render_window_interactor.SetRenderWindow(render_window)

renderer.SetBackground(0.1, 0.3, 0.9)
render_window_interactor.Start()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160826/d8b89f21/attachment.html>


More information about the vtkusers mailing list