00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00059 #ifndef __vtkUnstructuredGridBunykRayCastFunction_h
00060 #define __vtkUnstructuredGridBunykRayCastFunction_h
00061
00062 #include "vtkUnstructuredGridVolumeRayCastFunction.h"
00063
00064 class vtkRenderer;
00065 class vtkVolume;
00066 class vtkUnstructuredGridVolumeRayCastMapper;
00067 class vtkMatrix4x4;
00068 class vtkPiecewiseFunction;
00069 class vtkColorTransferFunction;
00070 class vtkUnstructuredGrid;
00071 class vtkIdList;
00072 class vtkDoubleArray;
00073 class vtkDataArray;
00074
00075
00076
00077
00078 #define VTK_BUNYKRCF_MAX_ARRAYS 10000
00079 #define VTK_BUNYKRCF_ARRAY_SIZE 10000
00080
00081 class VTK_VOLUMERENDERING_EXPORT vtkUnstructuredGridBunykRayCastFunction : public vtkUnstructuredGridVolumeRayCastFunction
00082 {
00083 public:
00084 static vtkUnstructuredGridBunykRayCastFunction *New();
00085 vtkTypeRevisionMacro(vtkUnstructuredGridBunykRayCastFunction,vtkUnstructuredGridVolumeRayCastFunction);
00086 virtual void PrintSelf(ostream& os, vtkIndent indent);
00087
00088
00090 virtual void Initialize( vtkRenderer *ren, vtkVolume *vol );
00091
00093 virtual void Finalize();
00094
00095 virtual vtkUnstructuredGridVolumeRayCastIterator *NewIterator();
00096
00097
00098
00099 class Triangle {
00100 public:
00101 vtkIdType PointIndex[3];
00102 vtkIdType ReferredByTetra[2];
00103 double P1X, P1Y;
00104 double P2X, P2Y;
00105 double Denominator;
00106 double A, B, C, D;
00107 Triangle *Next;
00108 };
00109
00110
00111
00112 class Intersection {
00113 public:
00114 Triangle *TriPtr;
00115 double Z;
00116 Intersection *Next;
00117 };
00118
00120
00122 int InTriangle( double x, double y,
00123 Triangle *triPtr );
00125
00126
00128 double *GetPoints() {return this->Points;}
00129
00131
00132 vtkGetObjectMacro( ViewToWorldMatrix, vtkMatrix4x4 );
00134
00136
00137 vtkGetVectorMacro( ImageOrigin, int, 2 );
00139
00141
00142 vtkGetVectorMacro( ImageViewportSize, int, 2 );
00144
00146 Triangle **GetTetraTriangles () {return this->TetraTriangles;}
00147
00149 Intersection *GetIntersectionList( int x, int y ) { return this->Image[y*this->ImageSize[0] + x]; }
00150
00151
00152
00153 protected:
00154 vtkUnstructuredGridBunykRayCastFunction();
00155 ~vtkUnstructuredGridBunykRayCastFunction();
00156
00157
00158
00159 vtkRenderer *Renderer;
00160 vtkVolume *Volume;
00161 vtkUnstructuredGridVolumeRayCastMapper *Mapper;
00162
00163
00164
00165
00166 int Valid;
00167
00168
00169 int NumberOfPoints;
00170 double *Points;
00171
00172
00173
00174 vtkMatrix4x4 *ViewToWorldMatrix;
00175
00176
00177
00178 Intersection **Image;
00179
00180
00181
00182 int ImageSize[2];
00183
00184
00185
00186
00187
00188
00189 int ImageOrigin[2];
00190
00191
00192 int ImageViewportSize[2];
00193
00194
00195
00196 vtkUnstructuredGrid *SavedTriangleListInput;
00197 vtkTimeStamp SavedTriangleListMTime;
00198
00199
00200
00201
00202
00203
00204
00205
00206 Triangle **TetraTriangles;
00207 Triangle *TriangleList;
00208
00209
00210
00211
00212
00213 int IsTriangleFrontFacing( Triangle *triPtr, vtkIdType tetraIndex );
00214
00215
00216
00217
00218 void ClearImage();
00219
00220
00221
00222
00223 Intersection *IntersectionBuffer[VTK_BUNYKRCF_MAX_ARRAYS];
00224 int IntersectionBufferCount[VTK_BUNYKRCF_MAX_ARRAYS];
00225
00226
00227
00228
00229 void *NewIntersection();
00230
00231
00232
00233
00234
00235 int CheckValidity(vtkRenderer *ren,
00236 vtkVolume *vol);
00237
00238
00239
00240 void TransformPoints();
00241
00242
00243
00244 void UpdateTriangleList();
00245
00246
00247
00248 void ComputeViewDependentInfo();
00249
00250
00251
00252
00253 void ComputePixelIntersections();
00254
00255
00256
00257 private:
00258 vtkUnstructuredGridBunykRayCastFunction(const vtkUnstructuredGridBunykRayCastFunction&);
00259 void operator=(const vtkUnstructuredGridBunykRayCastFunction&);
00260 };
00261
00262 #endif
00263
00264
00265
00266
00267
00268
00269