VTK
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
47#ifndef vtkUnstructuredGridPreIntegration_h
48#define vtkUnstructuredGridPreIntegration_h
49
50#include "vtkRenderingVolumeModule.h" // For export macro
52
54
56{
57public:
61 virtual void PrintSelf(ostream &os, vtkIndent indent);
62
63 virtual void Initialize(vtkVolume *volume, vtkDataArray *scalars);
64
65 virtual void Integrate(vtkDoubleArray *intersectionLengths,
66 vtkDataArray *nearIntersections,
67 vtkDataArray *farIntersections,
68 float color[4]);
69
71
75 vtkGetObjectMacro(Integrator, vtkUnstructuredGridVolumeRayIntegrator);
78
80
83 vtkSetMacro(IntegrationTableScalarResolution, int);
84 vtkGetMacro(IntegrationTableScalarResolution, int);
85 vtkSetMacro(IntegrationTableLengthResolution, int);
86 vtkGetMacro(IntegrationTableLengthResolution, int);
88
90
97
99
105 vtkGetMacro(IncrementalPreIntegration, int);
106 vtkSetMacro(IncrementalPreIntegration, int);
107 vtkBooleanMacro(IncrementalPreIntegration, int);
109
121 virtual float *GetPreIntegrationTable(int component = 0);
122
127 float *GetTableEntry(double scalar_front, double scalar_back, double lenth,
128 int component = 0);
129
135 float *GetIndexedTableEntry(int scalar_front_index, int scalar_back_index,
136 int length_index, int component = 0);
137
138protected:
141
143
146 double MaxLength;
147
154
157
159
161
162private:
164 void operator=(const vtkUnstructuredGridPreIntegration&) VTK_DELETE_FUNCTION;
165};
166
168 int scalar_front_index,
169 int scalar_back_index,
170 int length_index,
171 int component)
172{
173 // Snap entries to bounds. I don't really want to spend cycles doing
174 // this, but I've had the ray caster give me values that are noticeably
175 // out of bounds.
176 if (scalar_front_index < 0) scalar_front_index = 0;
177 if (scalar_front_index >= this->IntegrationTableScalarResolution)
178 scalar_front_index = this->IntegrationTableScalarResolution - 1;
179 if (scalar_back_index < 0) scalar_back_index = 0;
180 if (scalar_back_index >= this->IntegrationTableScalarResolution)
181 scalar_back_index = this->IntegrationTableScalarResolution - 1;
182 if (length_index < 0) length_index = 0;
183 if (length_index >= this->IntegrationTableLengthResolution)
184 length_index = this->IntegrationTableLengthResolution - 1;
185
186 return ( this->IntegrationTable[component]
187 + 4*( ( ( length_index*this->IntegrationTableScalarResolution
188 + scalar_back_index)
190 + scalar_front_index));
191}
192
194 double scalar_front, double scalar_back, double length, int component)
195{
196 int sfi = static_cast<int>( scalar_front
199 int sbi = static_cast<int>( scalar_back*this->IntegrationTableScalarScale[component]
201 int li = static_cast<int>(length*this->IntegrationTableLengthScale + 0.5);
202 return this->GetIndexedTableEntry(sfi, sbi, li, component);
203}
204
205#endif //vtkUnstructuredGridPreIntegration_h
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
dynamic, self-adjusting array of double
a simple class to control print indentation
Definition: vtkIndent.h:40
record modification and/or execution time
Definition: vtkTimeStamp.h:36
performs ray integration with pre-integration tables.
virtual void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
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...
static vtkUnstructuredGridPreIntegration * New()
virtual double GetIntegrationTableScalarScale(int component=0)
float * GetTableEntry(double scalar_front, double scalar_back, double lenth, 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()
virtual float * GetPreIntegrationTable(int component=0)
Get the partial pre-integration table for the given scalar component.
virtual void BuildPreIntegrationTables(vtkDataArray *scalars)
virtual void SetIntegrator(vtkUnstructuredGridVolumeRayIntegrator *)
virtual void Integrate(vtkDoubleArray *intersectionLengths, vtkDataArray *nearIntersections, vtkDataArray *farIntersections, float color[4])
Given a set of intersections (defined by the three arrays), compute the peicewise integration of the ...
virtual void Initialize(vtkVolume *volume, vtkDataArray *scalars)
Set up the integrator with the given properties and scalars.
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:51
@ component
Definition: vtkX3D.h:175
@ length
Definition: vtkX3D.h:393
@ color
Definition: vtkX3D.h:221
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.