How to construct polygon?

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to construct polygon?

Rakesh  Patil

Hi,


This question seems to be simple, but I am not able to get any output for this. I am not able to understand what is happening in this case:


vtkSmartPointer<vtkPoints> tpoints = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPolygon> poly = vtkSmartPointer<vtkPolygon>::New();
vtkSmartPointer<vtkCellArray> carr = vtkSmartPointer<vtkCellArray>::New();
vtkSmartPointer<vtkPolyData> polyData = vtkSmartPointer<vtkPolyData>::New();


poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 4.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 3));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 1.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.08748, -2.87967, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 3.05391, -3.95899, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 1.74755, -4.68466, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 0.28509, -4.99187, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -1.20284, -4.85316, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.58332, -4.28094, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.73305, -3.32631, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.54931, -2.07456, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.95919, -0.637487, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.92609, 0.856528, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.45295, 2.27403, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.58205, 3.4884, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 1.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 3));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 4.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.58205, 3.4884, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.45295, 2.27403, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.92609, 0.856528, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-4.95919, -0.637487, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-4.54931, -2.07456, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-3.73305, -3.32631, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-2.58332, -4.28094, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-1.20284, -4.85316, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(0.28509, -4.99187, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(1.74755, -4.68466, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(3.05391, -3.95899, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(4.08748, -2.87967, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(4.39116, -2.39117, 6));
carr->InsertNextCell(poly);

    polyData->SetPoints(tpoints);
    polyData->SetPolys(carr);

    vtkSmartPointer<vtkTriangleFilter> tfilter = vtkSmartPointer<vtkTriangleFilter>::New();
    tfilter->SetInputData(polyData);
    tfilter->Update();



    vtkSmartPointer<vtkPolyDataMapper> pmapper = vtkSmartPointer<vtkPolyDataMapper>::New();
    pmapper->SetInputConnection(tfilter->GetOutputPort());

    vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
    actor->SetMapper(pmapper);
    actor->GetProperty()->SetRepresentationToSurface();
    actor->GetProperty()->EdgeVisibilityOn();
    actor->GetProperty()->SetEdgeColor(1.0, 0.0, 0.0);

    renderer->AddActor(actor);

    renderer->ResetCamera();


I am not able to view the output if I use vtkTriangleFilter. I have attached two screenshots. One is to show how the expected output should come. Another is the vtk's output without applying vtkTriangleFilter. How do I get the curved surfaces based on the above geometry (points)?


Am I missing anything there?



Thanks & Regards

Rakesh Patil



_______________________________________________
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

expectedOutput.png (23K) Download Attachment
vtkOutput_wo_tri.png (15K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to construct polygon?

kenichiro yoshimi
Hi,

Your polygon loop is non-planar.


Howerver, the triangulate method used by vtkPolygon assumes that polygon points lie in a plane. I recommend to use vtkCylinderSource or vtkStructuredGrid to represent the side of surface of a cylinder.

Thanks,
yoshimi

2017-04-14 0:38 GMT+09:00 Rakesh Patil <[hidden email]>:

Hi,


This question seems to be simple, but I am not able to get any output for this. I am not able to understand what is happening in this case:


vtkSmartPointer<vtkPoints> tpoints = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPolygon> poly = vtkSmartPointer<vtkPolygon>::New();
vtkSmartPointer<vtkCellArray> carr = vtkSmartPointer<vtkCellArray>::New();
vtkSmartPointer<vtkPolyData> polyData = vtkSmartPointer<vtkPolyData>::New();


poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 4.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 3));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 1.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.08748, -2.87967, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 3.05391, -3.95899, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 1.74755, -4.68466, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 0.28509, -4.99187, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -1.20284, -4.85316, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.58332, -4.28094, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.73305, -3.32631, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.54931, -2.07456, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.95919, -0.637487, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.92609, 0.856528, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.45295, 2.27403, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.58205, 3.4884, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 1.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 3));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 4.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.58205, 3.4884, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.45295, 2.27403, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.92609, 0.856528, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-4.95919, -0.637487, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-4.54931, -2.07456, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-3.73305, -3.32631, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-2.58332, -4.28094, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-1.20284, -4.85316, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(0.28509, -4.99187, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(1.74755, -4.68466, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(3.05391, -3.95899, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(4.08748, -2.87967, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(4.39116, -2.39117, 6));
carr->InsertNextCell(poly);

    polyData->SetPoints(tpoints);
    polyData->SetPolys(carr);

    vtkSmartPointer<vtkTriangleFilter> tfilter = vtkSmartPointer<vtkTriangleFilter>::New();
    tfilter->SetInputData(polyData);
    tfilter->Update();



    vtkSmartPointer<vtkPolyDataMapper> pmapper = vtkSmartPointer<vtkPolyDataMapper>::New();
    pmapper->SetInputConnection(tfilter->GetOutputPort());

    vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
    actor->SetMapper(pmapper);
    actor->GetProperty()->SetRepresentationToSurface();
    actor->GetProperty()->EdgeVisibilityOn();
    actor->GetProperty()->SetEdgeColor(1.0, 0.0, 0.0);

    renderer->AddActor(actor);

    renderer->ResetCamera();


I am not able to view the output if I use vtkTriangleFilter. I have attached two screenshots. One is to show how the expected output should come. Another is the vtk's output without applying vtkTriangleFilter. How do I get the curved surfaces based on the above geometry (points)?


Am I missing anything there?



Thanks & Regards

Rakesh Patil



_______________________________________________
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



_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to construct polygon?

rakesh patil
Hi,

Well, I would like to know how polygon loop being non-planar leads to such output. Because, the image shown in expectedOutput is also built of similar polygon loop. Its just that for few curved surfaces are rendered properly and few don't. I just want to know why is there such inconsistent behavior and how do I overcome this?

Thanks

On Sat, Apr 15, 2017 at 10:56 AM, kenichiro yoshimi <[hidden email]> wrote:
Hi,

Your polygon loop is non-planar.


Howerver, the triangulate method used by vtkPolygon assumes that polygon points lie in a plane. I recommend to use vtkCylinderSource or vtkStructuredGrid to represent the side of surface of a cylinder.

Thanks,
yoshimi

2017-04-14 0:38 GMT+09:00 Rakesh Patil <[hidden email]>:

Hi,


This question seems to be simple, but I am not able to get any output for this. I am not able to understand what is happening in this case:


vtkSmartPointer<vtkPoints> tpoints = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPolygon> poly = vtkSmartPointer<vtkPolygon>::New();
vtkSmartPointer<vtkCellArray> carr = vtkSmartPointer<vtkCellArray>::New();
vtkSmartPointer<vtkPolyData> polyData = vtkSmartPointer<vtkPolyData>::New();


poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 4.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 3));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 1.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.08748, -2.87967, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 3.05391, -3.95899, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 1.74755, -4.68466, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 0.28509, -4.99187, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -1.20284, -4.85316, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.58332, -4.28094, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.73305, -3.32631, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.54931, -2.07456, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.95919, -0.637487, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.92609, 0.856528, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.45295, 2.27403, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.58205, 3.4884, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 1.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 3));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 4.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.58205, 3.4884, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.45295, 2.27403, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.92609, 0.856528, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-4.95919, -0.637487, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-4.54931, -2.07456, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-3.73305, -3.32631, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-2.58332, -4.28094, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-1.20284, -4.85316, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(0.28509, -4.99187, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(1.74755, -4.68466, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(3.05391, -3.95899, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(4.08748, -2.87967, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(4.39116, -2.39117, 6));
carr->InsertNextCell(poly);

    polyData->SetPoints(tpoints);
    polyData->SetPolys(carr);

    vtkSmartPointer<vtkTriangleFilter> tfilter = vtkSmartPointer<vtkTriangleFilter>::New();
    tfilter->SetInputData(polyData);
    tfilter->Update();



    vtkSmartPointer<vtkPolyDataMapper> pmapper = vtkSmartPointer<vtkPolyDataMapper>::New();
    pmapper->SetInputConnection(tfilter->GetOutputPort());

    vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
    actor->SetMapper(pmapper);
    actor->GetProperty()->SetRepresentationToSurface();
    actor->GetProperty()->EdgeVisibilityOn();
    actor->GetProperty()->SetEdgeColor(1.0, 0.0, 0.0);

    renderer->AddActor(actor);

    renderer->ResetCamera();


I am not able to view the output if I use vtkTriangleFilter. I have attached two screenshots. One is to show how the expected output should come. Another is the vtk's output without applying vtkTriangleFilter. How do I get the curved surfaces based on the above geometry (points)?


Am I missing anything there?



Thanks & Regards

Rakesh Patil



_______________________________________________
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



_______________________________________________
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



_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to construct polygon?

kenichiro yoshimi
Hi,

It looks like the issue of rendering concave polygons by OpenGL included in the past mailing list, and it is concluded that OpenGL doesn't render concave polygons properly and needs tessellation:
(I'm sorry I don't know the details of this problem.)

I suggest using vtkDelaunay3D for tessellating and then using vtkGeometryFilter that extracts the external faces.

Thanks,
yoshimi

2017-04-17 3:30 GMT+09:00 rakesh patil <[hidden email]>:
Hi,

Well, I would like to know how polygon loop being non-planar leads to such output. Because, the image shown in expectedOutput is also built of similar polygon loop. Its just that for few curved surfaces are rendered properly and few don't. I just want to know why is there such inconsistent behavior and how do I overcome this?

Thanks

On Sat, Apr 15, 2017 at 10:56 AM, kenichiro yoshimi <[hidden email]> wrote:
Hi,

Your polygon loop is non-planar.


Howerver, the triangulate method used by vtkPolygon assumes that polygon points lie in a plane. I recommend to use vtkCylinderSource or vtkStructuredGrid to represent the side of surface of a cylinder.

Thanks,
yoshimi

2017-04-14 0:38 GMT+09:00 Rakesh Patil <[hidden email]>:

Hi,


This question seems to be simple, but I am not able to get any output for this. I am not able to understand what is happening in this case:


vtkSmartPointer<vtkPoints> tpoints = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPolygon> poly = vtkSmartPointer<vtkPolygon>::New();
vtkSmartPointer<vtkCellArray> carr = vtkSmartPointer<vtkCellArray>::New();
vtkSmartPointer<vtkPolyData> polyData = vtkSmartPointer<vtkPolyData>::New();


poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 4.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 3));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 1.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.08748, -2.87967, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 3.05391, -3.95899, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 1.74755, -4.68466, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 0.28509, -4.99187, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -1.20284, -4.85316, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.58332, -4.28094, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.73305, -3.32631, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.54931, -2.07456, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.95919, -0.637487, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.92609, 0.856528, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.45295, 2.27403, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.58205, 3.4884, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 1.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 3));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 4.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.58205, 3.4884, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.45295, 2.27403, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.92609, 0.856528, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-4.95919, -0.637487, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-4.54931, -2.07456, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-3.73305, -3.32631, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-2.58332, -4.28094, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-1.20284, -4.85316, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(0.28509, -4.99187, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(1.74755, -4.68466, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(3.05391, -3.95899, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(4.08748, -2.87967, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(4.39116, -2.39117, 6));
carr->InsertNextCell(poly);

    polyData->SetPoints(tpoints);
    polyData->SetPolys(carr);

    vtkSmartPointer<vtkTriangleFilter> tfilter = vtkSmartPointer<vtkTriangleFilter>::New();
    tfilter->SetInputData(polyData);
    tfilter->Update();



    vtkSmartPointer<vtkPolyDataMapper> pmapper = vtkSmartPointer<vtkPolyDataMapper>::New();
    pmapper->SetInputConnection(tfilter->GetOutputPort());

    vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
    actor->SetMapper(pmapper);
    actor->GetProperty()->SetRepresentationToSurface();
    actor->GetProperty()->EdgeVisibilityOn();
    actor->GetProperty()->SetEdgeColor(1.0, 0.0, 0.0);

    renderer->AddActor(actor);

    renderer->ResetCamera();


I am not able to view the output if I use vtkTriangleFilter. I have attached two screenshots. One is to show how the expected output should come. Another is the vtk's output without applying vtkTriangleFilter. How do I get the curved surfaces based on the above geometry (points)?


Am I missing anything there?



Thanks & Regards

Rakesh Patil



_______________________________________________
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



_______________________________________________
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




_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to construct polygon?

rakesh patil
Hi,

I thought that vtkTriangleFilter does the tessellation of polygon by triangulating. Correct me if I am wrong. Let me try your suggestion and come back. 

Thanks

On Mon, Apr 17, 2017 at 7:34 AM, kenichiro yoshimi <[hidden email]> wrote:
Hi,

It looks like the issue of rendering concave polygons by OpenGL included in the past mailing list, and it is concluded that OpenGL doesn't render concave polygons properly and needs tessellation:
(I'm sorry I don't know the details of this problem.)

I suggest using vtkDelaunay3D for tessellating and then using vtkGeometryFilter that extracts the external faces.

Thanks,
yoshimi

2017-04-17 3:30 GMT+09:00 rakesh patil <[hidden email]>:
Hi,

Well, I would like to know how polygon loop being non-planar leads to such output. Because, the image shown in expectedOutput is also built of similar polygon loop. Its just that for few curved surfaces are rendered properly and few don't. I just want to know why is there such inconsistent behavior and how do I overcome this?

Thanks

On Sat, Apr 15, 2017 at 10:56 AM, kenichiro yoshimi <[hidden email]> wrote:
Hi,

Your polygon loop is non-planar.


Howerver, the triangulate method used by vtkPolygon assumes that polygon points lie in a plane. I recommend to use vtkCylinderSource or vtkStructuredGrid to represent the side of surface of a cylinder.

Thanks,
yoshimi

2017-04-14 0:38 GMT+09:00 Rakesh Patil <[hidden email]>:

Hi,


This question seems to be simple, but I am not able to get any output for this. I am not able to understand what is happening in this case:


vtkSmartPointer<vtkPoints> tpoints = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPolygon> poly = vtkSmartPointer<vtkPolygon>::New();
vtkSmartPointer<vtkCellArray> carr = vtkSmartPointer<vtkCellArray>::New();
vtkSmartPointer<vtkPolyData> polyData = vtkSmartPointer<vtkPolyData>::New();


poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 4.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 3));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 1.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.08748, -2.87967, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 3.05391, -3.95899, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 1.74755, -4.68466, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 0.28509, -4.99187, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -1.20284, -4.85316, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.58332, -4.28094, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.73305, -3.32631, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.54931, -2.07456, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.95919, -0.637487, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.92609, 0.856528, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.45295, 2.27403, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.58205, 3.4884, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 1.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 3));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 4.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.58205, 3.4884, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.45295, 2.27403, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.92609, 0.856528, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-4.95919, -0.637487, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-4.54931, -2.07456, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-3.73305, -3.32631, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-2.58332, -4.28094, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-1.20284, -4.85316, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(0.28509, -4.99187, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(1.74755, -4.68466, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(3.05391, -3.95899, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(4.08748, -2.87967, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(4.39116, -2.39117, 6));
carr->InsertNextCell(poly);

    polyData->SetPoints(tpoints);
    polyData->SetPolys(carr);

    vtkSmartPointer<vtkTriangleFilter> tfilter = vtkSmartPointer<vtkTriangleFilter>::New();
    tfilter->SetInputData(polyData);
    tfilter->Update();



    vtkSmartPointer<vtkPolyDataMapper> pmapper = vtkSmartPointer<vtkPolyDataMapper>::New();
    pmapper->SetInputConnection(tfilter->GetOutputPort());

    vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
    actor->SetMapper(pmapper);
    actor->GetProperty()->SetRepresentationToSurface();
    actor->GetProperty()->EdgeVisibilityOn();
    actor->GetProperty()->SetEdgeColor(1.0, 0.0, 0.0);

    renderer->AddActor(actor);

    renderer->ResetCamera();


I am not able to view the output if I use vtkTriangleFilter. I have attached two screenshots. One is to show how the expected output should come. Another is the vtk's output without applying vtkTriangleFilter. How do I get the curved surfaces based on the above geometry (points)?


Am I missing anything there?



Thanks & Regards

Rakesh Patil



_______________________________________________
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



_______________________________________________
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





_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to construct polygon?

kenichiro yoshimi
Hi, 

For the current polygon vtkTriangleFilter fails to tessellate due to its nonplanarity. 

If my suggestion to use vtkDelaunay3D ends up with the unexpected results, it may be necessary to use vtkStructuredGrid class for your purpose. I have an attached sample.

Thanks,
yoshimi

2017-04-17 13:28 GMT+09:00 rakesh patil <[hidden email]>:
Hi,

I thought that vtkTriangleFilter does the tessellation of polygon by triangulating. Correct me if I am wrong. Let me try your suggestion and come back. 

Thanks

On Mon, Apr 17, 2017 at 7:34 AM, kenichiro yoshimi <[hidden email]> wrote:
Hi,

It looks like the issue of rendering concave polygons by OpenGL included in the past mailing list, and it is concluded that OpenGL doesn't render concave polygons properly and needs tessellation:
(I'm sorry I don't know the details of this problem.)

I suggest using vtkDelaunay3D for tessellating and then using vtkGeometryFilter that extracts the external faces.

Thanks,
yoshimi

2017-04-17 3:30 GMT+09:00 rakesh patil <[hidden email]>:
Hi,

Well, I would like to know how polygon loop being non-planar leads to such output. Because, the image shown in expectedOutput is also built of similar polygon loop. Its just that for few curved surfaces are rendered properly and few don't. I just want to know why is there such inconsistent behavior and how do I overcome this?

Thanks

On Sat, Apr 15, 2017 at 10:56 AM, kenichiro yoshimi <[hidden email]> wrote:
Hi,

Your polygon loop is non-planar.


Howerver, the triangulate method used by vtkPolygon assumes that polygon points lie in a plane. I recommend to use vtkCylinderSource or vtkStructuredGrid to represent the side of surface of a cylinder.

Thanks,
yoshimi

2017-04-14 0:38 GMT+09:00 Rakesh Patil <[hidden email]>:

Hi,


This question seems to be simple, but I am not able to get any output for this. I am not able to understand what is happening in this case:


vtkSmartPointer<vtkPoints> tpoints = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPolygon> poly = vtkSmartPointer<vtkPolygon>::New();
vtkSmartPointer<vtkCellArray> carr = vtkSmartPointer<vtkCellArray>::New();
vtkSmartPointer<vtkPolyData> polyData = vtkSmartPointer<vtkPolyData>::New();


poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 4.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 3));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 1.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.08748, -2.87967, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 3.05391, -3.95899, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 1.74755, -4.68466, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 0.28509, -4.99187, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -1.20284, -4.85316, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.58332, -4.28094, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.73305, -3.32631, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.54931, -2.07456, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.95919, -0.637487, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.92609, 0.856528, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.45295, 2.27403, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.58205, 3.4884, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 1.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 3));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 4.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.58205, 3.4884, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.45295, 2.27403, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.92609, 0.856528, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-4.95919, -0.637487, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-4.54931, -2.07456, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-3.73305, -3.32631, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-2.58332, -4.28094, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-1.20284, -4.85316, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(0.28509, -4.99187, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(1.74755, -4.68466, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(3.05391, -3.95899, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(4.08748, -2.87967, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(4.39116, -2.39117, 6));
carr->InsertNextCell(poly);

    polyData->SetPoints(tpoints);
    polyData->SetPolys(carr);

    vtkSmartPointer<vtkTriangleFilter> tfilter = vtkSmartPointer<vtkTriangleFilter>::New();
    tfilter->SetInputData(polyData);
    tfilter->Update();



    vtkSmartPointer<vtkPolyDataMapper> pmapper = vtkSmartPointer<vtkPolyDataMapper>::New();
    pmapper->SetInputConnection(tfilter->GetOutputPort());

    vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
    actor->SetMapper(pmapper);
    actor->GetProperty()->SetRepresentationToSurface();
    actor->GetProperty()->EdgeVisibilityOn();
    actor->GetProperty()->SetEdgeColor(1.0, 0.0, 0.0);

    renderer->AddActor(actor);

    renderer->ResetCamera();


I am not able to view the output if I use vtkTriangleFilter. I have attached two screenshots. One is to show how the expected output should come. Another is the vtk's output without applying vtkTriangleFilter. How do I get the curved surfaces based on the above geometry (points)?


Am I missing anything there?



Thanks & Regards

Rakesh Patil



_______________________________________________
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



_______________________________________________
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






_______________________________________________
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

StructuredGrid.cxx (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to construct polygon?

Andrew Maclean-3
In reply to this post by Rakesh Patil
Hi Rakesh,
   I don't know what you intend to use it for. However if it is just a one-off construction another suggestion would be to manually triangulate the surface yourself.

This is what is done for the VTK Parametric Functions.

See void vtkParametricFunctionSource::MakeTriangles() and void AddTriCells() in vtkParametricFunctionSource.cxx.

Andrew



---------- Forwarded message ----------
From: rakesh patil <[hidden email]>
To: kenichiro yoshimi <[hidden email]>
Cc: "[hidden email]" <[hidden email]>
Bcc: 
Date: Mon, 17 Apr 2017 09:58:08 +0530
Subject: Re: [vtkusers] How to construct polygon?
Hi,

I thought that vtkTriangleFilter does the tessellation of polygon by triangulating. Correct me if I am wrong. Let me try your suggestion and come back. 

Thanks

On Mon, Apr 17, 2017 at 7:34 AM, kenichiro yoshimi <[hidden email]> wrote:
Hi,

It looks like the issue of rendering concave polygons by OpenGL included in the past mailing list, and it is concluded that OpenGL doesn't render concave polygons properly and needs tessellation:
(I'm sorry I don't know the details of this problem.)

I suggest using vtkDelaunay3D for tessellating and then using vtkGeometryFilter that extracts the external faces.

Thanks,
yoshimi

2017-04-17 3:30 GMT+09:00 rakesh patil <[hidden email]>:
Hi,

Well, I would like to know how polygon loop being non-planar leads to such output. Because, the image shown in expectedOutput is also built of similar polygon loop. Its just that for few curved surfaces are rendered properly and few don't. I just want to know why is there such inconsistent behavior and how do I overcome this?

Thanks

On Sat, Apr 15, 2017 at 10:56 AM, kenichiro yoshimi <[hidden email]> wrote:
Hi,

Your polygon loop is non-planar.


Howerver, the triangulate method used by vtkPolygon assumes that polygon points lie in a plane. I recommend to use vtkCylinderSource or vtkStructuredGrid to represent the side of surface of a cylinder.

Thanks,
yoshimi

2017-04-14 0:38 GMT+09:00 Rakesh Patil <[hidden email]>:

Hi,


This question seems to be simple, but I am not able to get any output for this. I am not able to understand what is happening in this case:


vtkSmartPointer<vtkPoints> tpoints = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPolygon> poly = vtkSmartPointer<vtkPolygon>::New();
vtkSmartPointer<vtkCellArray> carr = vtkSmartPointer<vtkCellArray>::New();
vtkSmartPointer<vtkPolyData> polyData = vtkSmartPointer<vtkPolyData>::New();


poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 4.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 3));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 1.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.08748, -2.87967, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 3.05391, -3.95899, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 1.74755, -4.68466, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 0.28509, -4.99187, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -1.20284, -4.85316, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.58332, -4.28094, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.73305, -3.32631, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.54931, -2.07456, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.95919, -0.637487, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.92609, 0.856528, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.45295, 2.27403, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.58205, 3.4884, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 1.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 3));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 4.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.58205, 3.4884, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.45295, 2.27403, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.92609, 0.856528, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-4.95919, -0.637487, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-4.54931, -2.07456, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-3.73305, -3.32631, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-2.58332, -4.28094, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-1.20284, -4.85316, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(0.28509, -4.99187, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(1.74755, -4.68466, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(3.05391, -3.95899, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(4.08748, -2.87967, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(4.39116, -2.39117, 6));
carr->InsertNextCell(poly);

    polyData->SetPoints(tpoints);
    polyData->SetPolys(carr);

    vtkSmartPointer<vtkTriangleFilter> tfilter = vtkSmartPointer<vtkTriangleFilter>::New();
    tfilter->SetInputData(polyData);
    tfilter->Update();



    vtkSmartPointer<vtkPolyDataMapper> pmapper = vtkSmartPointer<vtkPolyDataMapper>::New();
    pmapper->SetInputConnection(tfilter->GetOutputPort());

    vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
    actor->SetMapper(pmapper);
    actor->GetProperty()->SetRepresentationToSurface();
    actor->GetProperty()->EdgeVisibilityOn();
    actor->GetProperty()->SetEdgeColor(1.0, 0.0, 0.0);

    renderer->AddActor(actor);

    renderer->ResetCamera();


I am not able to view the output if I use vtkTriangleFilter. I have attached two screenshots. One is to show how the expected output should come. Another is the vtk's output without applying vtkTriangleFilter. How do I get the curved surfaces based on the above geometry (points)?


Am I missing anything there?



Thanks & Regards

Rakesh Patil



_______________________________________________
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



_______________________________________________
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







--
___________________________________________
Andrew J. P. Maclean

___________________________________________

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to construct polygon?

rakesh patil
Hi Andrew,

I am trying to visualise a BRep object using VTK. I get the lines that forms a closed face. I create a vtkPolyData of each face and append it using vtkAppendPolyData. So the purpose is to visualise this BRep object as a wireframe as well as a surface. Seems that polygon rendering is not happening properly. 

I am able to connect those lines in sequence, to form a connected closed polygon. I face this problem only for the curved surface. For planar surfaces I don't see any issue. The data set shown in my sample code, is just one particular case. And for that case, Yoshimi's logic gives good surface representation. But I am not sure how far it will work for all the cases, I am in process to make it a generic one. 

Your inputs are welcome.

Thanks & Regards
Rakesh Patil

On Tue, Apr 18, 2017 at 11:56 AM, Andrew Maclean <[hidden email]> wrote:
Hi Rakesh,
   I don't know what you intend to use it for. However if it is just a one-off construction another suggestion would be to manually triangulate the surface yourself.

This is what is done for the VTK Parametric Functions.

See void vtkParametricFunctionSource::MakeTriangles() and void AddTriCells() in vtkParametricFunctionSource.cxx.

Andrew



---------- Forwarded message ----------
From: rakesh patil <[hidden email]>
To: kenichiro yoshimi <[hidden email]>
Cc: "[hidden email]" <[hidden email]>
Bcc: 
Date: Mon, 17 Apr 2017 09:58:08 +0530
Subject: Re: [vtkusers] How to construct polygon?
Hi,

I thought that vtkTriangleFilter does the tessellation of polygon by triangulating. Correct me if I am wrong. Let me try your suggestion and come back. 

Thanks

On Mon, Apr 17, 2017 at 7:34 AM, kenichiro yoshimi <[hidden email]> wrote:
Hi,

It looks like the issue of rendering concave polygons by OpenGL included in the past mailing list, and it is concluded that OpenGL doesn't render concave polygons properly and needs tessellation:
(I'm sorry I don't know the details of this problem.)

I suggest using vtkDelaunay3D for tessellating and then using vtkGeometryFilter that extracts the external faces.

Thanks,
yoshimi

2017-04-17 3:30 GMT+09:00 rakesh patil <[hidden email]>:
Hi,

Well, I would like to know how polygon loop being non-planar leads to such output. Because, the image shown in expectedOutput is also built of similar polygon loop. Its just that for few curved surfaces are rendered properly and few don't. I just want to know why is there such inconsistent behavior and how do I overcome this?

Thanks

On Sat, Apr 15, 2017 at 10:56 AM, kenichiro yoshimi <[hidden email]> wrote:
Hi,

Your polygon loop is non-planar.


Howerver, the triangulate method used by vtkPolygon assumes that polygon points lie in a plane. I recommend to use vtkCylinderSource or vtkStructuredGrid to represent the side of surface of a cylinder.

Thanks,
yoshimi

2017-04-14 0:38 GMT+09:00 Rakesh Patil <[hidden email]>:

Hi,


This question seems to be simple, but I am not able to get any output for this. I am not able to understand what is happening in this case:


vtkSmartPointer<vtkPoints> tpoints = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPolygon> poly = vtkSmartPointer<vtkPolygon>::New();
vtkSmartPointer<vtkCellArray> carr = vtkSmartPointer<vtkCellArray>::New();
vtkSmartPointer<vtkPolyData> polyData = vtkSmartPointer<vtkPolyData>::New();


poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 4.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 3));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 1.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.08748, -2.87967, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 3.05391, -3.95899, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 1.74755, -4.68466, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 0.28509, -4.99187, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -1.20284, -4.85316, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.58332, -4.28094, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.73305, -3.32631, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.54931, -2.07456, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.95919, -0.637487, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.92609, 0.856528, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.45295, 2.27403, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.58205, 3.4884, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 1.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 3));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 4.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.58205, 3.4884, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.45295, 2.27403, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.92609, 0.856528, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-4.95919, -0.637487, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-4.54931, -2.07456, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-3.73305, -3.32631, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-2.58332, -4.28094, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-1.20284, -4.85316, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(0.28509, -4.99187, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(1.74755, -4.68466, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(3.05391, -3.95899, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(4.08748, -2.87967, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(4.39116, -2.39117, 6));
carr->InsertNextCell(poly);

    polyData->SetPoints(tpoints);
    polyData->SetPolys(carr);

    vtkSmartPointer<vtkTriangleFilter> tfilter = vtkSmartPointer<vtkTriangleFilter>::New();
    tfilter->SetInputData(polyData);
    tfilter->Update();



    vtkSmartPointer<vtkPolyDataMapper> pmapper = vtkSmartPointer<vtkPolyDataMapper>::New();
    pmapper->SetInputConnection(tfilter->GetOutputPort());

    vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
    actor->SetMapper(pmapper);
    actor->GetProperty()->SetRepresentationToSurface();
    actor->GetProperty()->EdgeVisibilityOn();
    actor->GetProperty()->SetEdgeColor(1.0, 0.0, 0.0);

    renderer->AddActor(actor);

    renderer->ResetCamera();


I am not able to view the output if I use vtkTriangleFilter. I have attached two screenshots. One is to show how the expected output should come. Another is the vtk's output without applying vtkTriangleFilter. How do I get the curved surfaces based on the above geometry (points)?


Am I missing anything there?



Thanks & Regards

Rakesh Patil



_______________________________________________
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



_______________________________________________
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







--
___________________________________________
Andrew J. P. Maclean

___________________________________________


_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to construct polygon?

rakesh patil
Hi Yoshimi,

I tried your sample code. It works for that set of input. Is it possible to make it a generic algorithm? Like for any given set of inputs, will it work?

Thanks & Regards

On Tue, Apr 18, 2017 at 12:07 PM, rakesh patil <[hidden email]> wrote:
Hi Andrew,

I am trying to visualise a BRep object using VTK. I get the lines that forms a closed face. I create a vtkPolyData of each face and append it using vtkAppendPolyData. So the purpose is to visualise this BRep object as a wireframe as well as a surface. Seems that polygon rendering is not happening properly. 

I am able to connect those lines in sequence, to form a connected closed polygon. I face this problem only for the curved surface. For planar surfaces I don't see any issue. The data set shown in my sample code, is just one particular case. And for that case, Yoshimi's logic gives good surface representation. But I am not sure how far it will work for all the cases, I am in process to make it a generic one. 

Your inputs are welcome.

Thanks & Regards
Rakesh Patil

On Tue, Apr 18, 2017 at 11:56 AM, Andrew Maclean <[hidden email]> wrote:
Hi Rakesh,
   I don't know what you intend to use it for. However if it is just a one-off construction another suggestion would be to manually triangulate the surface yourself.

This is what is done for the VTK Parametric Functions.

See void vtkParametricFunctionSource::MakeTriangles() and void AddTriCells() in vtkParametricFunctionSource.cxx.

Andrew



---------- Forwarded message ----------
From: rakesh patil <[hidden email]>
To: kenichiro yoshimi <[hidden email]>
Cc: "[hidden email]" <[hidden email]>
Bcc: 
Date: Mon, 17 Apr 2017 09:58:08 +0530
Subject: Re: [vtkusers] How to construct polygon?
Hi,

I thought that vtkTriangleFilter does the tessellation of polygon by triangulating. Correct me if I am wrong. Let me try your suggestion and come back. 

Thanks

On Mon, Apr 17, 2017 at 7:34 AM, kenichiro yoshimi <[hidden email]> wrote:
Hi,

It looks like the issue of rendering concave polygons by OpenGL included in the past mailing list, and it is concluded that OpenGL doesn't render concave polygons properly and needs tessellation:
(I'm sorry I don't know the details of this problem.)

I suggest using vtkDelaunay3D for tessellating and then using vtkGeometryFilter that extracts the external faces.

Thanks,
yoshimi

2017-04-17 3:30 GMT+09:00 rakesh patil <[hidden email]>:
Hi,

Well, I would like to know how polygon loop being non-planar leads to such output. Because, the image shown in expectedOutput is also built of similar polygon loop. Its just that for few curved surfaces are rendered properly and few don't. I just want to know why is there such inconsistent behavior and how do I overcome this?

Thanks

On Sat, Apr 15, 2017 at 10:56 AM, kenichiro yoshimi <[hidden email]> wrote:
Hi,

Your polygon loop is non-planar.


Howerver, the triangulate method used by vtkPolygon assumes that polygon points lie in a plane. I recommend to use vtkCylinderSource or vtkStructuredGrid to represent the side of surface of a cylinder.

Thanks,
yoshimi

2017-04-14 0:38 GMT+09:00 Rakesh Patil <[hidden email]>:

Hi,


This question seems to be simple, but I am not able to get any output for this. I am not able to understand what is happening in this case:


vtkSmartPointer<vtkPoints> tpoints = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPolygon> poly = vtkSmartPointer<vtkPolygon>::New();
vtkSmartPointer<vtkCellArray> carr = vtkSmartPointer<vtkCellArray>::New();
vtkSmartPointer<vtkPolyData> polyData = vtkSmartPointer<vtkPolyData>::New();


poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 4.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 3));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 1.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.08748, -2.87967, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 3.05391, -3.95899, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 1.74755, -4.68466, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 0.28509, -4.99187, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -1.20284, -4.85316, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.58332, -4.28094, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.73305, -3.32631, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.54931, -2.07456, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.95919, -0.637487, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.92609, 0.856528, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.45295, 2.27403, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.58205, 3.4884, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 1.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 3));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 4.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.58205, 3.4884, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.45295, 2.27403, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.92609, 0.856528, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-4.95919, -0.637487, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-4.54931, -2.07456, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-3.73305, -3.32631, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-2.58332, -4.28094, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-1.20284, -4.85316, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(0.28509, -4.99187, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(1.74755, -4.68466, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(3.05391, -3.95899, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(4.08748, -2.87967, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(4.39116, -2.39117, 6));
carr->InsertNextCell(poly);

    polyData->SetPoints(tpoints);
    polyData->SetPolys(carr);

    vtkSmartPointer<vtkTriangleFilter> tfilter = vtkSmartPointer<vtkTriangleFilter>::New();
    tfilter->SetInputData(polyData);
    tfilter->Update();



    vtkSmartPointer<vtkPolyDataMapper> pmapper = vtkSmartPointer<vtkPolyDataMapper>::New();
    pmapper->SetInputConnection(tfilter->GetOutputPort());

    vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
    actor->SetMapper(pmapper);
    actor->GetProperty()->SetRepresentationToSurface();
    actor->GetProperty()->EdgeVisibilityOn();
    actor->GetProperty()->SetEdgeColor(1.0, 0.0, 0.0);

    renderer->AddActor(actor);

    renderer->ResetCamera();


I am not able to view the output if I use vtkTriangleFilter. I have attached two screenshots. One is to show how the expected output should come. Another is the vtk's output without applying vtkTriangleFilter. How do I get the curved surfaces based on the above geometry (points)?


Am I missing anything there?



Thanks & Regards

Rakesh Patil



_______________________________________________
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



_______________________________________________
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







--
___________________________________________
Andrew J. P. Maclean

___________________________________________



_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to construct polygon?

kenichiro yoshimi
Hi Rakesh,

No, it will not work. It is difficult for my way to be extended to the generic cases. I'm afraid I have no idea in VTK.

Thanks,
yoshimi

2017-04-19 22:06 GMT+09:00 rakesh patil <[hidden email]>:
Hi Yoshimi,

I tried your sample code. It works for that set of input. Is it possible to make it a generic algorithm? Like for any given set of inputs, will it work?

Thanks & Regards

On Tue, Apr 18, 2017 at 12:07 PM, rakesh patil <[hidden email]> wrote:
Hi Andrew,

I am trying to visualise a BRep object using VTK. I get the lines that forms a closed face. I create a vtkPolyData of each face and append it using vtkAppendPolyData. So the purpose is to visualise this BRep object as a wireframe as well as a surface. Seems that polygon rendering is not happening properly. 

I am able to connect those lines in sequence, to form a connected closed polygon. I face this problem only for the curved surface. For planar surfaces I don't see any issue. The data set shown in my sample code, is just one particular case. And for that case, Yoshimi's logic gives good surface representation. But I am not sure how far it will work for all the cases, I am in process to make it a generic one. 

Your inputs are welcome.

Thanks & Regards
Rakesh Patil

On Tue, Apr 18, 2017 at 11:56 AM, Andrew Maclean <[hidden email]> wrote:
Hi Rakesh,
   I don't know what you intend to use it for. However if it is just a one-off construction another suggestion would be to manually triangulate the surface yourself.

This is what is done for the VTK Parametric Functions.

See void vtkParametricFunctionSource::MakeTriangles() and void AddTriCells() in vtkParametricFunctionSource.cxx.

Andrew



---------- Forwarded message ----------
From: rakesh patil <[hidden email]>
To: kenichiro yoshimi <[hidden email]>
Cc: "[hidden email]" <[hidden email]>
Bcc: 
Date: Mon, 17 Apr 2017 09:58:08 +0530
Subject: Re: [vtkusers] How to construct polygon?
Hi,

I thought that vtkTriangleFilter does the tessellation of polygon by triangulating. Correct me if I am wrong. Let me try your suggestion and come back. 

Thanks

On Mon, Apr 17, 2017 at 7:34 AM, kenichiro yoshimi <[hidden email]> wrote:
Hi,

It looks like the issue of rendering concave polygons by OpenGL included in the past mailing list, and it is concluded that OpenGL doesn't render concave polygons properly and needs tessellation:
(I'm sorry I don't know the details of this problem.)

I suggest using vtkDelaunay3D for tessellating and then using vtkGeometryFilter that extracts the external faces.

Thanks,
yoshimi

2017-04-17 3:30 GMT+09:00 rakesh patil <[hidden email]>:
Hi,

Well, I would like to know how polygon loop being non-planar leads to such output. Because, the image shown in expectedOutput is also built of similar polygon loop. Its just that for few curved surfaces are rendered properly and few don't. I just want to know why is there such inconsistent behavior and how do I overcome this?

Thanks

On Sat, Apr 15, 2017 at 10:56 AM, kenichiro yoshimi <[hidden email]> wrote:
Hi,

Your polygon loop is non-planar.


Howerver, the triangulate method used by vtkPolygon assumes that polygon points lie in a plane. I recommend to use vtkCylinderSource or vtkStructuredGrid to represent the side of surface of a cylinder.

Thanks,
yoshimi

2017-04-14 0:38 GMT+09:00 Rakesh Patil <[hidden email]>:

Hi,


This question seems to be simple, but I am not able to get any output for this. I am not able to understand what is happening in this case:


vtkSmartPointer<vtkPoints> tpoints = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPolygon> poly = vtkSmartPointer<vtkPolygon>::New();
vtkSmartPointer<vtkCellArray> carr = vtkSmartPointer<vtkCellArray>::New();
vtkSmartPointer<vtkPolyData> polyData = vtkSmartPointer<vtkPolyData>::New();


poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 4.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 3));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 1.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.39116, -2.39117, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 4.08748, -2.87967, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 3.05391, -3.95899, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 1.74755, -4.68466, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( 0.28509, -4.99187, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -1.20284, -4.85316, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.58332, -4.28094, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.73305, -3.32631, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.54931, -2.07456, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.95919, -0.637487, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.92609, 0.856528, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.45295, 2.27403, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.58205, 3.4884, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 0));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 1.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 3));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 4.5));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -2.39117, 4.39116, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -3.58205, 3.4884, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.45295, 2.27403, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint( -4.92609, 0.856528, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-4.95919, -0.637487, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-4.54931, -2.07456, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-3.73305, -3.32631, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-2.58332, -4.28094, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(-1.20284, -4.85316, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(0.28509, -4.99187, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(1.74755, -4.68466, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(3.05391, -3.95899, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(4.08748, -2.87967, 6));
poly->GetPointIds()->InsertNextId(tpoints->InsertNextPoint(4.39116, -2.39117, 6));
carr->InsertNextCell(poly);

    polyData->SetPoints(tpoints);
    polyData->SetPolys(carr);

    vtkSmartPointer<vtkTriangleFilter> tfilter = vtkSmartPointer<vtkTriangleFilter>::New();
    tfilter->SetInputData(polyData);
    tfilter->Update();



    vtkSmartPointer<vtkPolyDataMapper> pmapper = vtkSmartPointer<vtkPolyDataMapper>::New();
    pmapper->SetInputConnection(tfilter->GetOutputPort());

    vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
    actor->SetMapper(pmapper);
    actor->GetProperty()->SetRepresentationToSurface();
    actor->GetProperty()->EdgeVisibilityOn();
    actor->GetProperty()->SetEdgeColor(1.0, 0.0, 0.0);

    renderer->AddActor(actor);

    renderer->ResetCamera();


I am not able to view the output if I use vtkTriangleFilter. I have attached two screenshots. One is to show how the expected output should come. Another is the vtk's output without applying vtkTriangleFilter. How do I get the curved surfaces based on the above geometry (points)?


Am I missing anything there?



Thanks & Regards

Rakesh Patil



_______________________________________________
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



_______________________________________________
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







--
___________________________________________
Andrew J. P. Maclean

___________________________________________




_______________________________________________
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
Loading...