[vtkusers] WG: Problems cutting polygons, bug? -> YES DEFINITELLY A BUG

Lodron, Gerald Gerald.Lodron at joanneum.at
Wed Nov 24 05:59:43 EST 2010


Ok

 i figured out in which case the cutter does not work, and i think it is a bug:

Working Polygon:

(0 0 0)
(10 0 0)
(10 10 0)
(0 10 0)

This Polygon is cut correct. And this is not cut correct:

(0 0 0)
(10 0 0)
(10 5 0)
(15 5 0)
(10 5 0)
(10 10 0)
(0 10 0)

You can see that in my second case the boundary has an infinite small spike. This results in an empty cutting result. In my opinion this is a valid polygon so the cutting should be calculated...

Can anyone make a bug report? I do not know why i cannot go the bug report system today (or is it offline?)


________________________________
Von: vtk-developers-bounces at vtk.org [mailto:vtk-developers-bounces at vtk.org] Im Auftrag von Lodron, Gerald
Gesendet: Mittwoch, 24. November 2010 09:30
An: 'vtk-developers at vtk.org'
Betreff: [vtk-developers] WG: Problems cutting polygons, bug?


and here the single polygon extracted which cannot be cutted
________________________________
Von: vtk-developers-bounces at vtk.org [mailto:vtk-developers-bounces at vtk.org] Im Auftrag von Lodron, Gerald
Gesendet: Mittwoch, 24. November 2010 08:32
An: 'vtk-developers at vtk.org'; 'vtkusers at vtk.org'
Betreff: [vtk-developers] WG: Problems cutting polygons, bug?


ok, there is the vtk polydata file, i hope that i come through the filter otherwise noone will read thsi :-)



________________________________
Von: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] Im Auftrag von Lodron, Gerald
Gesendet: Mittwoch, 24. November 2010 08:23
An: 'vtkusers at vtk.org'
Betreff: [vtkusers] Problems cutting polygons, bug?


Hi

I wrote an application where a user can paint 2d polygons in 3D space. Then the user can define a cutting plane and i display the resulting lines.
The problem is that SOMETIMES the cutting does not work, so if anyone replys i will send him the Test1.vtk file which contains 4 Polygons whereby only three are cutted. (Yes the cutting plane defenetly cuts all polygons and there are 4 Polygons in the input file, see first visualization).

here my code:


vtkSmartPointer<vtkPolyDataReader> oReader = vtkPolyDataReader::New();

oReader->SetFileName("C:\\Test1.vtk");

oReader->Update();

vtkSmartPointer<vtkPolyData> oPolyData = oReader->GetOutput();

//Display input data, not important

{

vtkSmartPointer<vtkPolyDataMapper> oMapper = vtkPolyDataMapper::New();

oMapper->SetInputConnection(oReader->GetOutputPort());

vtkSmartPointer<vtkActor> oActor = vtkActor::New();

oActor->SetMapper( oMapper );

vtkSmartPointer<vtkRenderer> oRenderer = vtkRenderer::New();

vtkSmartPointer<vtkRenderWindow> oRenderWindow = vtkRenderWindow::New();

oRenderWindow->AddRenderer(oRenderer);

vtkSmartPointer<vtkRenderWindowInteractor> oIRen = vtkRenderWindowInteractor::New();

oIRen->SetRenderWindow(oRenderWindow);

oRenderer->AddActor(oActor);

// Render and interact

oRenderWindow->Render();

oIRen->Initialize();

oIRen->Start();

}

oPolyData->Print(std::cout); //containing 4 polygons

//Cut 2D polygons in 3D space with a plane

vtkSmartPointer<vtkPlane> oPlane = vtkPlane::New();

vtkSmartPointer<vtkCutter> oCutter = vtkCutter::New();

oCutter->SetCutFunction(oPlane);

oCutter->GenerateValues(1,0,1); //i am not sure why i do that

oPlane->SetOrigin(8.5, -72, -1177.0);

oPlane->SetNormal(1,0,0);

oCutter->SetInput(oPolyData);

oCutter->Update();

vtkSmartPointer<vtkPolyData> oCuttedPolyData = oCutter->GetOutput();

//Display cutting data, not important

{

vtkSmartPointer<vtkPolyDataMapper> oMapper = vtkPolyDataMapper::New();

oMapper->SetInputConnection(oCutter->GetOutputPort());

vtkSmartPointer<vtkActor> oActor = vtkActor::New();

oActor->SetMapper( oMapper );

vtkSmartPointer<vtkRenderer> oRenderer = vtkRenderer::New();

vtkSmartPointer<vtkRenderWindow> oRenderWindow = vtkRenderWindow::New();

oRenderWindow->AddRenderer(oRenderer);

vtkSmartPointer<vtkRenderWindowInteractor> oIRen = vtkRenderWindowInteractor::New();

oIRen->SetRenderWindow(oRenderWindow);

oRenderer->AddActor(oActor);

// Render and interact

oRenderWindow->Render();

oIRen->Initialize();

oIRen->Start();

}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101124/9c3f5dff/attachment.htm>


More information about the vtkusers mailing list