<div>Hi Sajendra,</div>
<div> </div>
<div>Thanks for replying. Below is a simple C++ program that demonstrates the vtkCutter problem I've encountered (looking forward to your feedback) :</div>
<div> </div>
<div>
<p>#include "vtkPolyDataMapper.h"<br>#include "vtkRenderWindow.h"<br>#include "vtkActor.h"<br>#include "vtkRenderer.h"<br>#include "vtkRenderWindowInteractor.h"<br>#include "
vtkInteractorStyleTrackballCamera.h"<br>#include "vtkProperty.h"<br>#include "vtkPolyData.h"<br>#include "vtkPoints.h"<br>#include "vtkCellArray.h"<br>#include "vtkPlane.h
"<br>#include "vtkCutter.h"</p>
<p>vtkPolyData *makeTestMesh()<br>{<br> vtkPolyData *pd = vtkPolyData::New();<br> vtkPoints *pnts = vtkPoints::New();<br> vtkCellArray *polys = vtkCellArray::New();</p>
<p> pnts->InsertNextPoint(0,0,0);<br> pnts->InsertNextPoint(10,0,0);<br> pnts->InsertNextPoint(10,10,0);<br> pnts->InsertNextPoint(0,10,0);</p>
<p> int tri1[] = { 0, 1, 2 };<br> int tri2[] = { 0, 2, 3 };<br> polys->InsertNextCell(3, tri1);<br> polys->InsertNextCell(3, tri2);</p>
<p> pd->SetPoints(pnts);<br> pd->SetPolys(polys);<br> return pd;<br>}</p>
<p>int main( int argc, char *argv[] )<br>{<br> vtkRenderer *ren1 = vtkRenderer::New();<br> ren1->SetViewport(0.0, 0.0, 0.5, 1.0);<br> ren1->SetBackground(0.1,0.2,0.4);</p>
<p> vtkRenderer *ren2 = vtkRenderer::New();<br> ren2->SetViewport(0.5, 0.0, 1.0, 1.0);<br> ren2->SetBackground(0.1,0.2,0.4);</p>
<p> vtkRenderWindow *renWin = vtkRenderWindow::New();<br> renWin->SetSize(800,400);<br> renWin->AddRenderer(ren1);<br> renWin->AddRenderer(ren2);</p>
<p> vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<br> iren->SetInteractorStyle( vtkInteractorStyleTrackballCamera::New() );<br> iren->SetRenderWindow(renWin);</p>
<p> vtkPolyData *pd1 = makeTestMesh();<br> vtkPolyDataMapper *mapper1 = vtkPolyDataMapper::New();<br> mapper1->SetInput( pd1 );<br> vtkActor *actor1 = vtkActor::New();<br> actor1->SetMapper( mapper1 );
<br> actor1->GetProperty()->SetColor(1,0,0);<br> actor1->GetProperty()->SetRepresentationToWireframe();<br> ren1->AddActor(actor1);</p>
<p> vtkPlane *cutPlane = vtkPlane::New();<br> cutPlane->SetOrigin(0,0,0);<br> cutPlane->SetNormal(0,0,1);</p>
<p> vtkCutter *cutter = vtkCutter::New();<br> cutter->SetCutFunction(cutPlane);<br> cutter->SetInput(pd1);</p>
<p> vtkPolyDataMapper *mapper2 = vtkPolyDataMapper::New();<br> mapper2->SetInput( cutter->GetOutput() );<br> vtkActor *actor2 = vtkActor::New();<br> actor2->SetMapper( mapper2 );<br> actor2->GetProperty()->SetColor(0,0,1);
<br> ren2->AddActor(actor2);</p>
<p> iren->Initialize();<br> iren->Start();<br> return 0;<br>}</p><br><br> </div>
<div><span class="gmail_quote">On 7/4/07, <b class="gmail_sendername">Nithiananthan, Sajendra</b> <<a href="mailto:Sajendra.Nithiananthan@rmp.uhn.on.ca">Sajendra.Nithiananthan@rmp.uhn.on.ca</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Meisam,<br><br>From your description its not quite clear what is happening.<br>Could you perhaps provide a small example that reproduces your problem?
<br><br>-Sajendra N.<br><br>-----Original Message-----<br>From: vtkusers-bounces+sajendra.nithiananthan=<a href="mailto:rmp.uhn.on.ca@vtk.org">rmp.uhn.on.ca@vtk.org</a><br>[mailto:<a href="mailto:vtkusers-bounces+sajendra.nithiananthan=rmp.uhn.on.ca@vtk.org">
vtkusers-bounces+sajendra.nithiananthan=rmp.uhn.on.ca@vtk.org</a>]On<br>Behalf Of Meisam Aliroteh<br>Sent: Friday, June 29, 2007 10:23 PM<br>To: <a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a><br>Subject: [vtkusers] vtkCutter not working properly
<br><br><br>Hi,<br><br>I've tried vtkCutter to get the contour of a polydata and I am getting weird<br>results.<br><br>In first case I cut a sphere with and the cutter does generate a circular<br>contour. In the second case I try to cut through a bunch of triangles and
<br>are all coplanar and I try to cut them to get their contour but I get an<br>empty polydata back from the cutter.<br><br>Basically, I need to get the contour of a flat shape ( the shape is made of<br>of triangles and all triangles are coplanar and I only need the outer lines
<br>which form the parameter of the shape, not any of the interior/shared<br>triangle edges ). I though I could use vtkCutter since it is simple to use<br>and is fast but it doesn't return anything !!! It just return a polydata
<br>which no cells, or polys, or lines etc.<br><br>Can anyone tell me how to fix this, or is there a better way of doing this ?<br><br>thanks<br><br>This e-mail may contain confidential and/or privileged information for the sole use of the intended recipient. Any review or distribution by anyone other than the person for whom it was originally intended is strictly prohibited. If you have received this e-mail in error, please contact the sender and delete all copies. Opinions, conclusions or other information contained in this e-mail may not be that of the organization.
<br></blockquote></div><br>