// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen // SPDX-License-Identifier: BSD-3-Clause #include "vtkActor.h" #include "vtkCamera.h" #include "vtkInteractorStyleTrackballCamera.h" #include "vtkNew.h" #include "vtkPointData.h" #include "vtkPolyData.h" #include "vtkPolyDataMapper.h" #include "vtkProperty.h" #include "vtkRegressionTestImage.h" #include "vtkRenderWindow.h" #include "vtkRenderWindowInteractor.h" #include "vtkRenderer.h" #include "vtkScalarsToColors.h" #include "vtkUnsignedCharArray.h" int TestQuadPointRep(int argc, char* argv[]) { vtkNew renWin; renWin->SetWindowName(__func__); renWin->SetMultiSamples(0); vtkNew renderer; renWin->AddRenderer(renderer); vtkNew polydata; vtkNew points; points->InsertPoint(0, -1, -1, 1); points->InsertPoint(1, 1, -1, 1); points->InsertPoint(2, -1, 1, 1); points->InsertPoint(3, 1, 1, 1); polydata->SetPoints(points); vtkNew quad; quad->InsertNextCell({ 0, 1, 3, 2 }); polydata->SetPolys(quad); vtkNew colors; colors->SetNumberOfComponents(4); colors->SetNumberOfTuples(3); colors->InsertComponent(0, 0, 255); colors->InsertComponent(0, 1, 0); colors->InsertComponent(0, 2, 0); colors->InsertComponent(0, 3, 255); colors->InsertComponent(1, 0, 0); colors->InsertComponent(1, 1, 255); colors->InsertComponent(1, 2, 0); colors->InsertComponent(1, 3, 255); colors->InsertComponent(2, 0, 0); colors->InsertComponent(2, 1, 0); colors->InsertComponent(2, 2, 255); colors->InsertComponent(2, 3, 255); colors->InsertComponent(3, 0, 255); colors->InsertComponent(3, 1, 255); colors->InsertComponent(3, 2, 0); colors->InsertComponent(3, 3, 255); polydata->GetPointData()->SetScalars(colors); vtkNew mapper; mapper->DebugOn(); mapper->SetInputData(polydata); vtkNew actor; actor->SetMapper(mapper); actor->GetProperty()->SetPointSize(8); actor->GetProperty()->SetRepresentationToPoints(); renderer->AddActor(actor); renderer->ResetCamera(); renderer->SetBackground(0.2, 0.3, 0.4); vtkNew iren; iren->SetRenderWindow(renWin); vtkNew style; iren->SetInteractorStyle(style); style->SetDefaultRenderer(renderer); renWin->Render(); const int retVal = vtkRegressionTestImage(renWin); if (retVal == vtkRegressionTester::DO_INTERACTOR) { iren->Start(); } return !retVal; }