VTK
dox/Common/DataModel/vtkBox.h
Go to the documentation of this file.
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 "vtkCommonDataModelModule.h" // For export macro
00037 #include "vtkImplicitFunction.h"
00038 class vtkBoundingBox;
00039 
00040 class VTKCOMMONDATAMODEL_EXPORT vtkBox : public vtkImplicitFunction
00041 {
00042 public:
00043   vtkTypeMacro(vtkBox,vtkImplicitFunction);
00044   void PrintSelf(ostream& os, vtkIndent indent);
00045 
00047   static vtkBox *New();
00048 
00050 
00051   double EvaluateFunction(double x[3]);
00052   double EvaluateFunction(double x, double y, double z)
00053     {return this->vtkImplicitFunction::EvaluateFunction(x, y, z); }
00055 
00057   void EvaluateGradient(double x[3], double n[3]);
00058 
00060 
00061   void SetXMin(double p[3]);
00062   void SetXMin(double x, double y, double z);
00063   void GetXMin(double p[3]);
00064   void GetXMin(double &x, double &y, double &z);
00066 
00067   void SetXMax(double p[3]);
00068   void SetXMax(double x, double y, double z);
00069   void GetXMax(double p[3]);
00070   void GetXMax(double &x, double &y, double &z);
00071 
00072   void SetBounds(double xMin, double xMax,
00073                  double yMin, double yMax,
00074                  double zMin, double zMax);
00075   void SetBounds(double bounds[6]);
00076   void GetBounds(double &xMin, double &xMax,
00077                  double &yMin, double &yMax,
00078                  double &zMin, double &zMax);
00079   void GetBounds(double bounds[6]);
00080   double *GetBounds();
00081 
00086   void AddBounds(double bounds[6]);
00087 
00089 
00096   static char IntersectBox(double bounds[6], double origin[3], double dir[3],
00097                            double coord[3], double& t);
00099 
00101 
00111   static int IntersectWithLine(const double bounds[6],
00112                                const double p1[3], const double p2[3],
00113                                double &t1, double &t2,
00114                                double x1[3], double x2[3],
00115                                int &plane1, int &plane2);
00117 
00118 protected:
00119   vtkBox();
00120   ~vtkBox();
00121 
00122   vtkBoundingBox *BBox;
00123   double Bounds[6]; //supports the GetBounds() method
00124 
00125 private:
00126   vtkBox(const vtkBox&);  // Not implemented.
00127   void operator=(const vtkBox&);  // Not implemented.
00128 };
00129 
00130 
00131 
00132 inline void vtkBox::SetXMin(double p[3])
00133 {
00134   this->SetXMin(p[0], p[1], p[2]);
00135 }
00136 
00137 inline void vtkBox::SetXMax(double p[3])
00138 {
00139   this->SetXMax(p[0], p[1], p[2]);
00140 }
00141 
00142 
00143 #endif
00144 
00145