Update of multiple clipping planes.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Update of multiple clipping planes.

Zoltan Kovacs

Dear all,

   

    I have the a code for clipping 3D glyphs with there planes: the normal vectors of

    the planes point to the directions of the coordinate axes and the code clips

    with these three planes through given origins. It clips the glyphs properly with

    three planes and if I remove comments on the section which uses only one of

    the planes (with the normal vector pointing in the y-direction) the code clips

    with only one plane.

   

    If modify the origin of the plane in the version using only one plane it

    updates the clipping filter and the mapper automatically and I can see the

    new clipping with the modified origin of the clipping plane.

    However, when I modify the origin of one of the planes in the version

    using three planes nothing changes even if update the clipper or/and the

    mapper. Does anyone have a good idea how to implement plane position

    modification for clipping with multiple planes? The relevant part of the

    code is the following:

   

    clipPlaneOrigins = vtkSmartPointer<vtkPoints>::New();

    clipPlaneNormals = vtkSmartPointer<vtkDoubleArray>::New();

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

    clipPlanes       = vtkSmartPointer<vtkPlanes>::New();

    clipper          = vtkSmartPointer<vtkClipPolyData>::New();

   

    double origin[3], normal[3];

    origin[0] = bounds[0]; origin[1] = bounds[2]; origin[2] = bounds[4];

   

    clipPlaneOrigins->SetNumberOfPoints(3);

 

    clipPlaneOrigins->InsertPoint(0, origin);

    clipPlaneOrigins->InsertPoint(1, origin);

    clipPlaneOrigins->InsertPoint(2, origin);

 

    clipPlaneNormals->SetNumberOfComponents(3);

    clipPlaneNormals->SetNumberOfTuples(3);

 

    // set the normal of the first clipping plane along the x-axis

    normal[0] = 1; normal[1] = 0; normal[2] = 0;

    clipPlaneNormals->SetTuple(0, normal);

 

    // set the normal of the second clipping plane along the y-axis

    normal[0] = 0; normal[1] = 1; normal[2] = 0;

    clipPlaneNormals->SetTuple(1, normal);

 

    // set the normal of the third clipping plane along the z-axis

    normal[0] = 0; normal[1] = 0; normal[2] = 1;

    clipPlaneNormals->SetTuple(2, normal);

 

    clipPlanes->SetPoints(clipPlaneOrigins);

    clipPlanes->SetNormals(clipPlaneNormals);

 

    clipper->SetInputConnection(glyph->GetOutputPort());

    clipper->SetClipFunction(clipPlanes);

/*

    normal[0] = 0; normal[1] = 1; normal[2] = 0;

    clipPlaneY->SetOrigin(origin[0],origin[1],origin[2]);

    clipPlaneY->SetNormal(normal[0],normal[1],normal[2]);

    clipper->SetClipFunction(clipPlaneY);

*/

    // connect the output of clipper to the input of the data set mapper

    mapper->SetInputConnection(clipper->GetOutputPort());

    mapper->Update();

   

    

    Thanks a for the help!

    Regards

    Zoltan

   

 


_______________________________________________
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:
https://public.kitware.com/mailman/listinfo/vtkusers