zippy84 / vtkbool

A new boolean operations filter for VTK
Apache License 2.0
166 stars 40 forks source link

Console spam from union #27

Closed bluelightning32 closed 5 years ago

bluelightning32 commented 5 years ago

This program seems to produce the correct output, but vtkPolyDataBooleanFilter spamming the console with warnings:

Exception on M0.961699,-3.62496 1.16723,-3.59148 2.0933,-3.21335 2.38779,-3.0101 2.42476,-2.99417 3.03956,-3.6255 0.960441,-3.6255 Z, Exception (Simplify, failed)
Exception on M0.961699,-2.74498 1.16723,-2.71151 2.0933,-2.33337 2.38779,-2.13013 2.42476,-2.11419 3.03956,-2.74553 0.960441,-2.74553 Z, Exception (Simplify, failed)
Exception on M0.961699,-1.86501 1.16723,-1.83154 2.0933,-1.4534 2.38779,-1.25016 2.42476,-1.23422 3.03956,-1.86556 0.960441,-1.86556 Z, Exception (Simplify, failed)
Exception on M0.961699,-0.985037 1.16723,-0.951563 2.0933,-0.573427 2.38779,-0.370182 2.42476,-0.354246 3.03956,-0.985579 0.960441,-0.985579 Z, Exception (Simplify, failed)
Exception on M0.961699,-0.105064 1.16723,-0.07159 2.0933,0.306546 2.38779,0.509791 2.42476,0.525727 3.03956,-0.105606 0.960441,-0.105606 Z, Exception (Simplify, failed)
Exception on M0.961699,0.774916 1.16723,0.808389 2.0933,1.18653 2.38779,1.38977 2.42476,1.40571 3.03956,0.774373 0.960441,0.774373 Z, Exception (Simplify, failed)
Exception on M0.961699,1.65487 1.16723,1.68835 2.0933,2.06648 2.38779,2.26973 2.42476,2.28566 3.03956,1.65433 0.960441,1.65433 Z, Exception (Simplify, failed)
Exception on M0.961699,2.53485 1.16723,2.56832 2.0933,2.94646 2.38779,3.1497 2.42476,3.16564 3.03956,2.5343 0.960441,2.5343 Z, Exception (Simplify, failed)
Exception on M0.961699,3.41484 1.16723,3.44831 2.0933,3.82645 2.38779,4.02969 2.42476,4.04563 3.03956,3.41429 0.960441,3.41429 Z, Exception (Simplify, failed)
Exception on M0.961699,4.29481 1.16723,4.32828 2.0933,4.70642 2.38779,4.90967 2.42476,4.9256 3.03956,4.29427 0.960441,4.29427 Z, Exception (Simplify, failed)
Exception on M0.961699,5.17478 1.16723,5.20826 2.0933,5.58639 2.38779,5.78964 2.42476,5.80558 3.03956,5.17424 0.960441,5.17424 Z, Exception (Simplify, failed)
Exception on M0.961699,6.05471 1.16723,6.08818 2.0933,6.46632 2.38779,6.66956 2.42476,6.6855 3.03956,6.05417 0.960441,6.05417 Z, Exception (Simplify, failed)
Exception on M0.961699,-3.62496 1.16723,-3.59148 1.31631,-3.53061 2.0933,-3.21335 2.38779,-3.0101 2.42476,-2.99417 3.03956,-3.6255 0.960441,-3.6255 Z, Exception (Simplify, failed)
Exception on M0.961699,-2.74498 1.16723,-2.71151 1.35068,-2.6366 2.0933,-2.33337 2.38779,-2.13013 2.42476,-2.11419 3.03956,-2.74553 0.960441,-2.74553 Z, Exception (Simplify, failed)
Exception on M0.961699,-1.86501 1.14202,-1.83564 1.16723,-1.83154 1.35585,-1.75452 2.0933,-1.4534 2.38779,-1.25016 2.42476,-1.23422 3.03956,-1.86556 0.960441,-1.86556 Z, Exception (Simplify, failed)
Exception on M0.961699,-0.985037 1.14202,-0.955668 1.16723,-0.951563 1.35585,-0.874543 2.0933,-0.573427 2.38779,-0.370182 2.42476,-0.354246 3.03956,-0.985579 0.960441,-0.985579 Z, Exception (Simplify, failed)
Exception on M0.961699,-0.105064 1.14202,-0.0756951 1.16723,-0.07159 1.35585,0.00542999 2.0933,0.306546 2.38779,0.509791 2.42476,0.525727 3.03956,-0.105606 0.960441,-0.105606 Z, Exception (Simplify, failed)
Exception on M0.961699,0.774916 1.14202,0.804284 1.16723,0.808389 1.35585,0.88541 2.0933,1.18653 2.38779,1.38977 2.42476,1.40571 3.03956,0.774373 0.960441,0.774373 Z, Exception (Simplify, failed)
Exception on M0.961699,1.65487 1.14202,1.68424 1.16723,1.68835 1.35585,1.76537 2.0933,2.06648 2.38779,2.26973 2.42476,2.28566 3.03956,1.65433 0.960441,1.65433 Z, Exception (Simplify, failed)
Exception on M0.961699,2.53485 1.14202,2.56422 1.16723,2.56832 1.35585,2.64534 2.0933,2.94646 2.38779,3.1497 2.42476,3.16564 3.03956,2.5343 0.960441,2.5343 Z, Exception (Simplify, failed)
Exception on M0.961699,3.41484 1.14202,3.44421 1.16723,3.44831 1.35585,3.52533 2.0933,3.82645 2.38779,4.02969 2.42476,4.04563 3.03956,3.41429 0.960441,3.41429 Z, Exception (Simplify, failed)
Exception on M0.961699,4.29481 1.14202,4.32418 1.16723,4.32828 1.35585,4.4053 2.0933,4.70642 2.38779,4.90967 2.42476,4.9256 3.03956,4.29427 0.960441,4.29427 Z, Exception (Simplify, failed)
Exception on M0.961699,5.17478 1.14202,5.20415 1.16723,5.20826 1.35585,5.28528 2.0933,5.58639 2.38779,5.78964 2.42476,5.80558 3.03956,5.17424 0.960441,5.17424 Z, Exception (Simplify, failed)
Exception on M0.961699,6.05471 1.14202,6.08408 1.16723,6.08818 1.35585,6.1652 2.0933,6.46632 2.38779,6.66956 2.42476,6.6855 3.03956,6.05417 0.960441,6.05417 Z, Exception (Simplify, failed)
Exception on M2.07124,8.08013 2.07205,8.08001 1.52347,5.26169 1.51743,5.26169 Z, Exception (Simplify, failed)
Exception on M3.345,14.624 3.34581,14.6239 2.79723,11.8055 2.79118,11.8055 Z, Exception (Simplify, failed)
Exception on M-1.13254,-13.7513 -1.12657,-13.7504 -1.26561,-16.6194 -1.26643,-16.6194 Z, Exception (Simplify, failed)
Exception on M-0.821677,-7.0919 -0.815699,-7.09103 -0.95474,-9.96 -0.955563,-9.96 Z, Exception (Simplify, failed)
Exception on M-0.899395,-8.75676 -0.893418,-8.75588 -1.03246,-11.6248 -1.03328,-11.6248 Z, Exception (Simplify, failed)
Exception on M-0.588526,-2.09734 -0.582548,-2.09646 -0.721589,-4.96543 -0.722412,-4.96543 Z, Exception (Simplify, failed)
Exception on M-1.21027,-15.4162 -1.20429,-15.4153 -1.34333,-18.2843 -1.34415,-18.2843 Z, Exception (Simplify, failed)
Exception on M-0.666243,-3.76219 -0.660265,-3.76132 -0.799306,-6.63029 -0.800128,-6.63029 Z, Exception (Simplify, failed)
Exception on M-0.977111,-10.4216 -0.971134,-10.4207 -1.11017,-13.2897 -1.111,-13.2897 Z, Exception (Simplify, failed)

Please add a flag to disable these warnings.

zippy84 commented 5 years ago

Please send me your meshes as .vtk

bluelightning32 commented 5 years ago

I applied this diff to save the vtk files:

diff --git a/colors.cxx b/colors.cxx
index d826524..da194df 100644
--- a/colors.cxx
+++ b/colors.cxx
@@ -5,6 +5,7 @@
 #include <vtkCylinderSource.h>
 #include <vtkRotationalExtrusionFilter.h>
 #include <vtkPolyDataNormals.h>
+#include <vtkPolyDataWriter.h>
 #include <vtkRegularPolygonSource.h>
 #include <vtkTransform.h>
 #include <vtkTransformFilter.h>
@@ -93,7 +94,17 @@ vtkSmartPointer<vtkAlgorithm> GenerateShape() {

   auto cyl_color = Color(cyl, 1, 1, 0);

-  return Union(spring, spring2, cyl_color);
+  auto vtk_writer = vtkSmartPointer<vtkPolyDataWriter>::New();
+  vtk_writer->SetInputConnection(spring->GetOutputPort());
+  vtk_writer->SetFileName("spring.vtk");
+  vtk_writer->Write();
+
+  vtk_writer = vtkSmartPointer<vtkPolyDataWriter>::New();
+  vtk_writer->SetInputConnection(cyl_color->GetOutputPort());
+  vtk_writer->SetFileName("cylinder.vtk");
+  vtk_writer->Write();
+
+  return Union(spring, cyl_color);
 }

 int main(int argc, char *argv[]) {

vtkfiles.zip

zippy84 commented 5 years ago

I have analysed it. The exceptions are only present when using the old release. I have revised the Simplify-function a few days ago. The head-version works fine with your meshes.

bluelightning32 commented 5 years ago

Thanks! I can confirm it works now.