<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
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
cite="mid:1337678103.61899.YahooMailNeo@web171101.mail.ukl.yahoo.com"
type="cite">
<div style="color:#000; background-color:#fff; font-family:Courier
New, courier, monaco, monospace, sans-serif;font-size:10pt">
<div style="font-family: 'Courier New', courier, monaco,
monospace, sans-serif; font-size: 10pt; ">Hi VTK users,</div>
<div style="font-family: 'Courier New', courier, monaco,
monospace, sans-serif; font-size: 10pt; "><br>
</div>
<div style="font-family: 'Courier New', courier, monaco,
monospace, sans-serif; font-size: 10pt; ">I'm using the
vtkBooleanOperationPolyDataFilter to apply boolean operations
to polydata. Unfortunately, I got unexpected results (holes in
the mesh).</div>
<div style="font-family: 'Courier New', courier, monaco,
monospace, sans-serif; font-size: 10pt; "><br>
</div>
<div style="font-family: 'Courier New', courier, monaco,
monospace, sans-serif; font-size: 10pt; ">You can see here <a
moz-do-not-send="true"
href="http://www.hostingpics.net/viewer.php?id=210273error.png"
style="font-size: 10pt; ">http://www.hostingpics.net/viewer.php?id=210273error.png</a> an
example.</div>
<div style="font-family: 'Courier New', courier, monaco,
monospace, sans-serif; font-size: 10pt; ">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-family: 'Courier New', courier, monaco,
monospace, sans-serif; font-size: 10pt; "><br>
</div>
<div style="font-family: 'Courier New', courier, monaco,
monospace, sans-serif; font-size: 10pt; "><br>
</div>
<div style="font-family: 'Courier New', courier, monaco,
monospace, sans-serif; font-size: 10pt; ">Can someone explain
me the reason(s) of these results ?</div>
<div style="font-family: 'Courier New', courier, monaco,
monospace, sans-serif; font-size: 10pt; "><br>
</div>
<div style="font-family: 'Courier New', courier, monaco,
monospace, sans-serif; font-size: 10pt; ">Here are my source
code :</div>
<div>
<div><font face="Courier New, courier, monaco, monospace,
sans-serif" size="2"><span class="Apple-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="Apple-tab-span"
style="white-space:pre"> </span>cylinder1->SetCenter(0,
10, 0);</font></div>
<div><font face="Courier New, courier, monaco, monospace,
sans-serif" size="2"><span class="Apple-tab-span"
style="white-space:pre"> </span>cylinder1->SetHeight(50);</font></div>
<div><font face="Courier New, courier, monaco, monospace,
sans-serif" size="2"><span class="Apple-tab-span"
style="white-space:pre"> </span>cylinder1->SetRadius(5);</font></div>
<div><font face="Courier New, courier, monaco, monospace,
sans-serif" size="2"><span class="Apple-tab-span"
style="white-space:pre"> </span>cylinder1->SetResolution(100);</font></div>
<div><font face="Courier New, courier, monaco, monospace,
sans-serif" size="2"><span class="Apple-tab-span"
style="white-space:pre"> </span>cylinder1->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="Apple-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="Apple-tab-span"
style="white-space:pre"> </span>cylinder1Triangle->SetInput(cylinder1->GetOutput());</font></div>
<div><font face="Courier New, courier, monaco, monospace,
sans-serif" size="2"><span class="Apple-tab-span"
style="white-space:pre"> </span>cylinder1Triangle->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="Apple-tab-span"
style="white-space:pre"> </span>cylinder1->Delete();</font></div>
<div><span style="font-family: 'Courier New', courier, monaco,
monospace, sans-serif; font-size: 13px;"><br>
</span></div>
<div><font face="Courier New, courier, monaco, monospace,
sans-serif" size="2"><span class="Apple-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="Apple-tab-span"
style="white-space:pre"> </span>cube->SetCenter(0,
10, 0);</font></div>
<div><font face="Courier New, courier, monaco, monospace,
sans-serif" size="2"><span class="Apple-tab-span"
style="white-space:pre"> </span>cube->SetXLength(50);</font></div>
<div><font face="Courier New, courier, monaco, monospace,
sans-serif" size="2"><span class="Apple-tab-span"
style="white-space:pre"> </span>cube->SetYLength(20);</font></div>
<div><font face="Courier New, courier, monaco, monospace,
sans-serif" size="2"><span class="Apple-tab-span"
style="white-space:pre"> </span>cube->SetZLength(10);</font></div>
<div><font face="Courier New, courier, monaco, monospace,
sans-serif" size="2"><span class="Apple-tab-span"
style="white-space:pre"> </span>cube->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="Apple-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="Apple-tab-span"
style="white-space:pre"> </span>cubeTriangle->SetInput(cube->GetOutput());</font></div>
<div><font face="Courier New, courier, monaco, monospace,
sans-serif" size="2"><span class="Apple-tab-span"
style="white-space:pre"> </span>cubeTriangle->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="Apple-tab-span"
style="white-space:pre"> </span>cube->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="Apple-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="Apple-tab-span"
style="white-space:pre"> </span>cylinder2->SetCenter(-25,
15, 0);</font></div>
<div><font face="Courier New, courier, monaco, monospace,
sans-serif" size="2"><span class="Apple-tab-span"
style="white-space:pre"> </span>cylinder2->SetHeight(30);</font></div>
<div><font face="Courier New, courier, monaco, monospace,
sans-serif" size="2"><span class="Apple-tab-span"
style="white-space:pre"> </span>cylinder2->SetRadius(3);</font></div>
<div><font face="Courier New, courier, monaco, monospace,
sans-serif" size="2"><span class="Apple-tab-span"
style="white-space:pre"> </span>cylinder2->SetResolution(100);</font></div>
<div><font face="Courier New, courier, monaco, monospace,
sans-serif" size="2"><span class="Apple-tab-span"
style="white-space:pre"> </span>cylinder2->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="Apple-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="Apple-tab-span"
style="white-space:pre"> </span>cylinder2Triangle->SetInput(cylinder2->GetOutput());</font></div>
<div><font face="Courier New, courier, monaco, monospace,
sans-serif" size="2"><span class="Apple-tab-span"
style="white-space:pre"> </span>cylinder2Triangle->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="Apple-tab-span"
style="white-space:pre"> </span>cylinder2->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="Apple-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="Apple-tab-span"
style="white-space:pre"> </span>add1->SetOperationToUnion();</font></div>
<div><font face="Courier New, courier, monaco, monospace,
sans-serif" size="2"><span class="Apple-tab-span"
style="white-space:pre"> </span>add1->SetInput(0,
cylinder1Triangle->GetOutput());</font></div>
<div><font face="Courier New, courier, monaco, monospace,
sans-serif" size="2"><span class="Apple-tab-span"
style="white-space:pre"> </span>add1->SetInput(1,
cubeTriangle->GetOutput());</font></div>
<div><font face="Courier New, courier, monaco, monospace,
sans-serif" size="2"><span class="Apple-tab-span"
style="white-space:pre"> </span>add1->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="Apple-tab-span"
style="white-space:pre"> </span>cubeTriangle->Delete();</font></div>
<div><font face="Courier New, courier, monaco, monospace,
sans-serif" size="2"><span class="Apple-tab-span"
style="white-space:pre"> </span>cylinder1Triangle->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="Apple-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="Apple-tab-span"
style="white-space:pre"> </span>add->SetOperationToUnion();</font></div>
<div><font face="Courier New, courier, monaco, monospace,
sans-serif" size="2"><span class="Apple-tab-span"
style="white-space:pre"> </span>add->SetInput(0,
add1->GetOutput());</font></div>
<div><font face="Courier New, courier, monaco, monospace,
sans-serif" size="2"><span class="Apple-tab-span"
style="white-space:pre"> </span>add->SetInput(1,
cylinder2Triangle->GetOutput());</font></div>
<div><font face="Courier New, courier, monaco, monospace,
sans-serif" size="2"><span class="Apple-tab-span"
style="white-space:pre"> </span>add->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="Apple-tab-span"
style="white-space:pre"> </span>add1->Delete();</font></div>
<div><font face="Courier New, courier, monaco, monospace,
sans-serif" size="2"><span class="Apple-tab-span"
style="white-space: pre; "> </span>cylinder2Triangle->Delete();</font></div>
<div><font face="Courier New, courier, monaco, monospace,
sans-serif" size="2"><br>
</font></div>
<div><span style="font-family: 'Courier New', courier, monaco,
monospace, sans-serif; font-size: 13px; ">Am I doing
something wrong in the use of
vtkBooleanOperationPolyDataFilter ?</span></div>
<div><span style="font-family: 'Courier New', courier, monaco,
monospace, sans-serif; font-size: 13px; "><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="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>
Visit other Kitware open-source projects at <a class="moz-txt-link-freetext" 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 class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a>
Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a>
</pre>
</blockquote>
</body>
</html>