[vtkusers] Clipping -surfaces changes to smooth edges

Chandran Ramu chandran.ramu at quest-global.com
Thu Jun 5 09:06:32 EDT 2003


HI All,

I Load a VRML Model using vtkVRMLImporter and do various operations.

One of the operation we do is to cut the model into two and display one
portion on vtkCanvas

The problem what i am facing is ..when i cut the model the surface of the
model turns smooth from sharp edges.

I could not analyze what might be the reason.

Can anyone help me in retaining the original shape( i Mean sharp egdes or as
it is)even after the cut operation.

This is how i code for cut ......


			vtkPlane plane =new  vtk.vtkPlane();
			plane.SetOrigin(0, 0, 0);
			plane.SetNormal(0, 1, 0);
			vtkClipPolyData clipper =new  vtk.vtkClipPolyData();
			vtkAppendPolyData appendData = new vtkAppendPolyData();
			vtkActorCollection collection=renWin.GetRenderer().GetActors();
			int count =collection.GetNumberOfItems();
			collection.InitTraversal();
			for(int i=0;i< count ;i++){
				vtkActor actor=collection.GetNextActor();
				vtkPolyData data=(vtkPolyData)actor.GetMapper().GetInputAsDataSet();
				appendData.AddInput(data);
			}
			clipper.SetInput(appendData.GetOutput());
			clipper.SetClipFunction(plane);
			clipper.GenerateClipScalarsOn();
			clipper.GenerateClippedOutputOn();
			vtkActor actor=new vtkActor();
			vtkPolyDataMapper clipMapper = new vtk.vtkPolyDataMapper();
			clipMapper.SetInput(clipper.GetOutput());
			clipMapper.ScalarVisibilityOff();
			vtkActor clipActor = new vtk.vtkActor();
			clipActor.SetMapper(clipMapper);
			renWin.GetRenderer().RemoveAllProps();
			renWin.GetRenderer().AddActor(clipActor);
			renWin.GetRenderer().ResetCameraClippingRange();
			renWin.Render();


if anyone any other solution please help

Thanks in Advance

Chandran Ramu




More information about the vtkusers mailing list