VTK  9.1.0
vtkUnstructuredGridPreIntegration.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkUnstructuredGridPreIntegration.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
15
16/*
17 * Copyright 2004 Sandia Corporation.
18 * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
19 * license for use of this work by or on behalf of the
20 * U.S. Government. Redistribution and use in source and binary forms, with
21 * or without modification, are permitted provided that this Notice and any
22 * statement of authorship are reproduced on all copies.
23 */
24
44#ifndef vtkUnstructuredGridPreIntegration_h
45#define vtkUnstructuredGridPreIntegration_h
46
47#include "vtkRenderingVolumeModule.h" // For export macro
49
51
52class VTKRENDERINGVOLUME_EXPORT vtkUnstructuredGridPreIntegration
54{
55public:
58 void PrintSelf(ostream& os, vtkIndent indent) override;
59
60 void Initialize(vtkVolume* volume, vtkDataArray* scalars) override;
61
62 void Integrate(vtkDoubleArray* intersectionLengths, vtkDataArray* nearIntersections,
63 vtkDataArray* farIntersections, float color[4]) override;
64
66
70 vtkGetObjectMacro(Integrator, vtkUnstructuredGridVolumeRayIntegrator);
73
75
78 vtkSetMacro(IntegrationTableScalarResolution, int);
79 vtkGetMacro(IntegrationTableScalarResolution, int);
80 vtkSetMacro(IntegrationTableLengthResolution, int);
81 vtkGetMacro(IntegrationTableLengthResolution, int);
83
85
92
94
100 vtkGetMacro(IncrementalPreIntegration, vtkTypeBool);
101 vtkSetMacro(IncrementalPreIntegration, vtkTypeBool);
102 vtkBooleanMacro(IncrementalPreIntegration, vtkTypeBool);
104
116 virtual float* GetPreIntegrationTable(int component = 0);
117
122 float* GetTableEntry(double scalar_front, double scalar_back, double length, int component = 0);
123
129 float* GetIndexedTableEntry(
130 int scalar_front_index, int scalar_back_index, int length_index, int component = 0);
131
132protected:
135
137
140 double MaxLength;
141
148
151
153
155
156private:
158 void operator=(const vtkUnstructuredGridPreIntegration&) = delete;
159};
160
162 int scalar_front_index, int scalar_back_index, int length_index, int component)
163{
164 // Snap entries to bounds. I don't really want to spend cycles doing
165 // this, but I've had the ray caster give me values that are noticeably
166 // out of bounds.
167 if (scalar_front_index < 0)
168 scalar_front_index = 0;
169 if (scalar_front_index >= this->IntegrationTableScalarResolution)
170 scalar_front_index = this->IntegrationTableScalarResolution - 1;
171 if (scalar_back_index < 0)
172 scalar_back_index = 0;
173 if (scalar_back_index >= this->IntegrationTableScalarResolution)
174 scalar_back_index = this->IntegrationTableScalarResolution - 1;
175 if (length_index < 0)
176 length_index = 0;
177 if (length_index >= this->IntegrationTableLengthResolution)
178 length_index = this->IntegrationTableLengthResolution - 1;
179
180 return (this->IntegrationTable[component] +
181 4 *
182 (((length_index * this->IntegrationTableScalarResolution + scalar_back_index) *
184 scalar_front_index));
185}
186
188 double scalar_front, double scalar_back, double length, int component)
189{
190 int sfi = static_cast<int>(scalar_front * this->IntegrationTableScalarScale[component] +
192 int sbi = static_cast<int>(scalar_back * this->IntegrationTableScalarScale[component] +
194 int li = static_cast<int>(length * this->IntegrationTableLengthScale + 0.5);
195 return this->GetIndexedTableEntry(sfi, sbi, li, component);
196}
197
198#endif // vtkUnstructuredGridPreIntegration_h
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:159
dynamic, self-adjusting array of double
a simple class to control print indentation
Definition: vtkIndent.h:113
record modification and/or execution time
Definition: vtkTimeStamp.h:52
performs ray integration with pre-integration tables.
float * GetIndexedTableEntry(int scalar_front_index, int scalar_back_index, int length_index, int component=0)
Like GetTableEntry, except the inputs are scaled indices into the table rather than than the actual s...
void Integrate(vtkDoubleArray *intersectionLengths, vtkDataArray *nearIntersections, vtkDataArray *farIntersections, float color[4]) override
Given a set of intersections (defined by the three arrays), compute the piecewise integration of the ...
static vtkUnstructuredGridPreIntegration * New()
virtual double GetIntegrationTableScalarScale(int component=0)
Get how an integration table is indexed.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
float * GetTableEntry(double scalar_front, double scalar_back, double length, int component=0)
Get an entry (RGBA) in one of the pre-integration tables.
virtual double GetIntegrationTableScalarShift(int component=0)
Get how an integration table is indexed.
virtual double GetIntegrationTableLengthScale()
Get how an integration table is indexed.
virtual float * GetPreIntegrationTable(int component=0)
Get the partial pre-integration table for the given scalar component.
virtual void BuildPreIntegrationTables(vtkDataArray *scalars)
void Initialize(vtkVolume *volume, vtkDataArray *scalars) override
Set up the integrator with the given properties and scalars.
virtual void SetIntegrator(vtkUnstructuredGridVolumeRayIntegrator *)
The class used to fill the pre integration table.
vtkUnstructuredGridVolumeRayIntegrator * Integrator
a superclass for volume ray integration functions
represents the common properties for rendering a volume.
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:134
@ component
Definition: vtkX3D.h:181
@ length
Definition: vtkX3D.h:399
@ color
Definition: vtkX3D.h:227
int vtkTypeBool
Definition: vtkABI.h:69