MCPcopy Create free account
hub / github.com/Kitware/VTK / Initialize

Method Initialize

Rendering/Volume/vtkUnstructuredGridPreIntegration.cxx:330–367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

328//------------------------------------------------------------------------------
329
330void vtkUnstructuredGridPreIntegration::Initialize(vtkVolume* volume, vtkDataArray* scalars)
331{
332 vtkVolumeProperty* property = volume->GetProperty();
333
334 if ((property == this->Property) && (this->IntegrationTableBuilt > property->GetMTime()) &&
335 (this->IntegrationTableBuilt > this->MTime))
336 {
337 // Nothing changed from the last time Initialize was run.
338 return;
339 }
340
341 this->Property = property;
342 this->Volume = volume;
343 this->IntegrationTableBuilt.Modified();
344
345 if (!property->GetIndependentComponents())
346 {
347 vtkErrorMacro("Cannot store dependent components in pre-integration table.");
348 return;
349 }
350
351 // Determine the maximum possible length of a ray segment.
352 vtkDataSet* input = volume->GetMapper()->GetDataSetInput();
353 vtkIdType numcells = input->GetNumberOfCells();
354 this->MaxLength = 0;
355 for (vtkIdType i = 0; i < numcells; i++)
356 {
357 double cellbounds[6];
358 input->GetCellBounds(i, cellbounds);
359#define SQR(x) ((x) * (x))
360 double diagonal_length = sqrt(SQR(cellbounds[1] - cellbounds[0]) +
361 SQR(cellbounds[3] - cellbounds[2]) + SQR(cellbounds[5] - cellbounds[4]));
362#undef SQR
363 this->MaxLength = std::max(diagonal_length, this->MaxLength);
364 }
365
366 this->BuildPreIntegrationTables(scalars);
367}
368
369//------------------------------------------------------------------------------
370

Callers 1

Calls 10

GetMapperMethod · 0.80
sqrtFunction · 0.50
maxFunction · 0.50
GetPropertyMethod · 0.45
GetMTimeMethod · 0.45
ModifiedMethod · 0.45
GetDataSetInputMethod · 0.45
GetNumberOfCellsMethod · 0.45
GetCellBoundsMethod · 0.45

Tested by

no test coverage detected