[vtkusers] Segmentation fault with vtkBooleanOperationPolyDataFilter using 2 cylinders [HELP]

josci jojo2100 at gmx.de
Wed Sep 16 09:53:22 EDT 2015


Hi Cory Quammen-2, 

thanks for your reply. If written some code to reproduce the crash:

#include <vtkPolyData.h>
#include <vtkSTLReader.h>
#include <vtkSmartPointer.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkSphereSource.h>
#include <vtkTriangleFilter.h>
#include <vtkBooleanOperationPolyDataFilter.h>
#include <vtkMassProperties.h>

int main ( int argc, char *argv[] )
{
	double volume, r0;
	
	r0 = 0.013;

	vtkSmartPointer<vtkSTLReader> reader1 =
vtkSmartPointer<vtkSTLReader>::New();
	reader1->SetFileName(argv[1]);
	reader1->Update();
	
	vtkSmartPointer<vtkSphereSource> sphere_source_2 =
vtkSmartPointer<vtkSphereSource>::New();
	sphere_source_2->SetCenter(0,0,0);
	sphere_source_2->SetRadius(r0);
	sphere_source_2->SetThetaResolution(16);				
	sphere_source_2->SetPhiResolution(16);
	sphere_source_2->Update();

	vtkSmartPointer<vtkTriangleFilter> sphere_triangle_2 =
vtkSmartPointer<vtkTriangleFilter>::New();
	sphere_triangle_2->SetInputConnection(sphere_source_2->GetOutputPort());
	sphere_triangle_2->Update();

	vtkSmartPointer<vtkBooleanOperationPolyDataFilter> booleanOperation =
vtkSmartPointer<vtkBooleanOperationPolyDataFilter>::New();
	booleanOperation->SetOperationToIntersection();
	booleanOperation->SetInputConnection(0, reader1->GetOutputPort());
	booleanOperation->SetInputConnection(1,
sphere_triangle_2->GetOutputPort());
	booleanOperation->Update();

	vtkSmartPointer<vtkMassProperties> massprop =
vtkSmartPointer<vtkMassProperties>::New();
	massprop->SetInputConnection(booleanOperation->GetOutputPort());

	for (double r = r0; r < 0.03; r+=0.001)
	{
		sphere_source_2->SetRadius(r);
		sphere_source_2->Update();
		sphere_triangle_2->Update();
		booleanOperation->Update();				//crash		:if SetThetaResolution =
SetThetaResolution = 8 and r = 0.015 
												//no crassh	:if SetThetaResolution = SetThetaResolution = 16 and
r = 0.015 or r = 0.016 
												//no crassh	:if SetThetaResolution = SetThetaResolution = 8 and
r = 0.014 or r = 0.016 
		massprop->Update();
		volume = massprop->GetVolume();
		printf("r = %1.5f: intersection volumt = %1.16f\n", r, volume);	
	}
	
	return EXIT_SUCCESS;
}

just pass the filename of the stl (file attached) as first and only
parameter to the program. In the source code there are a few cases
discribed, which work and one "parameter combination" which leads to the
crash.

single_sphere.stl
<http://vtk.1045678.n5.nabble.com/file/n5733964/single_sphere.stl>  

Best regards





Cory Quammen-2 wrote
> Hi Johannes,
> 
> Yes, the mailing list is a suitable place for a bug report.
> 
> Thanks,
> Cory
> 
> On Wed, Sep 16, 2015 at 8:42 AM, josci <

> jojo2100@

> > wrote:
> 
>> Hi Drak,
>>
>> where you able to solve your problem? I'm experiencing the same with
>> spherical surface read from an stl file. My second geometry is generated
>> by
>> spheresource->trianglefilter.
>>
>> I'm trying to reproduce this error. If I'm successful doing this I'll
>> post
>> the stl file and the source code here.
>>
>>
>> Best regards
>>
>> Johannes
>>
>> P.s.: Is the mailinglist the proper place for a bug report?
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://vtk.1045678.n5.nabble.com/Segmentation-fault-with-vtkBooleanOperationPolyDataFilter-using-2-cylinders-HELP-tp5733567p5733960.html
>> Sent from the VTK - Users mailing list archive at Nabble.com.
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtkusers
>>
> 
> 
> 
> -- 
> Cory Quammen
> R&D Engineer
> Kitware, Inc.
> 
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> 
> Search the list archives at: http://markmail.org/search/?q=vtkusers
> 
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers





--
View this message in context: http://vtk.1045678.n5.nabble.com/Segmentation-fault-with-vtkBooleanOperationPolyDataFilter-using-2-cylinders-HELP-tp5733567p5733964.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list