<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>VTK: dox/VolumeRendering/vtkUnstructuredGridPreIntegration.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.6 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="classes.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <h1>dox/VolumeRendering/vtkUnstructuredGridPreIntegration.h</h1><a href="a03630.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*=========================================================================</span> <a name="l00002"></a>00002 <span class="comment"></span> <a name="l00003"></a>00003 <span class="comment"> Program: Visualization Toolkit</span> <a name="l00004"></a>00004 <span class="comment"> Module: $RCSfile: vtkUnstructuredGridPreIntegration.h,v $</span> <a name="l00005"></a>00005 <span class="comment"></span> <a name="l00006"></a>00006 <span class="comment"> Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen</span> <a name="l00007"></a>00007 <span class="comment"> All rights reserved.</span> <a name="l00008"></a>00008 <span class="comment"> See Copyright.txt or http://www.kitware.com/Copyright.htm for details.</span> <a name="l00009"></a>00009 <span class="comment"></span> <a name="l00010"></a>00010 <span class="comment"> This software is distributed WITHOUT ANY WARRANTY; without even</span> <a name="l00011"></a>00011 <span class="comment"> the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR</span> <a name="l00012"></a>00012 <span class="comment"> PURPOSE. See the above copyright notice for more information.</span> <a name="l00013"></a>00013 <span class="comment"></span> <a name="l00014"></a>00014 <span class="comment">=========================================================================*/</span> <a name="l00015"></a>00015 <a name="l00016"></a>00016 <span class="comment">/*</span> <a name="l00017"></a>00017 <span class="comment"> * Copyright 2004 Sandia Corporation.</span> <a name="l00018"></a>00018 <span class="comment"> * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive</span> <a name="l00019"></a>00019 <span class="comment"> * license for use of this work by or on behalf of the</span> <a name="l00020"></a>00020 <span class="comment"> * U.S. Government. Redistribution and use in source and binary forms, with</span> <a name="l00021"></a>00021 <span class="comment"> * or without modification, are permitted provided that this Notice and any</span> <a name="l00022"></a>00022 <span class="comment"> * statement of authorship are reproduced on all copies.</span> <a name="l00023"></a>00023 <span class="comment"> */</span> <a name="l00024"></a>00024 <a name="l00046"></a>00046 <span class="preprocessor">#ifndef __vtkUnstructuredGridPreIntegration_h</span> <a name="l00047"></a>00047 <span class="preprocessor"></span><span class="preprocessor">#define __vtkUnstructuredGridPreIntegration_h</span> <a name="l00048"></a>00048 <span class="preprocessor"></span> <a name="l00049"></a>00049 <span class="preprocessor">#include "<a class="code" href="a03635.html">vtkUnstructuredGridVolumeRayIntegrator.h</a>"</span> <a name="l00050"></a>00050 <a name="l00051"></a>00051 <span class="keyword">class </span><a class="code" href="a01844.html" title="represents the common properties for rendering a volume.">vtkVolumeProperty</a>; <a name="l00052"></a>00052 <a name="l00053"></a><a class="code" href="a01798.html">00053</a> <span class="keyword">class </span><a class="code" href="a02170.html#4c512a1c00e5052ca1bbef09929dba95">VTK_VOLUMERENDERING_EXPORT</a> <a class="code" href="a01798.html" title="performs ray integration with pre-integration tables.">vtkUnstructuredGridPreIntegration</a> : <span class="keyword">public</span> <a class="code" href="a01807.html" title="a superclass for volume ray integration functions">vtkUnstructuredGridVolumeRayIntegrator</a> <a name="l00054"></a>00054 { <a name="l00055"></a>00055 <span class="keyword">public</span>: <a name="l00056"></a>00056 vtkTypeRevisionMacro(<a class="code" href="a01798.html" title="performs ray integration with pre-integration tables.">vtkUnstructuredGridPreIntegration</a>, <a name="l00057"></a><a class="code" href="a01798.html#517762ffe7a57fecb17bcb3a9627c740">00057</a> <a class="code" href="a01807.html" title="a superclass for volume ray integration functions">vtkUnstructuredGridVolumeRayIntegrator</a>); <a name="l00058"></a>00058 <span class="keyword">static</span> <a class="code" href="a01798.html" title="performs ray integration with pre-integration tables.">vtkUnstructuredGridPreIntegration</a> *<a class="code" href="a01084.html#4d5b227267c076d6f9e38483370b6612">New</a>(); <a name="l00059"></a>00059 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="a01807.html#c1f0c958c64ef2d20c3950fa70eba003">PrintSelf</a>(ostream &os, <a class="code" href="a00869.html" title="a simple class to control print indentation">vtkIndent</a> indent); <a name="l00060"></a>00060 <a name="l00061"></a>00061 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="a01807.html#1bf6fd3d88e2dcb7710f28b3d5de405d">Initialize</a>(<a class="code" href="a01839.html" title="represents a volume (data &amp; properties) in a rendered scene">vtkVolume</a> *volume, <a class="code" href="a00356.html" title="abstract superclass for arrays of numeric data">vtkDataArray</a> *scalars); <a name="l00062"></a>00062 <a name="l00063"></a>00063 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="a01807.html#a0ddf237a4541d9e21389b5e6cb26d2d">Integrate</a>(<a class="code" href="a00436.html" title="dynamic, self-adjusting array of double">vtkDoubleArray</a> *intersectionLengths, <a name="l00064"></a>00064 <a class="code" href="a00356.html" title="abstract superclass for arrays of numeric data">vtkDataArray</a> *nearIntersections, <a name="l00065"></a>00065 <a class="code" href="a00356.html" title="abstract superclass for arrays of numeric data">vtkDataArray</a> *farIntersections, <a name="l00066"></a>00066 <span class="keywordtype">float</span> <a class="code" href="a03761.html#c6551f7bf833e8254b2b3ecdaea0d210ab06a058f9ffb559855ff8495aa7e53e">color</a>[4]); <a name="l00067"></a>00067 <a name="l00069"></a>00069 <a name="l00071"></a>00071 vtkGetObjectMacro(Integrator, <a class="code" href="a01807.html" title="a superclass for volume ray integration functions">vtkUnstructuredGridVolumeRayIntegrator</a>); <a name="l00072"></a>00072 <span class="keyword">virtual</span> <span class="keywordtype">void</span> SetIntegrator(<a class="code" href="a01807.html" title="a superclass for volume ray integration functions">vtkUnstructuredGridVolumeRayIntegrator</a> *); <a name="l00074"></a>00074 <a name="l00076"></a>00076 <a name="l00077"></a>00077 vtkSetMacro(IntegrationTableScalarResolution, <span class="keywordtype">int</span>); <a name="l00078"></a>00078 vtkGetMacro(IntegrationTableScalarResolution, <span class="keywordtype">int</span>); <a name="l00079"></a>00079 vtkSetMacro(IntegrationTableLengthResolution, <span class="keywordtype">int</span>); <a name="l00080"></a>00080 vtkGetMacro(IntegrationTableLengthResolution, <span class="keywordtype">int</span>); <a name="l00082"></a>00082 <a name="l00084"></a>00084 <a name="l00085"></a>00085 <span class="keyword">virtual</span> <span class="keywordtype">double</span> GetIntegrationTableScalarShift(<span class="keywordtype">int</span> <a class="code" href="a03761.html#88ade42854f67d6297898362e17a515f78fb09245c9bd345bf96d579664f9736">component</a> = 0); <a name="l00086"></a>00086 <span class="keyword">virtual</span> <span class="keywordtype">double</span> GetIntegrationTableScalarScale(<span class="keywordtype">int</span> <a class="code" href="a03761.html#88ade42854f67d6297898362e17a515f78fb09245c9bd345bf96d579664f9736">component</a> = 0); <a name="l00087"></a>00087 <span class="keyword">virtual</span> <span class="keywordtype">double</span> GetIntegrationTableLengthScale(); <a name="l00089"></a>00089 <a name="l00091"></a>00091 <a name="l00095"></a>00095 vtkGetMacro(IncrementalPreIntegration, <span class="keywordtype">int</span>); <a name="l00096"></a>00096 vtkSetMacro(IncrementalPreIntegration, <span class="keywordtype">int</span>); <a name="l00097"></a>00097 vtkBooleanMacro(IncrementalPreIntegration, <span class="keywordtype">int</span>); <a name="l00099"></a>00099 <a name="l00109"></a>00109 <span class="keyword">virtual</span> <span class="keywordtype">float</span> *GetPreIntegrationTable(<span class="keywordtype">int</span> <a class="code" href="a03761.html#88ade42854f67d6297898362e17a515f78fb09245c9bd345bf96d579664f9736">component</a> = 0); <a name="l00110"></a>00110 <a name="l00112"></a>00112 <a name="l00114"></a>00114 <span class="keywordtype">float</span> *GetTableEntry(<span class="keywordtype">double</span> scalar_front, <span class="keywordtype">double</span> scalar_back, <span class="keywordtype">double</span> lenth, <a name="l00115"></a>00115 <span class="keywordtype">int</span> <a class="code" href="a03761.html#88ade42854f67d6297898362e17a515f78fb09245c9bd345bf96d579664f9736">component</a> = 0); <a name="l00117"></a>00117 <a name="l00119"></a>00119 <a name="l00122"></a>00122 <span class="keywordtype">float</span> *GetIndexedTableEntry(<span class="keywordtype">int</span> scalar_front_index, <span class="keywordtype">int</span> scalar_back_index, <a name="l00123"></a>00123 <span class="keywordtype">int</span> length_index, <span class="keywordtype">int</span> <a class="code" href="a03761.html#88ade42854f67d6297898362e17a515f78fb09245c9bd345bf96d579664f9736">component</a> = 0); <a name="l00125"></a>00125 <a name="l00126"></a>00126 <span class="keyword">protected</span>: <a name="l00127"></a>00127 <a class="code" href="a01798.html" title="performs ray integration with pre-integration tables.">vtkUnstructuredGridPreIntegration</a>(); <a name="l00128"></a>00128 ~<a class="code" href="a01798.html" title="performs ray integration with pre-integration tables.">vtkUnstructuredGridPreIntegration</a>(); <a name="l00129"></a>00129 <a name="l00130"></a><a class="code" href="a01798.html#f79bf00a109313a0dcb7955cbbf47fba">00130</a> <a class="code" href="a01807.html" title="a superclass for volume ray integration functions">vtkUnstructuredGridVolumeRayIntegrator</a> *Integrator; <a name="l00131"></a>00131 <a name="l00132"></a><a class="code" href="a01798.html#28f0bf8ee99c5171a6f4bf718b8499e0">00132</a> <a class="code" href="a01839.html" title="represents a volume (data &amp; properties) in a rendered scene">vtkVolume</a> *Volume; <a name="l00133"></a><a class="code" href="a01798.html#5abb2960ffb003fd47d609e043bfa984">00133</a> <a class="code" href="a01844.html" title="represents the common properties for rendering a volume.">vtkVolumeProperty</a> *Property; <a name="l00134"></a><a class="code" href="a01798.html#1fe74f0e9e9fe3fa87ae3ceee2e5406e">00134</a> <span class="keywordtype">double</span> MaxLength; <a name="l00135"></a>00135 <a name="l00136"></a><a class="code" href="a01798.html#f08ea1081645dc8c5b6a37b04876172d">00136</a> <span class="keywordtype">int</span> NumComponents; <a name="l00137"></a><a class="code" href="a01798.html#6c1a15f7eb138a34ee089a125de506e8">00137</a> <span class="keywordtype">float</span> **IntegrationTable; <a name="l00138"></a><a class="code" href="a01798.html#2fa8a793ed0d00a72337d90b7565a8e8">00138</a> <span class="keywordtype">double</span> *IntegrationTableScalarShift; <a name="l00139"></a><a class="code" href="a01798.html#96ceec43c2e9f12566cc63938e6c3b04">00139</a> <span class="keywordtype">double</span> *IntegrationTableScalarScale; <a name="l00140"></a><a class="code" href="a01798.html#289e71ae9f32243c7952500b546d88af">00140</a> <span class="keywordtype">double</span> IntegrationTableLengthScale; <a name="l00141"></a><a class="code" href="a01798.html#0c2162232ee641f803d83457edeba54e">00141</a> <a class="code" href="a01719.html" title="record modification and/or execution time">vtkTimeStamp</a> IntegrationTableBuilt; <a name="l00142"></a>00142 <a name="l00143"></a><a class="code" href="a01798.html#5a2834597bec29e54f419dad4a941bd5">00143</a> <span class="keywordtype">int</span> IntegrationTableScalarResolution; <a name="l00144"></a><a class="code" href="a01798.html#437941d4dc1e7caee0b497d5ae2dfdb5">00144</a> <span class="keywordtype">int</span> IntegrationTableLengthResolution; <a name="l00145"></a>00145 <a name="l00146"></a><a class="code" href="a01798.html#79ca94952e5bd83bea2faf1128fee30d">00146</a> <span class="keywordtype">int</span> IncrementalPreIntegration; <a name="l00147"></a>00147 <a name="l00148"></a>00148 <span class="keyword">virtual</span> <span class="keywordtype">void</span> BuildPreIntegrationTables(<a class="code" href="a00356.html" title="abstract superclass for arrays of numeric data">vtkDataArray</a> *scalars); <a name="l00149"></a>00149 <a name="l00150"></a>00150 <span class="keyword">private</span>: <a name="l00151"></a>00151 <a class="code" href="a01798.html" title="performs ray integration with pre-integration tables.">vtkUnstructuredGridPreIntegration</a>(<span class="keyword">const</span> <a class="code" href="a01798.html" title="performs ray integration with pre-integration tables.">vtkUnstructuredGridPreIntegration</a>&); <span class="comment">// Not implemented.</span> <a name="l00152"></a>00152 <span class="keywordtype">void</span> operator=(<span class="keyword">const</span> <a class="code" href="a01798.html" title="performs ray integration with pre-integration tables.">vtkUnstructuredGridPreIntegration</a>&); <span class="comment">// Not implemented</span> <a name="l00153"></a>00153 }; <a name="l00154"></a>00154 <a name="l00155"></a><a class="code" href="a01798.html#1b3ac3e0a128a6e512f5aad5343f1d75">00155</a> <span class="keyword">inline</span> <span class="keywordtype">float</span> *<a class="code" href="a01798.html#1b3ac3e0a128a6e512f5aad5343f1d75">vtkUnstructuredGridPreIntegration::GetIndexedTableEntry</a>( <a name="l00156"></a>00156 <span class="keywordtype">int</span> scalar_front_index, <a name="l00157"></a>00157 <span class="keywordtype">int</span> scalar_back_index, <a name="l00158"></a>00158 <span class="keywordtype">int</span> length_index, <a name="l00159"></a>00159 <span class="keywordtype">int</span> <a class="code" href="a03761.html#88ade42854f67d6297898362e17a515f78fb09245c9bd345bf96d579664f9736">component</a>) <a name="l00160"></a>00160 { <a name="l00161"></a>00161 <span class="comment">// Snap entries to bounds. I don't really want to spend cycles doing</span> <a name="l00162"></a>00162 <span class="comment">// this, but I've had the ray caster give me values that are noticeably</span> <a name="l00163"></a>00163 <span class="comment">// out of bounds.</span> <a name="l00164"></a>00164 <span class="keywordflow">if</span> (scalar_front_index < 0) scalar_front_index = 0; <a name="l00165"></a>00165 <span class="keywordflow">if</span> (scalar_front_index >= this-><a class="code" href="a01798.html#5a2834597bec29e54f419dad4a941bd5">IntegrationTableScalarResolution</a>) <a name="l00166"></a>00166 scalar_front_index = this-><a class="code" href="a01798.html#5a2834597bec29e54f419dad4a941bd5">IntegrationTableScalarResolution</a> - 1; <a name="l00167"></a>00167 <span class="keywordflow">if</span> (scalar_back_index < 0) scalar_back_index = 0; <a name="l00168"></a>00168 <span class="keywordflow">if</span> (scalar_back_index >= this-><a class="code" href="a01798.html#5a2834597bec29e54f419dad4a941bd5">IntegrationTableScalarResolution</a>) <a name="l00169"></a>00169 scalar_back_index = this-><a class="code" href="a01798.html#5a2834597bec29e54f419dad4a941bd5">IntegrationTableScalarResolution</a> - 1; <a name="l00170"></a>00170 <span class="keywordflow">if</span> (length_index < 0) length_index = 0; <a name="l00171"></a>00171 <span class="keywordflow">if</span> (length_index >= this-><a class="code" href="a01798.html#437941d4dc1e7caee0b497d5ae2dfdb5">IntegrationTableLengthResolution</a>) <a name="l00172"></a>00172 length_index = this-><a class="code" href="a01798.html#437941d4dc1e7caee0b497d5ae2dfdb5">IntegrationTableLengthResolution</a> - 1; <a name="l00173"></a>00173 <a name="l00174"></a>00174 <span class="keywordflow">return</span> ( this-><a class="code" href="a01798.html#6c1a15f7eb138a34ee089a125de506e8">IntegrationTable</a>[component] <a name="l00175"></a>00175 + 4*( ( ( length_index*this-><a class="code" href="a01798.html#5a2834597bec29e54f419dad4a941bd5">IntegrationTableScalarResolution</a> <a name="l00176"></a>00176 + scalar_back_index) <a name="l00177"></a>00177 * this-><a class="code" href="a01798.html#5a2834597bec29e54f419dad4a941bd5">IntegrationTableScalarResolution</a>) <a name="l00178"></a>00178 + scalar_front_index)); <a name="l00179"></a>00179 } <a name="l00180"></a>00180 <a name="l00181"></a><a class="code" href="a01798.html#52748418fe18137598dfb60467a168d1">00181</a> <span class="keyword">inline</span> <span class="keywordtype">float</span> *<a class="code" href="a01798.html#52748418fe18137598dfb60467a168d1">vtkUnstructuredGridPreIntegration::GetTableEntry</a>( <a name="l00182"></a>00182 <span class="keywordtype">double</span> scalar_front, <span class="keywordtype">double</span> scalar_back, <span class="keywordtype">double</span> <a class="code" href="a03761.html#c6551f7bf833e8254b2b3ecdaea0d21042c5d76c3275f5d17bc1b329d83ab003">length</a>, <span class="keywordtype">int</span> <a class="code" href="a03761.html#88ade42854f67d6297898362e17a515f78fb09245c9bd345bf96d579664f9736">component</a>) <a name="l00183"></a>00183 { <a name="l00184"></a>00184 <span class="keywordtype">int</span> sfi = <span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>( scalar_front <a name="l00185"></a>00185 *this-><a class="code" href="a01798.html#96ceec43c2e9f12566cc63938e6c3b04">IntegrationTableScalarScale</a>[component] <a name="l00186"></a>00186 + this-><a class="code" href="a01798.html#2fa8a793ed0d00a72337d90b7565a8e8">IntegrationTableScalarShift</a>[component] + 0.5); <a name="l00187"></a>00187 <span class="keywordtype">int</span> sbi = <span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>( scalar_back*this-><a class="code" href="a01798.html#96ceec43c2e9f12566cc63938e6c3b04">IntegrationTableScalarScale</a>[component] <a name="l00188"></a>00188 + this-><a class="code" href="a01798.html#2fa8a793ed0d00a72337d90b7565a8e8">IntegrationTableScalarShift</a>[component] + 0.5); <a name="l00189"></a>00189 <span class="keywordtype">int</span> li = <span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(length*this-><a class="code" href="a01798.html#289e71ae9f32243c7952500b546d88af">IntegrationTableLengthScale</a> + 0.5); <a name="l00190"></a>00190 <span class="keywordflow">return</span> this-><a class="code" href="a01798.html#1b3ac3e0a128a6e512f5aad5343f1d75">GetIndexedTableEntry</a>(sfi, sbi, li, component); <a name="l00191"></a>00191 } <a name="l00192"></a>00192 <a name="l00193"></a>00193 <span class="preprocessor">#endif //__vtkUnstructuredGridPreIntegration_h</span> </pre></div></div> <hr size="1"><address style="text-align: right;"><small>Generated on Wed Jun 3 18:35:51 2009 for VTK by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address> </body> </html>