<html><div style='background-color:'><P><FONT face="Times New Roman, Times, Serif" size=2>Sebastien,</FONT></P>
<P><FONT face="Times New Roman, Times, Serif" size=2>&nbsp;&nbsp; This might be a result of the way implicit functions are evaluated. If there is a polygon defined by four points and your implicit loop outlines a circle as below</FONT></P>
<P><FONT face="Courier New, Courier, Monospace">+--+<BR>| O|<BR>+--+</FONT></P>
<P><FONT face="Geneva, Arial, Sans-serif"><FONT face="Times New Roman, Times, Serif" size=2>the implicit function is evaluated only at the four points, which will all be "out" so the cell will not be clipped. If we move the implicit circle<BR></FONT></P>
<P><FONT face="Courier New, Courier, Monospace">+--O&nbsp;&nbsp;&nbsp;&nbsp; +-. <BR>|&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp; \<BR>+--+&nbsp;&nbsp;&nbsp;&nbsp; +--+</FONT></P>
<P><FONT face="Times New Roman, Times, Serif" size=2>the top right point is "in" and the linear interpolation used in clipping will give a result something like shown. The nett effect is a mixture of polygons where you expected none, and holes where you expected polygons. Your polygons probably are being clipped, just not the way you would expect.</FONT></P>
<P><FONT face="Times New Roman, Times, Serif" size=2>A solution I have used is to pass the polydata to be clipped (your DEM) through vtkLinearSubdivisionFilter with 2 or 3 iterations (be careful, the execution time increases rapidly...). This subdivides polygons (recursively) and produces smaller polygons which thus sample the implicit function more accurately. The problem is that a lot of polygons are produced unecessarily beyond the region you are clipping. I suppose you could decimate afterwards, if your DEM does not consume all your memory first!</FONT></P>
<P><FONT face="Times New Roman" size=2>I have been thinking about a&nbsp;smarter solution: make a clipper which does adaptive refinement of the clip boundary, ie on cells which are to be clipped, keep subdividing until the implicit value reaches a given threshold. This would give&nbsp;more like the 'expected' behaviour, and do so quite efficiently.... but I have no time...</FONT></P>
<P><FONT face="Times New Roman, Times, Serif" size=2>&nbsp; hope this helps,</FONT></FONT><FONT face="Times New Roman, Times, Serif" size=2>&nbsp;&nbsp;&nbsp; Dave Pont</FONT></P>
<DIV></DIV>
<DIV></DIV>&gt;From: "Sebastien_MARAUX" <MARAUX@ONDIM.FR>
<DIV></DIV>&gt;To: "vtk mailing list" <VTKUSERS@PUBLIC.KITWARE.COM>
<DIV></DIV>&gt;Subject: [vtkusers] vtkClipPolyData does not clip properly. 
<DIV></DIV>&gt;Date: Wed, 5 Jun 2002 20:37:45 +0200 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;Hello, 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;With selection Loop as an implicit 
<DIV></DIV>&gt;function, vtkClipPolyData does not 
<DIV></DIV>&gt;clip as I think it should : It only 
<DIV></DIV>&gt;keeps faces entirely contained by 
<DIV></DIV>&gt;the clip volume, instead of producing 
<DIV></DIV>&gt;new triangles when faces are partially 
<DIV></DIV>&gt;contained by the clip volume. 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;Usually, vtkClipPolyData is able to produce 
<DIV></DIV>&gt;new triangles to respect clipping Volume, 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;How can I obtain those triangles ? 
<DIV></DIV>&gt;Is there a probleme with InsideOutOn ? 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;here is my code : 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;/*============================================*/ 
<DIV></DIV>&gt; vtkIdList *DEMPoints = vtkIdList::New(); 
<DIV></DIV>&gt; vtkImplicitSelectionLoop *clipLoop = vtkImplicitSelectionLoop::New(); 
<DIV></DIV>&gt; points-&gt;Reset(); 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; // recuperation de la cellule courante 
<DIV></DIV>&gt; dataGISClean-&gt;GetCellPoints(i,DEMPoints); 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; clipLoop-&gt;SetLoop(points); 
<DIV></DIV>&gt; clipLoop-&gt;SetNormal(0.0,1.0,0.0); // my y is height cause of vrml export 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; // ajout du clipping du mnt selon les polygones 
<DIV></DIV>&gt; vtkClipPolyData *clipper3=vtkClipPolyData::New(); 
<DIV></DIV>&gt; clipper3-&gt;SetInput(pdn-&gt;GetOutput()); 
<DIV></DIV>&gt; clipper3-&gt;GenerateClipScalarsOn(); 
<DIV></DIV>&gt; clipper3-&gt;SetClipFunction(clipLoop); 
<DIV></DIV>&gt; clipper3-&gt;GenerateClippedOutputOff(); 
<DIV></DIV>&gt; clipper3-&gt;InsideOutOn(); 
<DIV></DIV>&gt; clipper3-&gt;SetValue(0.5); 
<DIV></DIV>&gt; clipper3-&gt;Update(); 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; cout &lt;<I <<dataGISClean- ? <<?>GetNumberOfPolys() &lt;<ENDL; DIV <>&gt; cout &lt;&lt;"nombre de polygones : " &lt;<CLIPPER3->GetOutput()-&gt;GetNumberOfPolys() &lt;<ENDL; DIV <>&gt; 
<DIV></DIV>&gt; if (dataGISClean-&gt;GetNumberOfCells() &gt; 0){ 
<DIV></DIV>&gt; vtkIdList *listCells = vtkIdList::New(); 
<DIV></DIV>&gt; for (j=0;j<CLIPPER3->GetOutput()-&gt;GetNumberOfCells();j++) 
<DIV></DIV>&gt; { 
<DIV></DIV>&gt; listCells-&gt;InsertNextId(j); 
<DIV></DIV>&gt; } 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; //clipper3-&gt;GetOutput() does not contain a properly clipped DEM 
<DIV></DIV>&gt; dataGIS1-&gt;CopyCells(clipper3-&gt;GetOutput(),listCells); 
<DIV></DIV>&gt; } 
<DIV></DIV>&gt;/*===============================================================*/ 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;Sebastien MARAUX 
<DIV></DIV></I></div><br clear=all><hr>Chat with friends online, try MSN Messenger: <a href='http://g.msn.com/1HM504201/40'>Click Here</a><br></html>