VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkBox.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00033 #ifndef __vtkBox_h 00034 #define __vtkBox_h 00035 00036 #include "vtkImplicitFunction.h" 00037 class vtkBoundingBox; 00038 00039 class VTK_COMMON_EXPORT vtkBox : public vtkImplicitFunction 00040 { 00041 public: 00042 vtkTypeMacro(vtkBox,vtkImplicitFunction); 00043 void PrintSelf(ostream& os, vtkIndent indent); 00044 00046 static vtkBox *New(); 00047 00049 00050 double EvaluateFunction(double x[3]); 00051 double EvaluateFunction(double x, double y, double z) 00052 {return this->vtkImplicitFunction::EvaluateFunction(x, y, z); } 00054 00056 void EvaluateGradient(double x[3], double n[3]); 00057 00059 00060 void SetXMin(double p[3]); 00061 void SetXMin(double x, double y, double z); 00062 void GetXMin(double p[3]); 00063 void GetXMin(double &x, double &y, double &z); 00065 00066 void SetXMax(double p[3]); 00067 void SetXMax(double x, double y, double z); 00068 void GetXMax(double p[3]); 00069 void GetXMax(double &x, double &y, double &z); 00070 00071 void SetBounds(double xMin, double xMax, 00072 double yMin, double yMax, 00073 double zMin, double zMax); 00074 void SetBounds(double bounds[6]); 00075 void GetBounds(double &xMin, double &xMax, 00076 double &yMin, double &yMax, 00077 double &zMin, double &zMax); 00078 void GetBounds(double bounds[6]); 00079 double *GetBounds(); 00080 00085 void AddBounds(double bounds[6]); 00086 00088 00095 static char IntersectBox(double bounds[6], double origin[3], double dir[3], 00096 double coord[3], double& t); 00098 00100 00110 static int IntersectWithLine(const double bounds[6], 00111 const double p1[3], const double p2[3], 00112 double &t1, double &t2, 00113 double x1[3], double x2[3], 00114 int &plane1, int &plane2); 00116 00117 protected: 00118 vtkBox(); 00119 ~vtkBox(); 00120 00121 vtkBoundingBox *BBox; 00122 double Bounds[6]; //supports the GetBounds() method 00123 00124 private: 00125 vtkBox(const vtkBox&); // Not implemented. 00126 void operator=(const vtkBox&); // Not implemented. 00127 }; 00128 00129 00130 00131 inline void vtkBox::SetXMin(double p[3]) 00132 { 00133 this->SetXMin(p[0], p[1], p[2]); 00134 } 00135 00136 inline void vtkBox::SetXMax(double p[3]) 00137 { 00138 this->SetXMax(p[0], p[1], p[2]); 00139 } 00140 00141 00142 #endif 00143 00144