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 
46 #ifndef __vtkUnstructuredGridPreIntegration_h
47 #define __vtkUnstructuredGridPreIntegration_h
48 
50 
51 class vtkVolumeProperty;
52 
54 {
55 public:
59  virtual void PrintSelf(ostream &os, vtkIndent indent);
60 
61  virtual void Initialize(vtkVolume *volume, vtkDataArray *scalars);
62 
63  virtual void Integrate(vtkDoubleArray *intersectionLengths,
64  vtkDataArray *nearIntersections,
65  vtkDataArray *farIntersections,
66  float color[4]);
67 
69 
71  vtkGetObjectMacro(Integrator, vtkUnstructuredGridVolumeRayIntegrator);
72  virtual void SetIntegrator(vtkUnstructuredGridVolumeRayIntegrator *);
74 
76 
77  vtkSetMacro(IntegrationTableScalarResolution, int);
78  vtkGetMacro(IntegrationTableScalarResolution, int);
79  vtkSetMacro(IntegrationTableLengthResolution, int);
80  vtkGetMacro(IntegrationTableLengthResolution, int);
82 
84 
85  virtual double GetIntegrationTableScalarShift(int component = 0);
86  virtual double GetIntegrationTableScalarScale(int component = 0);
87  virtual double GetIntegrationTableLengthScale();
89 
91 
95  vtkGetMacro(IncrementalPreIntegration, int);
96  vtkSetMacro(IncrementalPreIntegration, int);
97  vtkBooleanMacro(IncrementalPreIntegration, int);
99 
109  virtual float *GetPreIntegrationTable(int component = 0);
110 
112 
114  float *GetTableEntry(double scalar_front, double scalar_back, double lenth,
115  int component = 0);
117 
119 
122  float *GetIndexedTableEntry(int scalar_front_index, int scalar_back_index,
123  int length_index, int component = 0);
125 
126 protected:
129 
131 
134  double MaxLength;
135 
142 
145 
147 
148  virtual void BuildPreIntegrationTables(vtkDataArray *scalars);
149 
150 private:
152  void operator=(const vtkUnstructuredGridPreIntegration&); // Not implemented
153 };
154 
156  int scalar_front_index,
157  int scalar_back_index,
158  int length_index,
159  int component)
160 {
161  // Snap entries to bounds. I don't really want to spend cycles doing
162  // this, but I've had the ray caster give me values that are noticeably
163  // out of bounds.
164  if (scalar_front_index < 0) scalar_front_index = 0;
165  if (scalar_front_index >= this->IntegrationTableScalarResolution)
166  scalar_front_index = this->IntegrationTableScalarResolution - 1;
167  if (scalar_back_index < 0) scalar_back_index = 0;
168  if (scalar_back_index >= this->IntegrationTableScalarResolution)
169  scalar_back_index = this->IntegrationTableScalarResolution - 1;
170  if (length_index < 0) length_index = 0;
171  if (length_index >= this->IntegrationTableLengthResolution)
172  length_index = this->IntegrationTableLengthResolution - 1;
173 
174  return ( this->IntegrationTable[component]
175  + 4*( ( ( length_index*this->IntegrationTableScalarResolution
176  + scalar_back_index)
178  + scalar_front_index));
179 }
180 
182  double scalar_front, double scalar_back, double length, int component)
183 {
184  int sfi = static_cast<int>( scalar_front
186  + this->IntegrationTableScalarShift[component] + 0.5);
187  int sbi = static_cast<int>( scalar_back*this->IntegrationTableScalarScale[component]
188  + this->IntegrationTableScalarShift[component] + 0.5);
189  int li = static_cast<int>(length*this->IntegrationTableLengthScale + 0.5);
190  return this->GetIndexedTableEntry(sfi, sbi, li, component);
191 }
192 
193 #endif //__vtkUnstructuredGridPreIntegration_h
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:48
float * GetIndexedTableEntry(int scalar_front_index, int scalar_back_index, int length_index, int component=0)
virtual void Initialize(vtkVolume *volume, vtkDataArray *scalars)=0
vtkUnstructuredGridVolumeRayIntegrator * Integrator
record modification and/or execution time
Definition: vtkTimeStamp.h:33
#define VTK_VOLUMERENDERING_EXPORT
dynamic, self-adjusting array of double
a superclass for volume ray integration functions
float * GetTableEntry(double scalar_front, double scalar_back, double lenth, int component=0)
a simple class to control print indentation
Definition: vtkIndent.h:37
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:53
performs ray integration with pre-integration tables.
represents the common properties for rendering a volume.
virtual void PrintSelf(ostream &os, vtkIndent indent)
static vtkObject * New()
virtual void Integrate(vtkDoubleArray *intersectionLengths, vtkDataArray *nearIntersections, vtkDataArray *farIntersections, float color[4])=0