[vtkusers] vtkIntersectionPolyDataFilter problem
Cory Quammen
cory.quammen at kitware.com
Wed Feb 19 16:18:53 EST 2014
Roger,
The inputs for the intersectionPolyDataFilter object should be the
output ports from the Delaunay filters, no the output ports from the
mappers, e.g.
intersectionPolyDataFilter->SetInputConnection( 0,
delaunay1->GetOutputPort() );
intersectionPolyDataFilter->SetInputConnection( 1,
delaunay2->GetOutputPort() );
Cory
On Mon, Feb 10, 2014 at 10:53 AM, Roger Mason <rmason at mun.ca> wrote:
> Hello,
>
> I need to find triangle-triangle intersections between two Delaunay2D
> triangulated surfaces. I based my code on
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Filtering/Delaunay2D but I import
> two surfaces from files containing xyz data. The tringulation seems to work
> as I can display the intersecting surfaces.
>
> When I try to find the intersections using vtkIntersectionPolyDataFilter,
> the code compiles but I get runtime errors:
>
> ERROR: In /build/vtk/src/VTK5.10.1/Filtering/vtkAlgorithm.cxx, line 873
> vtkPainterPolyDataMapper (0x1b24f20): Attempt to get output port index 0 for
> an algorithm with 0 output ports.
>
> ERROR: In /build/vtk/src/VTK5.10.1/Filtering/vtkAlgorithm.cxx, line 873
> vtkPainterPolyDataMapper (0x1b29a80): Attempt to get output port index 0 for
> an algorithm with 0 output ports.
>
> ERROR: In /build/vtk/src/VTK5.10.1/Filtering/vtkDemandDrivenPipeline.cxx,
> line 727
> vtkStreamingDemandDrivenPipeline (0x1b20c60): Input port 0 of algorithm
> vtkIntersectionPolyDataFilter(0x1b206c0) has 0 connections but is not
> optional.
>
> ERROR: In /build/vtk/src/VTK5.10.1/Filtering/vtkDemandDrivenPipeline.cxx,
> line 727
> vtkStreamingDemandDrivenPipeline (0x1b20c60): Input port 1 of algorithm
> vtkIntersectionPolyDataFilter(0x1b206c0) has 0 connections but is not
> optional.
>
> The errors seems to be from the last block of code below. I tried compiling
> in Debug mode but got no more information.
>
> Any help will be most appreciated.
>
> Thanks,
> Roger
>
> Code:
>
> .....
> // Add the points to a polydata object
> vtkSmartPointer<vtkPolyData> polydata2 =
> vtkSmartPointer<vtkPolyData>::New();
> polydata2->SetPoints(points2);
>
> // Triangulate the points
> vtkSmartPointer<vtkDelaunay2D> delaunay1 =
> vtkSmartPointer<vtkDelaunay2D>::New();
> delaunay1->SetInput(polydata1);
> delaunay1->Update();
>
> // Triangulate the points
> vtkSmartPointer<vtkDelaunay2D> delaunay2 =
> vtkSmartPointer<vtkDelaunay2D>::New();
> delaunay2->SetInput( polydata2 );
> delaunay2->Update();
>
> // Visualize
> vtkSmartPointer<vtkPolyDataMapper> mapper1 =
> vtkSmartPointer<vtkPolyDataMapper>::New();
> mapper1->SetInputConnection(delaunay1->GetOutputPort());
> mapper1->ScalarVisibilityOff();
>
> vtkSmartPointer<vtkPolyDataMapper> mapper2 =
> vtkSmartPointer<vtkPolyDataMapper>::New();
> mapper2->SetInputConnection(delaunay2->GetOutputPort());
> mapper2->ScalarVisibilityOff();
>
> vtkSmartPointer<vtkActor> actor1 =
> vtkSmartPointer<vtkActor>::New();
> actor1->SetMapper(mapper1);
> actor1->GetProperty()->SetPointSize(4);
> actor1->GetProperty()->SetOpacity(.8);
> actor1->GetProperty()->SetColor(1,0,0);
>
> vtkSmartPointer<vtkActor> actor2 =
> vtkSmartPointer<vtkActor>::New();
> actor2->SetMapper(mapper2);
> actor2->GetProperty()->SetPointSize(4);
> actor2->GetProperty()->SetOpacity(.8);
> actor2->GetProperty()->SetColor(0,1,0);
>
> // Does not work? ...
> vtkSmartPointer<vtkIntersectionPolyDataFilter> intersectionPolyDataFilter
> =
> vtkSmartPointer<vtkIntersectionPolyDataFilter>::New();
> intersectionPolyDataFilter->SetInputConnection( 0,
> mapper1->GetOutputPort() );
> intersectionPolyDataFilter->SetInputConnection( 1,
> mapper2->GetOutputPort() );
> intersectionPolyDataFilter->Update();
>
> _______________________________________________
> 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
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
More information about the vtkusers
mailing list