[vtkusers] Unstructured grid cell colors lost after applying clipping plane
kent myers
dakota_63124 at yahoo.com
Sun Apr 3 23:07:53 EDT 2016
I am using the Java code shown below to apply a clipping plane to a an actor
consisting of an unstructured grid. This works fine, except that if the
unstructured grid has scalars assigned and a color lookup table is used to
display contours, the coloring of the cells is lost (everything turns gray)
while the clipping plane is enabled. As soon as I disable the clipping
plane, the colors are restored.
My guess is that this has something to do with the original unstructured
grid being completely replaced in the visualization pipeline by the result
of the clipping plane operation, therefore, there are no scalars to control
the colors.
If someone knows of an example for how a clipping plane should be used when
scalar data is present, it could be helpful. Note, the scalar data is the
result of a finite element computation, so it is expensive to evaluate the
scalar values for arbitrary points in space. If this is a case where the
points should be assigned global IDs, and these IDs used to look up the
original scalar data for the associated points, an example of how this can
be done would be very helpful. There may be some VTK examples somewhere
that demonstrate global ID's, but I have not found one yet.
Thanks,
Kent
public void updateCuttingPlane(vtkPlane plane) {
vtkActor elementActor = documentVTK.getElementFaceActor();
vtkActor edgeActor = documentVTK.getElementEdgeActor();
vtkActor undeformedEdgeActor =
documentVTK.getUndeformedElementEdgeActor();
vtkClipClosedSurface clipClosedSurface = new vtkClipClosedSurface();
vtkPlaneCollection planes = new vtkPlaneCollection();
planes.AddItem(plane);
clipClosedSurface.SetClippingPlanes(planes);
// extract vtkPolyData from unstructured grid
vtkDataSetSurfaceFilter surfaceFilter = new vtkDataSetSurfaceFilter();
surfaceFilter.SetInputData(facePolyData);
surfaceFilter.Update();
vtkPolyData polyData = surfaceFilter.GetOutput();
clipClosedSurface.AddInputData(polyData);
clipClosedSurface.Update();
vtkDataSetMapper clipMapper = new vtkDataSetMapper();
clipMapper.SetInputConnection(clipClosedSurface.GetOutputPort());
elementActor.SetMapper(clipMapper);
edgeActor.VisibilityOff();
undeformedEdgeActor.VisibilityOff();
}
public void disableCuttingPlane() {
vtkActor elementActor = documentVTK.getElementFaceActor();
vtkActor edgeActor = documentVTK.getElementEdgeActor();
vtkActor undeformedEdgeActor =
documentVTK.getUndeformedElementEdgeActor();
elementActor.SetMapper(faceSurfMapper);
edgeActor.VisibilityOn();
if(getPlotShape() == PlotShape.OVERLAY_DEFORMED) {
undeformedEdgeActor.VisibilityOn();
}
}
--
View this message in context: http://vtk.1045678.n5.nabble.com/Unstructured-grid-cell-colors-lost-after-applying-clipping-plane-tp5737507.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list