<div dir="ltr"><div>Hi Albert,<br><br></div><div>Sounds like you figured it out. Here is a clarification for future readers:<br></div><div><br>A vtkPlaneSource's output is always a parallelogram (square, rectangles and rhombi are special cases of this). SetOrigin sets one corner of the plane. SetPoint1 and SetPoint2 set the corners adjacent to that one. All of these points are in world coordinates not relative to each other. The fourth corner and the normal are computed based on the offsets to these two points from the origin.<br><br></div><div>Shawn<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 25, 2016 at 9:33 PM, Albert Palomer <span dir="ltr"><<a href="mailto:albert.palo@gmail.com" target="_blank">albert.palo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Ok, I figured it out after going through the <a href="https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0ahUKEwi-88WI9t3OAhVCKx4KHaXuDpYQFggdMAA&url=https%3A%2F%2Fgithub.com%2FKitware%2FVTK%2Fblob%2Fmaster%2FFilters%2FSources%2FvtkPlaneSource.cxx&usg=AFQjCNF_rx55XLQfn1is2BVZGwEbVpstxQ&sig2=B-eed3UB3r37BP6ehFWkiA&bvm=bv.130731782,d.dmo&cad=rja" target="_blank">source code</a>. The SetPoint1 and SetPoint2 set the second point of the vector while the first one is set by SetOrigin (by default origin [-0.5 -0.5 0] ). This leads to the rhomboid because the two vectors of the parametric equation p=p0+v1*t+v2*s are computed as in v1 = point1 - origin and v2 = point2 - origin. So if you chose Point1 to be only in the X direction and point 2 to the Y (which in my mind is what should give a square) gives a rhomboid because the director vectors of the plane are not perpendicular. <div><br></div><div>So, to define the plane I do:</div><div><br></div><div>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">Add</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">plane</span></pre></div><div>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,0,128)">vtkSmartPointer</span><span style="color:rgb(0,0,0)"><</span><span style="color:rgb(128,0,128)">vtkPlaneSource</span><span style="color:rgb(0,0,0)"><wbr>></span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">planeSource</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">vtkSmartPointer</span><span style="color:rgb(0,0,0)"><</span><span style="color:rgb(128,0,128)">vtkPlaneSource</span><span style="color:rgb(0,0,0)"><wbr>>::</span><span style="color:rgb(0,0,0)">New</span><span style="color:rgb(0,0,0)">();</span></pre><pre style="margin-top:0px;margin-bottom:0px"><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><font color="#008000">Set origin for computing the two director vectors</font></pre></pre> <pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">planeSource</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">SetOrigin</span><span style="color:rgb(0,0,0)">(0,0,0</span><span style="color:rgb(0,0,0)">);</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:arial,sans-serif;color:rgb(0,128,0)">//</span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif"><font color="#008000">Set point for first director vector</font></span></pre> <pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">planeSource</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">SetPoint1</span><span style="color:rgb(0,0,0)">(x_size,<wbr>0,0</span><span style="color:rgb(0,0,0)">);</span></pre><span style="white-space:pre-wrap;color:rgb(0,128,0)">//</span><span style="white-space:pre-wrap;color:rgb(192,192,192)"> </span><span style="white-space:pre-wrap"><font color="#008000">Set point for second director vector</font></span><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">planeSource</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">SetPoint2</span><span style="color:rgb(0,0,0)">(0,y_<wbr>size,0)</span><span style="color:rgb(0,0,0)">;</span></pre><span style="white-space:pre-wrap;color:rgb(0,128,0)">//</span><span style="white-space:pre-wrap;color:rgb(192,192,192)"> </span><span style="white-space:pre-wrap"><font color="#008000">Set center</font></span><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">planeSource</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">SetCenter</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,128)">5</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">0.0</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">0.0</span><span style="color:rgb(0,0,0)">);</span></pre><span style="white-space:pre-wrap;color:rgb(0,128,0)">//</span><span style="white-space:pre-wrap;color:rgb(192,192,192)"> </span><span style="white-space:pre-wrap"><font color="#008000">Set normal</font></span><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">planeSource</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">SetNormal</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,128)">0</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(0,0,128)">0</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(0,0,128)">1</span><span style="color:rgb(0,0,0)">);</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)"><br></span></pre>Hope this helps to anybody that might be in the same trouble.</div></div><div class="gmail_extra"><br clear="all"><div><div data-smartmail="gmail_signature"><div><br></div>Albert Palomer Vila<br></div></div>
<br><div class="gmail_quote"><div><div class="h5">2016-08-25 17:47 GMT-07:00 Meehan, Bernard <span dir="ltr"><<a href="mailto:MEEHANBT@nv.doe.gov" target="_blank">MEEHANBT@nv.doe.gov</a>></span>:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
<div style="word-wrap:break-word;font-family:Calibri,sans-serif;font-size:14px;color:rgb(0,0,0)">
<div>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.</div>
<div><br>
</div>
<div>I was going to give you a working example, but ran into something that I didn’t understand.</div>
<div>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?</div>
<div><br>
</div>
<div>import vtk</div>
<div><br>
</div>
<div>plane = vtk.vtkPlaneSource()</div>
<div>plane.SetPoint1(2.0, 0.0, 0.0)</div>
<div>plane.SetPoint2(0.0, 1.0, 0.0)</div>
<div>plane.SetCenter(0.0, 0.0, 0.0)</div>
<div>plane.Update()</div>
<div><br>
</div>
<div>mapper = vtk.vtkPolyDataMapper()</div>
<div>mapper.SetInputData(plane.GetO<wbr>utput())</div>
<div><br>
</div>
<div>actor = vtk.vtkActor()</div>
<div>actor.SetMapper(mapper)</div>
<div><br>
</div>
<div>renderer = vtk.vtkRenderer()</div>
<div>renderer.AddActor(actor)</div>
<div><br>
</div>
<div>render_window = vtk.vtkRenderWindow()</div>
<div>render_window.AddRenderer(rend<wbr>erer)</div>
<div><br>
</div>
<div>render_window_interactor = vtk.vtkRenderWindowInteractor(<wbr>)</div>
<div>render_window_interactor.SetRe<wbr>nderWindow(render_window)</div>
<div><br>
</div>
<div>renderer.SetBackground(0.1, 0.3, 0.9)</div>
<div>render_window_interactor.Start<wbr>()</div>
</div>
<br></div></div>______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensou<wbr>rce/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FA<wbr>Q</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mail<wbr>man/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>
<br>______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_<wbr>FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>