<html><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:10pt"><div><div><font size="2">Thank you,</font></div><div><font size="2"><br></font></div><div><font size="2">I'm gonna try this solution.</font></div><div><font size="2"><br></font></div><div><font size="2">Is this problem due to the implementation of the algorithm to compute the boolean operation ?</font></div><div><font size="2"><br></font></div><div><font size="2">I'm a bit confused, because the holes doesn't appear in a place where there are intersections or unions.</font></div><div><font size="2"><br></font></div><div><font size="2">I have been trying to use this website : http://evanw.github.com/csg.js/ to test another implentation of the CSG and it works even with parallel surfaces.</font></div><div><font size="2">You can try the following in the text box at the end of the page (note that the page requires WebGL)
 :</font></div><div><font size="2"><br></font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>var a = CSG.cylinder({radius:0.2, center:[0, 0, 0]});</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>var b = CSG.cube({radius:[1, 0.5, 0.2], center:[0, 0, 0]});</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>var c = CSG.cylinder({radius:0.2, start: [-1, -1, 0], end: [-1, 1, 0]});</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>return a.union(b).union(c);</font></div><div><font size="2"><br></font></div><div><font size="2">Best.</font></div></div><div style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 10pt; "><br></div>  <div style="font-size: 10pt; font-family: 'Courier New', courier, monaco, monospace, sans-serif; "> <div style="font-size: 12pt;
 font-family: 'times new roman', 'new york', times, serif; "> <div dir="ltr"> <font size="2" face="Arial"> <hr size="1">  <b><span style="font-weight:bold;">De&nbsp;:</span></b> Bryn Lloyd &lt;lloyd@itis.ethz.ch&gt;<br> <b><span style="font-weight: bold;">À&nbsp;:</span></b> vtkusers@vtk.org <br> <b><span style="font-weight: bold;">Envoyé le :</span></b> Mardi 22 mai 2012 14h05<br> <b><span style="font-weight: bold;">Objet&nbsp;:</span></b> Re: [vtkusers] Holes in mesh after vtkBooleanOperationPolyDataFilter<br> </font> </div> <br><div id="yiv1009696328">
  

    
  
  <div>
    The boolean operations are not robust for parallel surfaces.<br>
    <br>
    One way to try to resolve the problem is to move the objects by some
    small delta before applying the boolean operation.<br>
    <br>
    <br>
    On 5/22/2012 11:15 AM, Malsoaz James wrote:
    <blockquote type="cite">
      <div style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 10pt; font-family: 'Courier New', courier, monaco, monospace, sans-serif; ">
        <div style="font-size: 10pt; font-family: courier, monaco, monospace, sans-serif; ">Hi VTK users,</div>
        <div style="font-size: 10pt; font-family: courier, monaco, monospace, sans-serif; "><br>
        </div>
        <div style="font-size: 10pt; font-family: courier, monaco, monospace, sans-serif; ">I'm using the
          vtkBooleanOperationPolyDataFilter to apply boolean operations
          to polydata. Unfortunately, I got unexpected results (holes in
          the mesh).</div>
        <div style="font-size: 10pt; font-family: courier, monaco, monospace, sans-serif; "><br>
        </div>
        <div style="font-size: 10pt; font-family: courier, monaco, monospace, sans-serif; ">You can see here&nbsp;<a rel="nofollow" target="_blank" href="http://www.hostingpics.net/viewer.php?id=210273error.png" style="font-size:10pt;">http://www.hostingpics.net/viewer.php?id=210273error.png</a>&nbsp;an
          example.</div>
        <div style="font-size: 10pt; font-family: courier, monaco, monospace, sans-serif; ">I'm creating a
          cylinder, then I'm adding a cube and finally I'm adding
          another cylinder. The holes appear with the last operation.</div>
        <div style="font-size: 10pt; font-family: courier, monaco, monospace, sans-serif; "><br>
        </div>
        <div style="font-size: 10pt; font-family: courier, monaco, monospace, sans-serif; "><br>
        </div>
        <div style="font-size: 10pt; font-family: courier, monaco, monospace, sans-serif; ">Can someone explain
          me the reason(s) of these results ?</div>
        <div style="font-size: 10pt; font-family: courier, monaco, monospace, sans-serif; "><br>
        </div>
        <div style="font-size: 10pt; font-family: courier, monaco, monospace, sans-serif; ">Here are my source
          code :</div>
        <div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>vtkCylinderSource *
              cylinder1 = vtkCylinderSource::New();</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>cylinder1-&gt;SetCenter(0,
              10, 0);</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>cylinder1-&gt;SetHeight(50);</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>cylinder1-&gt;SetRadius(5);</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>cylinder1-&gt;SetResolution(100);</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>cylinder1-&gt;Update();</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><br>
            </font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>vtkTriangleFilter *
              cylinder1Triangle = vtkTriangleFilter::New();</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>cylinder1Triangle-&gt;SetInput(cylinder1-&gt;GetOutput());</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>cylinder1Triangle-&gt;Update();</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><br>
            </font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>cylinder1-&gt;Delete();</font></div>
          <div><span style="font-size: 13px; font-family: courier, monaco, monospace, sans-serif; "><br>
            </span></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>vtkCubeSource * cube =
              vtkCubeSource::New();</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>cube-&gt;SetCenter(0,
              10, 0);</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>cube-&gt;SetXLength(50);</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>cube-&gt;SetYLength(20);</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>cube-&gt;SetZLength(10);</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>cube-&gt;Update();</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><br>
            </font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>vtkTriangleFilter
              *cubeTriangle = vtkTriangleFilter::New();</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>cubeTriangle-&gt;SetInput(cube-&gt;GetOutput());</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>cubeTriangle-&gt;Update();</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><br>
            </font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>cube-&gt;Delete();</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><br>
            </font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>vtkCylinderSource *
              cylinder2 = vtkCylinderSource::New();</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>cylinder2-&gt;SetCenter(-25,
              15, 0);</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>cylinder2-&gt;SetHeight(30);</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>cylinder2-&gt;SetRadius(3);</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>cylinder2-&gt;SetResolution(100);</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>cylinder2-&gt;Update();</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><br>
            </font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>vtkTriangleFilter *
              cylinder2Triangle = vtkTriangleFilter::New();</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>cylinder2Triangle-&gt;SetInput(cylinder2-&gt;GetOutput());</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>cylinder2Triangle-&gt;Update();</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><br>
            </font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>cylinder2-&gt;Delete();</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><br>
            </font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>vtkBooleanOperationPolyDataFilter
              * add1 = vtkBooleanOperationPolyDataFilter::New();</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>add1-&gt;SetOperationToUnion();</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>add1-&gt;SetInput(0,
              cylinder1Triangle-&gt;GetOutput());</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>add1-&gt;SetInput(1,
              cubeTriangle-&gt;GetOutput());</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>add1-&gt;Update();</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><br>
            </font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>cubeTriangle-&gt;Delete();</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>cylinder1Triangle-&gt;Delete();</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><br>
            </font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>vtkBooleanOperationPolyDataFilter
              * add = vtkBooleanOperationPolyDataFilter::New();</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>add-&gt;SetOperationToUnion();</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>add-&gt;SetInput(0,
              add1-&gt;GetOutput());</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>add-&gt;SetInput(1,
              cylinder2Triangle-&gt;GetOutput());</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>add-&gt;Update();</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><br>
            </font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>add1-&gt;Delete();</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><span class="yiv1009696328Apple-tab-span" style="white-space:pre;"> </span>cylinder2Triangle-&gt;Delete();</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2"><br>
            </font></div>
          <div><span style="font-size: 13px; font-family: courier, monaco, monospace, sans-serif; ">Am I doing
              something wrong in the use of
              vtkBooleanOperationPolyDataFilter ?</span></div>
          <div><span style="font-size: 13px; font-family: courier, monaco, monospace, sans-serif; "><br>
            </span></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2">Thank you.</font></div>
          <div><font face="Courier New, courier, monaco, monospace,
              sans-serif" size="2">Best</font></div>
        </div>
      </div>
      <br>
      <fieldset class="yiv1009696328mimeAttachmentHeader"></fieldset>
      <br>
      <pre>_______________________________________________
Powered by <a rel="nofollow" class="yiv1009696328moz-txt-link-abbreviated" target="_blank" href="http://www.kitware.com">www.kitware.com</a>

Visit other Kitware open-source projects at <a rel="nofollow" class="yiv1009696328moz-txt-link-freetext" target="_blank" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>

Please keep messages on-topic and check the VTK FAQ at: <a rel="nofollow" class="yiv1009696328moz-txt-link-freetext" target="_blank" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a>

Follow this link to subscribe/unsubscribe:
<a rel="nofollow" class="yiv1009696328moz-txt-link-freetext" target="_blank" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a>
</pre>
    </blockquote>
  </div>

</div><br>_______________________________________________<br>Powered by www.kitware.com<br><br>Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/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" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br><br><br> </div> </div>  </div></body></html>