<commit_before>import vtkFullScreenRenderWindow from '../../../Sources/Rendering/Misc/FullScreenRenderWindow';
import vtk                       from '../../../Sources/vtk';
import vtkActor                  from '../../../Sources/Rendering/Core/Actor';
import vtkMapper                 from '../../../Sources/Rendering/Core/Mapper';

// ----------------------------------------------------------------------------
// Standard rendering code setup
// ----------------------------------------------------------------------------

const fullScreenRenderer = vtkFullScreenRenderWindow.newInstance({ background: [0, 0, 0] });
const renderer = fullScreenRenderer.getRenderer();
const renderWindow = fullScreenRenderer.getRenderWindow();

// ----------------------------------------------------------------------------
// Inline PolyData definition
// ----------------------------------------------------------------------------

const polydata = vtk({
  vtkClass: 'vtkPolyData',
  points: {
    vtkClass: 'vtkPoints',
    data: {
      vtkClass: 'vtkDataArray',
      dataType: 'Float32Array',
      numberOfComponents: 3,
      values: [
        0, 0, 0,
        1, 0, 0.25,
        1, 1, 0,
        0, 1, 0.25,
      ],
    },
  },
  polys: {
    vtkClass: 'vtkDataArray',
    dataType: 'Uint16Array',
    values: [
      3, 0, 1, 2,
      3, 0, 2, 3,
    ],
  },
  pointData: {
    vtkClass: 'vtkDataSetAttributes',
    activeScalars: 0,
    arrays: [{
      data: {
        vtkClass: 'vtkDataArray',
        name: 'pointScalars',
        dataType: 'Float32Array',
        values: [0, 1, 0, 2],
      },
    }],
  },
  cellData: {
    vtkClass: 'vtkDataSetAttributes',
    activeScalars: 0,
    arrays: [{
      data: {
        vtkClass: 'vtkDataArray',
        name: 'cellScalars',
        dataType: 'Float32Array',
        values: [0, 1],
      },
    }],
  },
});

const mapper = vtkMapper.newInstance({ interpolateScalarBeforeMapping: true });
mapper.setInputData(polydata);

const lut = mapper.getLookupTable();
lut.setHueRange(0.666, 0);

const actor = vtkActor.newInstance();
actor.setMapper(mapper);

renderer.addActor(actor);
renderer.resetCamera();
renderWindow.render();

// -----------------------------------------------------------
// Make some variables global so that you can inspect and
// modify objects in your browser's developer console:
// -----------------------------------------------------------

global.source = polydata;
global.mapper = mapper;
global.actor = actor;
global.lut = lut;
global.renderer = renderer;
global.renderWindow = renderWindow;
<commit_msg>docs(PolyDataExample): Fix typo in interpolateScalarsBeforeMapping<commit_after>import vtkFullScreenRenderWindow from '../../../Sources/Rendering/Misc/FullScreenRenderWindow';
import vtk                       from '../../../Sources/vtk';
import vtkActor                  from '../../../Sources/Rendering/Core/Actor';
import vtkMapper                 from '../../../Sources/Rendering/Core/Mapper';

// ----------------------------------------------------------------------------
// Standard rendering code setup
// ----------------------------------------------------------------------------

const fullScreenRenderer = vtkFullScreenRenderWindow.newInstance({ background: [0, 0, 0] });
const renderer = fullScreenRenderer.getRenderer();
const renderWindow = fullScreenRenderer.getRenderWindow();

// ----------------------------------------------------------------------------
// Inline PolyData definition
// ----------------------------------------------------------------------------

const polydata = vtk({
  vtkClass: 'vtkPolyData',
  points: {
    vtkClass: 'vtkPoints',
    data: {
      vtkClass: 'vtkDataArray',
      dataType: 'Float32Array',
      numberOfComponents: 3,
      values: [
        0, 0, 0,
        1, 0, 0.25,
        1, 1, 0,
        0, 1, 0.25,
      ],
    },
  },
  polys: {
    vtkClass: 'vtkDataArray',
    dataType: 'Uint16Array',
    values: [
      3, 0, 1, 2,
      3, 0, 2, 3,
    ],
  },
  pointData: {
    vtkClass: 'vtkDataSetAttributes',
    activeScalars: 0,
    arrays: [{
      data: {
        vtkClass: 'vtkDataArray',
        name: 'pointScalars',
        dataType: 'Float32Array',
        values: [0, 1, 0, 2],
      },
    }],
  },
  cellData: {
    vtkClass: 'vtkDataSetAttributes',
    activeScalars: 0,
    arrays: [{
      data: {
        vtkClass: 'vtkDataArray',
        name: 'cellScalars',
        dataType: 'Float32Array',
        values: [0, 1],
      },
    }],
  },
});

const mapper = vtkMapper.newInstance({ interpolateScalarsBeforeMapping: true });
mapper.setInputData(polydata);

const lut = mapper.getLookupTable();
lut.setHueRange(0.666, 0);

const actor = vtkActor.newInstance();
actor.setMapper(mapper);

renderer.addActor(actor);
renderer.resetCamera();
renderWindow.render();

// -----------------------------------------------------------
// Make some variables global so that you can inspect and
// modify objects in your browser's developer console:
// -----------------------------------------------------------

global.source = polydata;
global.mapper = mapper;
global.actor = actor;
global.lut = lut;
global.renderer = renderer;
global.renderWindow = renderWindow;

{'fraction_non_alphanumeric': 0.28349923430321594, 'fraction_numerical': 0.01875957120980092, 'mean_word_length': 1.537639630888781, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7045422', 'n_tokens_mistral': 1484, 'n_tokens_neox': 1434, 'n_words': 322}