#!/usr/local/bin/perl -w
#
use Graphics::VTK;



use Tk;
use Graphics::VTK::Tk;
$MW = Tk::MainWindow->new;

$VTK_DATA = 0;
$VTK_DATA = $ENV{VTK_DATA};
# Contour every cell type
# get the interactor ui
use Graphics::VTK::Tk::vtkInt;
$ren1 = Graphics::VTK::Renderer->new;
$renWin = Graphics::VTK::RenderWindow->new;
$renWin->AddRenderer($ren1);
$iren = Graphics::VTK::RenderWindowInteractor->new;
$iren->SetRenderWindow($renWin);
# create a scene with one of each cell type
$voxelPoints = Graphics::VTK::Points->new;
$voxelPoints->SetNumberOfPoints(8);
$voxelPoints->InsertPoint(0,0,0,0);
$voxelPoints->InsertPoint(1,1,0,0);
$voxelPoints->InsertPoint(2,0,1,0);
$voxelPoints->InsertPoint(3,1,1,0);
$voxelPoints->InsertPoint(4,0,0,1);
$voxelPoints->InsertPoint(5,1,0,1);
$voxelPoints->InsertPoint(6,0,1,1);
$voxelPoints->InsertPoint(7,1,1,1);
$voxelScalars = Graphics::VTK::Scalars->new;
$voxelScalars->SetNumberOfScalars(8);
$voxelScalars->InsertScalar(0,0);
$voxelScalars->InsertScalar(1,1);
$voxelScalars->InsertScalar(2,0);
$voxelScalars->InsertScalar(3,0);
$voxelScalars->InsertScalar(4,0);
$voxelScalars->InsertScalar(5,0);
$voxelScalars->InsertScalar(6,0);
$voxelScalars->InsertScalar(7,0);
$aVoxel = Graphics::VTK::Voxel->new;
$aVoxel->GetPointIds->SetId(0,0);
$aVoxel->GetPointIds->SetId(1,1);
$aVoxel->GetPointIds->SetId(2,2);
$aVoxel->GetPointIds->SetId(3,3);
$aVoxel->GetPointIds->SetId(4,4);
$aVoxel->GetPointIds->SetId(5,5);
$aVoxel->GetPointIds->SetId(6,6);
$aVoxel->GetPointIds->SetId(7,7);
$aVoxelGrid = Graphics::VTK::UnstructuredGrid->new;
$aVoxelGrid->Allocate(1,1);
$aVoxelGrid->InsertNextCell($aVoxel->GetCellType,$aVoxel->GetPointIds);
$aVoxelGrid->SetPoints($voxelPoints);
$aVoxelGrid->GetPointData->SetScalars($voxelScalars);
$voxelContours = Graphics::VTK::ContourFilter->new;
$voxelContours->SetInput($aVoxelGrid);
$voxelContours->SetValue(0,'.5');
$aVoxelContourMapper = Graphics::VTK::DataSetMapper->new;
$aVoxelContourMapper->SetInput($voxelContours->GetOutput);
$aVoxelContourMapper->ScalarVisibilityOff;
$aVoxelMapper = Graphics::VTK::DataSetMapper->new;
$aVoxelMapper->SetInput($aVoxelGrid);
$aVoxelMapper->ScalarVisibilityOff;
$aVoxelActor = Graphics::VTK::Actor->new;
$aVoxelActor->SetMapper($aVoxelMapper);
$aVoxelActor->GetProperty->SetRepresentationToWireframe;
$aVoxelContourActor = Graphics::VTK::Actor->new;
$aVoxelContourActor->SetMapper($aVoxelContourMapper);
$aVoxelContourActor->GetProperty->BackfaceCullingOn;
$hexahedronPoints = Graphics::VTK::Points->new;
$hexahedronPoints->SetNumberOfPoints(8);
$hexahedronPoints->InsertPoint(0,0,0,0);
$hexahedronPoints->InsertPoint(1,1,0,0);
$hexahedronPoints->InsertPoint(2,1,1,0);
$hexahedronPoints->InsertPoint(3,0,1,0);
$hexahedronPoints->InsertPoint(4,0,0,1);
$hexahedronPoints->InsertPoint(5,1,0,1);
$hexahedronPoints->InsertPoint(6,1,1,1);
$hexahedronPoints->InsertPoint(7,0,1,1);
$hexahedronScalars = Graphics::VTK::Scalars->new;
$hexahedronScalars->SetNumberOfScalars(8);
$hexahedronScalars->InsertScalar(0,0);
$hexahedronScalars->InsertScalar(1,1);
$hexahedronScalars->InsertScalar(2,0);
$hexahedronScalars->InsertScalar(3,0);
$hexahedronScalars->InsertScalar(4,0);
$hexahedronScalars->InsertScalar(5,0);
$hexahedronScalars->InsertScalar(6,0);
$hexahedronScalars->InsertScalar(7,0);
$aHexahedron = Graphics::VTK::Hexahedron->new;
$aHexahedron->GetPointIds->SetId(0,0);
$aHexahedron->GetPointIds->SetId(1,1);
$aHexahedron->GetPointIds->SetId(2,2);
$aHexahedron->GetPointIds->SetId(3,3);
$aHexahedron->GetPointIds->SetId(4,4);
$aHexahedron->GetPointIds->SetId(5,5);
$aHexahedron->GetPointIds->SetId(6,6);
$aHexahedron->GetPointIds->SetId(7,7);
$aHexahedronGrid = Graphics::VTK::UnstructuredGrid->new;
$aHexahedronGrid->Allocate(1,1);
$aHexahedronGrid->InsertNextCell($aHexahedron->GetCellType,$aHexahedron->GetPointIds);
$aHexahedronGrid->SetPoints($hexahedronPoints);
$aHexahedronGrid->GetPointData->SetScalars($hexahedronScalars);
$hexahedronContours = Graphics::VTK::ContourFilter->new;
$hexahedronContours->SetInput($aHexahedronGrid);
$hexahedronContours->SetValue(0,'.5');
$aHexahedronContourMapper = Graphics::VTK::DataSetMapper->new;
$aHexahedronContourMapper->SetInput($hexahedronContours->GetOutput);
$aHexahedronContourMapper->ScalarVisibilityOff;
$aHexahedronMapper = Graphics::VTK::DataSetMapper->new;
$aHexahedronMapper->SetInput($aHexahedronGrid);
$aHexahedronMapper->ScalarVisibilityOff;
$aHexahedronActor = Graphics::VTK::Actor->new;
$aHexahedronActor->SetMapper($aHexahedronMapper);
$aHexahedronActor->GetProperty->BackfaceCullingOn;
$aHexahedronActor->GetProperty->SetRepresentationToWireframe;
$aHexahedronContourActor = Graphics::VTK::Actor->new;
$aHexahedronContourActor->SetMapper($aHexahedronContourMapper);
$aHexahedronContourActor->GetProperty->BackfaceCullingOn;
$tetraPoints = Graphics::VTK::Points->new;
$tetraPoints->SetNumberOfPoints(4);
$tetraPoints->InsertPoint(0,0,0,0);
$tetraPoints->InsertPoint(1,1,0,0);
$tetraPoints->InsertPoint(2,'.5',1,0);
$tetraPoints->InsertPoint(3,'.5','.5',1);
$tetraScalars = Graphics::VTK::Scalars->new;
$tetraScalars->SetNumberOfScalars(4);
$tetraScalars->InsertScalar(0,1);
$tetraScalars->InsertScalar(1,0);
$tetraScalars->InsertScalar(2,0);
$tetraScalars->InsertScalar(3,0);
$aTetra = Graphics::VTK::Tetra->new;
$aTetra->GetPointIds->SetId(0,0);
$aTetra->GetPointIds->SetId(1,1);
$aTetra->GetPointIds->SetId(2,2);
$aTetra->GetPointIds->SetId(3,3);
$aTetraGrid = Graphics::VTK::UnstructuredGrid->new;
$aTetraGrid->Allocate(1,1);
$aTetraGrid->InsertNextCell($aTetra->GetCellType,$aTetra->GetPointIds);
$aTetraGrid->SetPoints($tetraPoints);
$aTetraGrid->GetPointData->SetScalars($tetraScalars);
$tetraContours = Graphics::VTK::ContourFilter->new;
$tetraContours->SetInput($aTetraGrid);
$tetraContours->SetValue(0,'.5');
$aTetraContourMapper = Graphics::VTK::DataSetMapper->new;
$aTetraContourMapper->SetInput($tetraContours->GetOutput);
$aTetraContourMapper->ScalarVisibilityOff;
$aTetraMapper = Graphics::VTK::DataSetMapper->new;
$aTetraMapper->SetInput($aTetraGrid);
$aTetraMapper->ScalarVisibilityOff;
$aTetraContourActor = Graphics::VTK::Actor->new;
$aTetraContourActor->SetMapper($aTetraContourMapper);
$aTetraActor = Graphics::VTK::Actor->new;
$aTetraActor->SetMapper($aTetraMapper);
$aTetraActor->GetProperty->SetRepresentationToWireframe;
$wedgePoints = Graphics::VTK::Points->new;
$wedgePoints->SetNumberOfPoints(6);
$wedgePoints->InsertPoint(0,0,1,0);
$wedgePoints->InsertPoint(1,0,0,0);
$wedgePoints->InsertPoint(2,0,'.5','.5');
$wedgePoints->InsertPoint(3,1,1,0);
$wedgePoints->InsertPoint(4,1,0,0);
$wedgePoints->InsertPoint(5,1,'.5','.5');
$wedgeScalars = Graphics::VTK::Scalars->new;
$wedgeScalars->SetNumberOfScalars(6);
$wedgeScalars->InsertScalar(0,1);
$wedgeScalars->InsertScalar(1,1);
$wedgeScalars->InsertScalar(2,0);
$wedgeScalars->InsertScalar(3,1);
$wedgeScalars->InsertScalar(4,1);
$wedgeScalars->InsertScalar(5,0);
$aWedge = Graphics::VTK::Wedge->new;
$aWedge->GetPointIds->SetId(0,0);
$aWedge->GetPointIds->SetId(1,1);
$aWedge->GetPointIds->SetId(2,2);
$aWedge->GetPointIds->SetId(3,3);
$aWedge->GetPointIds->SetId(4,4);
$aWedge->GetPointIds->SetId(5,5);
$aWedgeGrid = Graphics::VTK::UnstructuredGrid->new;
$aWedgeGrid->Allocate(1,1);
$aWedgeGrid->InsertNextCell($aWedge->GetCellType,$aWedge->GetPointIds);
$aWedgeGrid->SetPoints($wedgePoints);
$aWedgeGrid->GetPointData->SetScalars($wedgeScalars);
$wedgeContours = Graphics::VTK::ContourFilter->new;
$wedgeContours->SetInput($aWedgeGrid);
$wedgeContours->SetValue(0,'.5');
$aWedgeContourMapper = Graphics::VTK::DataSetMapper->new;
$aWedgeContourMapper->SetInput($wedgeContours->GetOutput);
$aWedgeContourMapper->ScalarVisibilityOff;
$aWedgeMapper = Graphics::VTK::DataSetMapper->new;
$aWedgeMapper->SetInput($aWedgeGrid);
$aWedgeMapper->ScalarVisibilityOff;
$aWedgeContourActor = Graphics::VTK::Actor->new;
$aWedgeContourActor->SetMapper($aWedgeContourMapper);
$aWedgeActor = Graphics::VTK::Actor->new;
$aWedgeActor->SetMapper($aWedgeMapper);
$aWedgeActor->GetProperty->SetRepresentationToWireframe;
$pyramidPoints = Graphics::VTK::Points->new;
$pyramidPoints->SetNumberOfPoints(5);
$pyramidPoints->InsertPoint(0,0,0,0);
$pyramidPoints->InsertPoint(1,1,0,0);
$pyramidPoints->InsertPoint(2,1,1,0);
$pyramidPoints->InsertPoint(3,0,1,0);
$pyramidPoints->InsertPoint(4,'.5','.5',1);
$pyramidScalars = Graphics::VTK::Scalars->new;
$pyramidScalars->SetNumberOfScalars(5);
$pyramidScalars->InsertScalar(0,1);
$pyramidScalars->InsertScalar(1,1);
$pyramidScalars->InsertScalar(2,1);
$pyramidScalars->InsertScalar(3,1);
$pyramidScalars->InsertScalar(4,0);
$aPyramid = Graphics::VTK::Pyramid->new;
$aPyramid->GetPointIds->SetId(0,0);
$aPyramid->GetPointIds->SetId(1,1);
$aPyramid->GetPointIds->SetId(2,2);
$aPyramid->GetPointIds->SetId(3,3);
$aPyramid->GetPointIds->SetId(4,4);
$aPyramidGrid = Graphics::VTK::UnstructuredGrid->new;
$aPyramidGrid->Allocate(1,1);
$aPyramidGrid->InsertNextCell($aPyramid->GetCellType,$aPyramid->GetPointIds);
$aPyramidGrid->SetPoints($pyramidPoints);
$aPyramidGrid->GetPointData->SetScalars($pyramidScalars);
$pyramidContours = Graphics::VTK::ContourFilter->new;
$pyramidContours->SetInput($aPyramidGrid);
$pyramidContours->SetValue(0,'.5');
$aPyramidContourMapper = Graphics::VTK::DataSetMapper->new;
$aPyramidContourMapper->SetInput($pyramidContours->GetOutput);
$aPyramidContourMapper->ScalarVisibilityOff;
$aPyramidMapper = Graphics::VTK::DataSetMapper->new;
$aPyramidMapper->SetInput($aPyramidGrid);
$aPyramidMapper->ScalarVisibilityOff;
$aPyramidContourActor = Graphics::VTK::Actor->new;
$aPyramidContourActor->SetMapper($aPyramidContourMapper);
$aPyramidActor = Graphics::VTK::Actor->new;
$aPyramidActor->SetMapper($aPyramidMapper);
$aPyramidActor->GetProperty->SetRepresentationToWireframe;
$pixelPoints = Graphics::VTK::Points->new;
$pixelPoints->SetNumberOfPoints(4);
$pixelPoints->InsertPoint(0,0,0,0);
$pixelPoints->InsertPoint(1,1,0,0);
$pixelPoints->InsertPoint(2,0,1,0);
$pixelPoints->InsertPoint(3,1,1,0);
$pixelScalars = Graphics::VTK::Scalars->new;
$pixelScalars->SetNumberOfScalars(4);
$pixelScalars->InsertScalar(0,1);
$pixelScalars->InsertScalar(1,0);
$pixelScalars->InsertScalar(2,0);
$pixelScalars->InsertScalar(3,0);
$aPixel = Graphics::VTK::Pixel->new;
$aPixel->GetPointIds->SetId(0,0);
$aPixel->GetPointIds->SetId(1,1);
$aPixel->GetPointIds->SetId(2,2);
$aPixel->GetPointIds->SetId(3,3);
$aPixelGrid = Graphics::VTK::UnstructuredGrid->new;
$aPixelGrid->Allocate(1,1);
$aPixelGrid->InsertNextCell($aPixel->GetCellType,$aPixel->GetPointIds);
$aPixelGrid->SetPoints($pixelPoints);
$aPixelGrid->GetPointData->SetScalars($pixelScalars);
$pixelContours = Graphics::VTK::ContourFilter->new;
$pixelContours->SetInput($aPixelGrid);
$pixelContours->SetValue(0,'.5');
$aPixelContourMapper = Graphics::VTK::DataSetMapper->new;
$aPixelContourMapper->SetInput($pixelContours->GetOutput);
$aPixelContourMapper->ScalarVisibilityOff;
$aPixelMapper = Graphics::VTK::DataSetMapper->new;
$aPixelMapper->SetInput($aPixelGrid);
$aPixelMapper->ScalarVisibilityOff;
$aPixelContourActor = Graphics::VTK::Actor->new;
$aPixelContourActor->SetMapper($aPixelContourMapper);
$aPixelActor = Graphics::VTK::Actor->new;
$aPixelActor->SetMapper($aPixelMapper);
$aPixelActor->GetProperty->BackfaceCullingOn;
$aPixelActor->GetProperty->SetRepresentationToWireframe;
$quadPoints = Graphics::VTK::Points->new;
$quadPoints->SetNumberOfPoints(4);
$quadPoints->InsertPoint(0,0,0,0);
$quadPoints->InsertPoint(1,1,0,0);
$quadPoints->InsertPoint(2,1,1,0);
$quadPoints->InsertPoint(3,0,1,0);
$quadScalars = Graphics::VTK::Scalars->new;
$quadScalars->SetNumberOfScalars(4);
$quadScalars->InsertScalar(0,1);
$quadScalars->InsertScalar(1,0);
$quadScalars->InsertScalar(2,0);
$quadScalars->InsertScalar(3,0);
$aQuad = Graphics::VTK::Quad->new;
$aQuad->GetPointIds->SetId(0,0);
$aQuad->GetPointIds->SetId(1,1);
$aQuad->GetPointIds->SetId(2,2);
$aQuad->GetPointIds->SetId(3,3);
$aQuadGrid = Graphics::VTK::UnstructuredGrid->new;
$aQuadGrid->Allocate(1,1);
$aQuadGrid->InsertNextCell($aQuad->GetCellType,$aQuad->GetPointIds);
$aQuadGrid->SetPoints($quadPoints);
$aQuadGrid->GetPointData->SetScalars($quadScalars);
$quadContours = Graphics::VTK::ContourFilter->new;
$quadContours->SetInput($aQuadGrid);
$quadContours->SetValue(0,'.5');
$aQuadContourMapper = Graphics::VTK::DataSetMapper->new;
$aQuadContourMapper->SetInput($quadContours->GetOutput);
$aQuadContourMapper->ScalarVisibilityOff;
$aQuadMapper = Graphics::VTK::DataSetMapper->new;
$aQuadMapper->SetInput($aQuadGrid);
$aQuadMapper->ScalarVisibilityOff;
$aQuadContourActor = Graphics::VTK::Actor->new;
$aQuadContourActor->SetMapper($aQuadContourMapper);
$aQuadActor = Graphics::VTK::Actor->new;
$aQuadActor->SetMapper($aQuadMapper);
$aQuadActor->GetProperty->BackfaceCullingOn;
$aQuadActor->GetProperty->SetRepresentationToWireframe;
$trianglePoints = Graphics::VTK::Points->new;
$trianglePoints->SetNumberOfPoints(3);
$trianglePoints->InsertPoint(0,0,0,0);
$trianglePoints->InsertPoint(1,1,0,0);
$trianglePoints->InsertPoint(2,'.5','.5',0);
$triangleScalars = Graphics::VTK::Scalars->new;
$triangleScalars->SetNumberOfScalars(3);
$triangleScalars->InsertScalar(0,1);
$triangleScalars->InsertScalar(1,0);
$triangleScalars->InsertScalar(2,0);
$aTriangle = Graphics::VTK::Triangle->new;
$aTriangle->GetPointIds->SetId(0,0);
$aTriangle->GetPointIds->SetId(1,1);
$aTriangle->GetPointIds->SetId(2,2);
$aTriangleGrid = Graphics::VTK::UnstructuredGrid->new;
$aTriangleGrid->Allocate(1,1);
$aTriangleGrid->InsertNextCell($aTriangle->GetCellType,$aTriangle->GetPointIds);
$aTriangleGrid->SetPoints($trianglePoints);
$aTriangleGrid->GetPointData->SetScalars($triangleScalars);
$triangleContours = Graphics::VTK::ContourFilter->new;
$triangleContours->SetInput($aTriangleGrid);
$triangleContours->SetValue(0,'.5');
$aTriangleContourMapper = Graphics::VTK::DataSetMapper->new;
$aTriangleContourMapper->SetInput($triangleContours->GetOutput);
$aTriangleContourMapper->ScalarVisibilityOff;
$aTriangleContourActor = Graphics::VTK::Actor->new;
$aTriangleContourActor->SetMapper($aTriangleContourMapper);
$aTriangleMapper = Graphics::VTK::DataSetMapper->new;
$aTriangleMapper->SetInput($aTriangleGrid);
$aTriangleMapper->ScalarVisibilityOff;
$aTriangleActor = Graphics::VTK::Actor->new;
$aTriangleActor->SetMapper($aTriangleMapper);
$aTriangleActor->GetProperty->BackfaceCullingOn;
$aTriangleActor->GetProperty->SetRepresentationToWireframe;
$polygonPoints = Graphics::VTK::Points->new;
$polygonPoints->SetNumberOfPoints(4);
$polygonPoints->InsertPoint(0,0,0,0);
$polygonPoints->InsertPoint(1,1,0,0);
$polygonPoints->InsertPoint(2,1,1,0);
$polygonPoints->InsertPoint(3,0,1,0);
$polygonScalars = Graphics::VTK::Scalars->new;
$polygonScalars->SetNumberOfScalars(4);
$polygonScalars->InsertScalar(0,1);
$polygonScalars->InsertScalar(1,0);
$polygonScalars->InsertScalar(2,0);
$polygonScalars->InsertScalar(3,0);
$aPolygon = Graphics::VTK::Polygon->new;
$aPolygon->GetPointIds->SetNumberOfIds(4);
$aPolygon->GetPointIds->SetId(0,0);
$aPolygon->GetPointIds->SetId(1,1);
$aPolygon->GetPointIds->SetId(2,2);
$aPolygon->GetPointIds->SetId(3,3);
$aPolygonGrid = Graphics::VTK::UnstructuredGrid->new;
$aPolygonGrid->Allocate(1,1);
$aPolygonGrid->InsertNextCell($aPolygon->GetCellType,$aPolygon->GetPointIds);
$aPolygonGrid->SetPoints($polygonPoints);
$aPolygonGrid->GetPointData->SetScalars($polygonScalars);
$polygonContours = Graphics::VTK::ContourFilter->new;
$polygonContours->SetInput($aPolygonGrid);
$polygonContours->SetValue(0,'.5');
$aPolygonContourMapper = Graphics::VTK::DataSetMapper->new;
$aPolygonContourMapper->SetInput($polygonContours->GetOutput);
$aPolygonContourMapper->ScalarVisibilityOff;
$aPolygonMapper = Graphics::VTK::DataSetMapper->new;
$aPolygonMapper->SetInput($aPolygonGrid);
$aPolygonMapper->ScalarVisibilityOff;
$aPolygonContourActor = Graphics::VTK::Actor->new;
$aPolygonContourActor->SetMapper($aPolygonContourMapper);
$aPolygonActor = Graphics::VTK::Actor->new;
$aPolygonActor->SetMapper($aPolygonMapper);
$aPolygonActor->GetProperty->BackfaceCullingOn;
$aPolygonActor->GetProperty->SetRepresentationToWireframe;
$triangleStripPoints = Graphics::VTK::Points->new;
$triangleStripPoints->SetNumberOfPoints(5);
$triangleStripPoints->InsertPoint(0,0,1,0);
$triangleStripPoints->InsertPoint(1,0,0,0);
$triangleStripPoints->InsertPoint(2,1,1,0);
$triangleStripPoints->InsertPoint(3,1,0,0);
$triangleStripPoints->InsertPoint(4,2,1,0);
$triangleStripScalars = Graphics::VTK::Scalars->new;
$triangleStripScalars->SetNumberOfScalars(5);
$triangleStripScalars->InsertScalar(0,1);
$triangleStripScalars->InsertScalar(1,0);
$triangleStripScalars->InsertScalar(2,0);
$triangleStripScalars->InsertScalar(3,0);
$triangleStripScalars->InsertScalar(4,0);
$aTriangleStrip = Graphics::VTK::TriangleStrip->new;
$aTriangleStrip->GetPointIds->SetNumberOfIds(5);
$aTriangleStrip->GetPointIds->SetId(0,0);
$aTriangleStrip->GetPointIds->SetId(1,1);
$aTriangleStrip->GetPointIds->SetId(2,2);
$aTriangleStrip->GetPointIds->SetId(3,3);
$aTriangleStrip->GetPointIds->SetId(4,4);
$aTriangleStripGrid = Graphics::VTK::UnstructuredGrid->new;
$aTriangleStripGrid->Allocate(1,1);
$aTriangleStripGrid->InsertNextCell($aTriangleStrip->GetCellType,$aTriangleStrip->GetPointIds);
$aTriangleStripGrid->SetPoints($triangleStripPoints);
$aTriangleStripGrid->GetPointData->SetScalars($triangleStripScalars);
$aTriangleStripMapper = Graphics::VTK::DataSetMapper->new;
$aTriangleStripMapper->SetInput($aTriangleStripGrid);
$aTriangleStripMapper->ScalarVisibilityOff;
$triangleStripContours = Graphics::VTK::ContourFilter->new;
$triangleStripContours->SetInput($aTriangleStripGrid);
$triangleStripContours->SetValue(0,'.5');
$aTriangleStripContourMapper = Graphics::VTK::DataSetMapper->new;
$aTriangleStripContourMapper->SetInput($triangleStripContours->GetOutput);
$aTriangleStripContourMapper->ScalarVisibilityOff;
$aTriangleStripContourActor = Graphics::VTK::Actor->new;
$aTriangleStripContourActor->SetMapper($aTriangleStripContourMapper);
$aTriangleStripActor = Graphics::VTK::Actor->new;
$aTriangleStripActor->SetMapper($aTriangleStripMapper);
$aTriangleStripActor->GetProperty->BackfaceCullingOn;
$aTriangleStripActor->GetProperty->SetRepresentationToWireframe;
$linePoints = Graphics::VTK::Points->new;
$linePoints->SetNumberOfPoints(2);
$linePoints->InsertPoint(0,0,0,0);
$linePoints->InsertPoint(1,1,1,0);
$lineScalars = Graphics::VTK::Scalars->new;
$lineScalars->SetNumberOfScalars(2);
$lineScalars->InsertScalar(0,1);
$lineScalars->InsertScalar(1,0);
$aLine = Graphics::VTK::Line->new;
$aLine->GetPointIds->SetId(0,0);
$aLine->GetPointIds->SetId(1,1);
$aLineGrid = Graphics::VTK::UnstructuredGrid->new;
$aLineGrid->Allocate(1,1);
$aLineGrid->InsertNextCell($aLine->GetCellType,$aLine->GetPointIds);
$aLineGrid->SetPoints($linePoints);
$aLineGrid->GetPointData->SetScalars($lineScalars);
$lineContours = Graphics::VTK::ContourFilter->new;
$lineContours->SetInput($aLineGrid);
$lineContours->SetValue(0,'.5');
$aLineContourMapper = Graphics::VTK::DataSetMapper->new;
$aLineContourMapper->SetInput($lineContours->GetOutput);
$aLineContourMapper->ScalarVisibilityOff;
$aLineContourActor = Graphics::VTK::Actor->new;
$aLineContourActor->SetMapper($aLineContourMapper);
$aLineMapper = Graphics::VTK::DataSetMapper->new;
$aLineMapper->SetInput($aLineGrid);
$aLineMapper->ScalarVisibilityOff;
$aLineActor = Graphics::VTK::Actor->new;
$aLineActor->SetMapper($aLineMapper);
$aLineActor->GetProperty->BackfaceCullingOn;
$aLineActor->GetProperty->SetRepresentationToWireframe;
$polyLinePoints = Graphics::VTK::Points->new;
$polyLinePoints->SetNumberOfPoints(3);
$polyLinePoints->InsertPoint(0,0,0,0);
$polyLinePoints->InsertPoint(1,1,1,0);
$polyLinePoints->InsertPoint(2,1,0,0);
$polyLineScalars = Graphics::VTK::Scalars->new;
$polyLineScalars->SetNumberOfScalars(3);
$polyLineScalars->InsertScalar(0,1);
$polyLineScalars->InsertScalar(1,0);
$polyLineScalars->InsertScalar(2,0);
$aPolyLine = Graphics::VTK::PolyLine->new;
$aPolyLine->GetPointIds->SetNumberOfIds(3);
$aPolyLine->GetPointIds->SetId(0,0);
$aPolyLine->GetPointIds->SetId(1,1);
$aPolyLine->GetPointIds->SetId(2,2);
$aPolyLineGrid = Graphics::VTK::UnstructuredGrid->new;
$aPolyLineGrid->Allocate(1,1);
$aPolyLineGrid->InsertNextCell($aPolyLine->GetCellType,$aPolyLine->GetPointIds);
$aPolyLineGrid->SetPoints($polyLinePoints);
$aPolyLineGrid->GetPointData->SetScalars($polyLineScalars);
$polyLineContours = Graphics::VTK::ContourFilter->new;
$polyLineContours->SetInput($aPolyLineGrid);
$polyLineContours->SetValue(0,'.5');
$aPolyLineContourMapper = Graphics::VTK::DataSetMapper->new;
$aPolyLineContourMapper->SetInput($polyLineContours->GetOutput);
$aPolyLineContourMapper->ScalarVisibilityOff;
$aPolyLineContourActor = Graphics::VTK::Actor->new;
$aPolyLineContourActor->SetMapper($aPolyLineContourMapper);
$aPolyLineMapper = Graphics::VTK::DataSetMapper->new;
$aPolyLineMapper->SetInput($aPolyLineGrid);
$aPolyLineMapper->ScalarVisibilityOff;
$aPolyLineActor = Graphics::VTK::Actor->new;
$aPolyLineActor->SetMapper($aPolyLineMapper);
$aPolyLineActor->GetProperty->BackfaceCullingOn;
$aPolyLineActor->GetProperty->SetRepresentationToWireframe;
$vertexPoints = Graphics::VTK::Points->new;
$vertexPoints->SetNumberOfPoints(1);
$vertexPoints->InsertPoint(0,0,0,0);
$vertexScalars = Graphics::VTK::Scalars->new;
$vertexScalars->SetNumberOfScalars(1);
$vertexScalars->InsertScalar(0,1);
$aVertex = Graphics::VTK::Vertex->new;
$aVertex->GetPointIds->SetId(0,0);
$aVertexGrid = Graphics::VTK::UnstructuredGrid->new;
$aVertexGrid->Allocate(1,1);
$aVertexGrid->InsertNextCell($aVertex->GetCellType,$aVertex->GetPointIds);
$aVertexGrid->SetPoints($vertexPoints);
$aVertexGrid->GetPointData->SetScalars($vertexScalars);
$vertexContours = Graphics::VTK::ContourFilter->new;
$vertexContours->SetInput($aVertexGrid);
$vertexContours->SetValue(0,1);
$aVertexContourMapper = Graphics::VTK::DataSetMapper->new;
$aVertexContourMapper->SetInput($vertexContours->GetOutput);
$aVertexContourMapper->ScalarVisibilityOff;
$aVertexContourActor = Graphics::VTK::Actor->new;
$aVertexContourActor->SetMapper($aVertexContourMapper);
$aVertexContourActor->GetProperty->SetRepresentationToWireframe;
$aVertexMapper = Graphics::VTK::DataSetMapper->new;
$aVertexMapper->SetInput($aVertexGrid);
$aVertexMapper->ScalarVisibilityOff;
$aVertexActor = Graphics::VTK::Actor->new;
$aVertexActor->SetMapper($aVertexMapper);
$aVertexActor->GetProperty->BackfaceCullingOn;
$polyVertexPoints = Graphics::VTK::Points->new;
$polyVertexPoints->SetNumberOfPoints(3);
$polyVertexPoints->InsertPoint(0,0,0,0);
$polyVertexPoints->InsertPoint(1,1,0,0);
$polyVertexPoints->InsertPoint(2,1,1,0);
$polyVertexScalars = Graphics::VTK::Scalars->new;
$polyVertexScalars->SetNumberOfScalars(3);
$polyVertexScalars->InsertScalar(0,1);
$polyVertexScalars->InsertScalar(1,0);
$polyVertexScalars->InsertScalar(2,0);
$aPolyVertex = Graphics::VTK::PolyVertex->new;
$aPolyVertex->GetPointIds->SetNumberOfIds(3);
$aPolyVertex->GetPointIds->SetId(0,0);
$aPolyVertex->GetPointIds->SetId(1,1);
$aPolyVertex->GetPointIds->SetId(2,2);
$aPolyVertexGrid = Graphics::VTK::UnstructuredGrid->new;
$aPolyVertexGrid->Allocate(1,1);
$aPolyVertexGrid->InsertNextCell($aPolyVertex->GetCellType,$aPolyVertex->GetPointIds);
$aPolyVertexGrid->SetPoints($polyVertexPoints);
$aPolyVertexGrid->GetPointData->SetScalars($polyVertexScalars);
$polyVertexContours = Graphics::VTK::ContourFilter->new;
$polyVertexContours->SetInput($aPolyVertexGrid);
$polyVertexContours->SetValue(0,0);
$aPolyVertexContourMapper = Graphics::VTK::DataSetMapper->new;
$aPolyVertexContourMapper->SetInput($polyVertexContours->GetOutput);
$aPolyVertexContourMapper->ScalarVisibilityOff;
$aPolyVertexContourActor = Graphics::VTK::Actor->new;
$aPolyVertexContourActor->SetMapper($aPolyVertexContourMapper);
$aPolyVertexContourActor->GetProperty->SetRepresentationToWireframe;
$aPolyVertexMapper = Graphics::VTK::DataSetMapper->new;
$aPolyVertexMapper->SetInput($aPolyVertexGrid);
$aPolyVertexMapper->ScalarVisibilityOff;
$aPolyVertexActor = Graphics::VTK::Actor->new;
$aPolyVertexActor->SetMapper($aPolyVertexMapper);
$ren1->SetBackground('.1','.2','.3');
$renWin->SetSize(500,500);
$ren1->AddActor('aVoxelActor');
$aVoxelActor->GetProperty->SetDiffuseColor(1,0,0);
$ren1->AddActor('aVoxelContourActor');
$aVoxelContourActor->GetProperty->SetDiffuseColor(1,0,0);
$ren1->AddActor('aHexahedronActor');
$aHexahedronActor->GetProperty->SetDiffuseColor(1,1,0);
$ren1->AddActor('aHexahedronContourActor');
$aHexahedronContourActor->GetProperty->SetDiffuseColor(1,1,0);
$ren1->AddActor('aTetraActor');
$aTetraActor->GetProperty->SetDiffuseColor(0,1,0);
$ren1->AddActor('aTetraContourActor');
$aTetraContourActor->GetProperty->SetDiffuseColor(0,1,0);
$ren1->AddActor('aWedgeActor');
$aWedgeActor->GetProperty->SetDiffuseColor(0,1,1);
$ren1->AddActor('aWedgeContourActor');
$aWedgeContourActor->GetProperty->SetDiffuseColor(0,1,1);
$ren1->AddActor('aPyramidActor');
$aPyramidActor->GetProperty->SetDiffuseColor(1,0,1);
$ren1->AddActor('aPyramidContourActor');
$aPyramidContourActor->GetProperty->SetDiffuseColor(1,0,1);
$ren1->AddActor('aPixelActor');
$aPixelActor->GetProperty->SetDiffuseColor(0,1,1);
$ren1->AddActor('aPixelContourActor');
$aPixelContourActor->GetProperty->SetDiffuseColor(0,1,1);
$ren1->AddActor('aQuadActor');
$aQuadActor->GetProperty->SetDiffuseColor(1,0,1);
$ren1->AddActor('aQuadContourActor');
$aQuadContourActor->GetProperty->SetDiffuseColor(1,0,1);
$ren1->AddActor('aTriangleActor');
$aTriangleActor->GetProperty->SetDiffuseColor('.3',1,'.5');
$ren1->AddActor('aTriangleContourActor');
$aTriangleContourActor->GetProperty->SetDiffuseColor('.3',1,'.5');
$ren1->AddActor('aPolygonActor');
$aPolygonActor->GetProperty->SetDiffuseColor(1,'.4','.5');
$ren1->AddActor('aPolygonContourActor');
$aPolygonContourActor->GetProperty->SetDiffuseColor(1,'.4','.5');
$ren1->AddActor('aTriangleStripActor');
$aTriangleStripActor->GetProperty->SetDiffuseColor('.3','.7',1);
$ren1->AddActor('aTriangleStripContourActor');
$aTriangleStripContourActor->GetProperty->SetDiffuseColor('.3','.7',1);
$ren1->AddActor('aLineActor');
$aLineActor->GetProperty->SetDiffuseColor('.2',1,1);
$ren1->AddActor('aLineContourActor');
$aLineContourActor->GetProperty->SetDiffuseColor('.2',1,1);
$ren1->AddActor('aPolyLineActor');
$aPolyLineActor->GetProperty->SetDiffuseColor(1,1,1);
$ren1->AddActor('aPolyLineContourActor');
$aPolyLineContourActor->GetProperty->SetDiffuseColor(1,1,1);
$ren1->AddActor('aVertexContourActor');
$aVertexContourActor->GetProperty->SetDiffuseColor(1,1,1);
$ren1->AddActor('aVertexActor');
$aVertexActor->GetProperty->SetDiffuseColor(1,1,1);
$ren1->AddActor('aPolyVertexContourActor');
$aPolyVertexContourActor->GetProperty->SetDiffuseColor(1,1,1);
$ren1->AddActor('aPolyVertexActor');
$aPolyVertexActor->GetProperty->SetDiffuseColor(1,1,1);
# places everyone!!
$aVoxelContourActor->AddPosition(0,0,0);
$aVoxelContourActor->AddPosition(0,2,0);
$aHexahedronContourActor->AddPosition(2,0,0);
$aHexahedronContourActor->AddPosition(0,2,0);
$aHexahedronActor->AddPosition(2,0,0);
$aTetraContourActor->AddPosition(4,0,0);
$aTetraContourActor->AddPosition(0,2,0);
$aTetraActor->AddPosition(4,0,0);
$aWedgeContourActor->AddPosition(6,0,0);
$aWedgeContourActor->AddPosition(0,2,0);
$aWedgeActor->AddPosition(6,0,0);
$aPyramidContourActor->AddPosition(8,0,0);
$aPyramidContourActor->AddPosition(0,2,0);
$aPyramidActor->AddPosition(8,0,0);
$aPixelContourActor->AddPosition(0,4,0);
$aPixelContourActor->AddPosition(0,2,0);
$aPixelActor->AddPosition(0,4,0);
$aQuadContourActor->AddPosition(2,4,0);
$aQuadContourActor->AddPosition(0,2,0);
$aQuadActor->AddPosition(2,4,0);
$aTriangleContourActor->AddPosition(4,4,0);
$aTriangleContourActor->AddPosition(0,2,0);
$aTriangleActor->AddPosition(4,4,0);
$aPolygonContourActor->AddPosition(6,4,0);
$aPolygonContourActor->AddPosition(0,2,0);
$aPolygonActor->AddPosition(6,4,0);
$aTriangleStripContourActor->AddPosition(8,4,0);
$aTriangleStripContourActor->AddPosition(0,2,0);
$aTriangleStripActor->AddPosition(8,4,0);
$aLineContourActor->AddPosition(0,8,0);
$aLineContourActor->AddPosition(0,2,0);
$aLineActor->AddPosition(0,8,0);
$aPolyLineContourActor->AddPosition(2,8,0);
$aPolyLineContourActor->AddPosition(0,2,0);
$aPolyLineActor->AddPosition(2,8,0);
$aVertexContourActor->AddPosition(0,12,0);
$aVertexContourActor->AddPosition(0,2,0);
$aVertexActor->AddPosition(0,12,0);
$aPolyVertexContourActor->AddPosition(2,12,0);
$aPolyVertexContourActor->AddPosition(0,2,0);
$aPolyVertexActor->AddPosition(2,12,0);
$source->backdrop_tcl;
$BuildBackdrop->_1(11,-1,16,-1,2,'.1');
$ren1->AddActor('base');
$base->GetProperty->SetDiffuseColor('.2','.2','.2');
$ren1->AddActor('left');
$left->GetProperty->SetDiffuseColor('.2','.2','.2');
$ren1->AddActor('back');
$back->GetProperty->SetDiffuseColor('.2','.2','.2');
$ren1->GetActiveCamera->Dolly(1.5);
$ren1->ResetCameraClippingRange;
$renWin->Render;
# render the image
$iren->SetUserMethod(
 sub
  {
   $MW->{'.vtkInteract'}->deiconify;
  }
);
$iren->Initialize;
$MW->withdraw;
#renWin SetFileName "contourCells.tcl.ppm"
#renWin SaveImageAsPPM
Graphics::VTK::Tk::vtkInt::vtkInteract($MW);

Tk->MainLoop;
