MantisBT - VTK | |||||
| View Issue Details | |||||
| ID | Project | Category | View Status | Date Submitted | Last Update |
| 0001625 | VTK | (No Category) | public | 2005-02-28 12:04 | 2016-08-12 09:54 |
| Reporter | John Norris | ||||
| Assigned To | Kitware Robot | ||||
| Priority | normal | Severity | major | Reproducibility | always |
| Status | closed | Resolution | moved | ||
| Platform | OS | OS Version | |||
| Product Version | |||||
| Target Version | Fixed in Version | ||||
| Project | |||||
| Type | |||||
| Summary | 0001625: vtkAppendPolyData scrambles cell data in certain cases | ||||
| Description | With certain inputs, vtkAppendPolyData fails to combine cell data properly. In the example code below, we start with a vtkPolyData generated by vtkSurfaceDataFilter from a simple vtkStructuredPoints. This is clipped with vtkClipPolyData and cut with vtkCutter. The results of these two are appended together, but the cell data isn't processed correctly. When CLIP is #defined to 0, you see the unclipped surface. When CLIP is 1, you see the clipped (and erronously colored) surface. /////////////////////////////////////////////// #include <vtkActor.h> #include <vtkAppendPolyData.h> #include <vtkCellData.h> #include <vtkClipPolyData.h> #include <vtkCutter.h> #include <vtkDataSetSurfaceFilter.h> #include <vtkFloatArray.h> #include <vtkOutlineFilter.h> #include <vtkPlane.h> #include <vtkPolyDataMapper.h> #include <vtkProperty.h> #include <vtkRenderer.h> #include <vtkRenderWindow.h> #include <vtkRenderWindowInteractor.h> #include <vtkScalarBarActor.h> #include <vtkScalarsToColors.h> #include <vtkStructuredPoints.h> #define CLIP 0 int main() { vtkFloatArray* pData = vtkFloatArray::New(); pData->SetNumberOfValues(5); pData->SetValue(0, 0.f); pData->SetValue(1, 1.f); pData->SetValue(2, 2.f); pData->SetValue(3, 1.f); pData->SetValue(4, 0.f); vtkStructuredPoints* pGrid = vtkStructuredPoints::New(); pGrid->SetDimensions(6, 2, 2); pGrid->GetCellData()->SetScalars(pData); pData->Delete(); vtkDataSetSurfaceFilter* pSurface = vtkDataSetSurfaceFilter::New(); pSurface->SetInput(pGrid); vtkPlane* pPlane = vtkPlane::New(); pPlane->SetOrigin(2.5, 0.0, 0.0); pPlane->SetNormal(1.0, 0.0, 0.0); vtkClipPolyData* pClipper = vtkClipPolyData::New(); pClipper->SetInput(pSurface->GetOutput()); pClipper->SetClipFunction(pPlane); vtkCutter* pCutter = vtkCutter::New(); pCutter->SetInput(pSurface->GetOutput()); pCutter->SetCutFunction(pPlane); pPlane->Delete(); vtkAppendPolyData* pAppender = vtkAppendPolyData::New(); #if CLIP pAppender->AddInput(pClipper->GetOutput()); pAppender->AddInput(pCutter->GetOutput()); #else pAppender->AddInput(pSurface->GetOutput()); #endif // CLIP pSurface->Delete(); pClipper->Delete(); pCutter->Delete(); vtkPolyDataMapper* pMapper = vtkPolyDataMapper::New(); pMapper->SetInput(pAppender->GetOutput()); pMapper->SetScalarRange(0.0, 2.0); vtkScalarBarActor* pSB = vtkScalarBarActor::New(); pMapper->CreateDefaultLookupTable(); pSB->SetLookupTable(pMapper->GetLookupTable()); vtkActor* pActor = vtkActor::New(); pActor->SetMapper(pMapper); pMapper->Delete(); vtkRenderer* pRenderer = vtkRenderer::New(); pRenderer->AddActor(pActor); pActor->Delete(); pRenderer->AddActor(pSB); pSB->Delete(); vtkOutlineFilter* pOutline = vtkOutlineFilter::New(); pOutline->SetInput(pGrid); pGrid->Delete(); pMapper = vtkPolyDataMapper::New(); pMapper->SetInput(pOutline->GetOutput()); pOutline->Delete(); pActor = vtkActor::New(); pActor->SetMapper(pMapper); pActor->GetProperty()->SetColor(1.0, 1.0, 1.0); pMapper->Delete(); pRenderer->AddActor(pActor); pActor->Delete(); vtkRenderWindow* pWindow = vtkRenderWindow::New(); pWindow->AddRenderer(pRenderer); pRenderer->Delete(); vtkRenderWindowInteractor* pInteractor = vtkRenderWindowInteractor::New(); pInteractor->SetRenderWindow(pWindow); pWindow->Delete(); pInteractor->Start(); pInteractor->Delete(); return 0; } | ||||
| Steps To Reproduce | |||||
| Additional Information | |||||
| Tags | No tags attached. | ||||
| Relationships | |||||
| Attached Files | |||||
| Issue History | |||||
| Date Modified | Username | Field | Change | ||
| 2008-11-30 09:22 | Mathieu Malaterre | Assigned To | Mathieu Malaterre => François Bertel | ||
| 2008-11-30 20:18 | François Bertel | Assigned To | François Bertel => | ||
| 2008-12-26 18:41 | Basel | Note Added: 0014444 | |||
| 2011-06-16 13:11 | Zack Galbreath | Category | => (No Category) | ||
| 2016-08-12 09:54 | Kitware Robot | Note Added: 0036771 | |||
| 2016-08-12 09:54 | Kitware Robot | Status | expired => closed | ||
| 2016-08-12 09:54 | Kitware Robot | Resolution | open => moved | ||
| 2016-08-12 09:54 | Kitware Robot | Assigned To | => Kitware Robot | ||
| Notes | |||||
|
|
|||||
|
|
||||
|
|
|||||
|
|
||||