VTK
vtkBox.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkBox.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 =========================================================================*/
33 #ifndef __vtkBox_h
34 #define __vtkBox_h
35 
36 #include "vtkImplicitFunction.h"
37 class vtkBoundingBox;
38 
40 {
41 public:
42  vtkTypeMacro(vtkBox,vtkImplicitFunction);
43  void PrintSelf(ostream& os, vtkIndent indent);
44 
46  static vtkBox *New();
47 
49 
50  double EvaluateFunction(double x[3]);
51  double EvaluateFunction(double x, double y, double z)
52  {return this->vtkImplicitFunction::EvaluateFunction(x, y, z); }
54 
56  void EvaluateGradient(double x[3], double n[3]);
57 
59 
60  void SetXMin(double p[3]);
61  void SetXMin(double x, double y, double z);
62  void GetXMin(double p[3]);
63  void GetXMin(double &x, double &y, double &z);
65 
66  void SetXMax(double p[3]);
67  void SetXMax(double x, double y, double z);
68  void GetXMax(double p[3]);
69  void GetXMax(double &x, double &y, double &z);
70 
71  void SetBounds(double xMin, double xMax,
72  double yMin, double yMax,
73  double zMin, double zMax);
74  void SetBounds(double bounds[6]);
75  void GetBounds(double &xMin, double &xMax,
76  double &yMin, double &yMax,
77  double &zMin, double &zMax);
78  void GetBounds(double bounds[6]);
79  double *GetBounds();
80 
85  void AddBounds(double bounds[6]);
86 
88 
95  static char IntersectBox(double bounds[6], double origin[3], double dir[3],
96  double coord[3], double& t);
98 
100 
110  static int IntersectWithLine(const double bounds[6],
111  const double p1[3], const double p2[3],
112  double &t1, double &t2,
113  double x1[3], double x2[3],
114  int &plane1, int &plane2);
116 
117 protected:
118  vtkBox();
119  ~vtkBox();
120 
122  double Bounds[6]; //supports the GetBounds() method
123 
124 private:
125  vtkBox(const vtkBox&); // Not implemented.
126  void operator=(const vtkBox&); // Not implemented.
127 };
128 
129 
130 
131 inline void vtkBox::SetXMin(double p[3])
132 {
133  this->SetXMin(p[0], p[1], p[2]);
134 }
135 
136 inline void vtkBox::SetXMax(double p[3])
137 {
138  this->SetXMax(p[0], p[1], p[2]);
139 }
140 
141 
142 #endif
143 
144 
vtkBoundingBox * BBox
Definition: vtkBox.h:121
abstract interface for implicit functions
virtual double EvaluateFunction(double x[3])=0
void SetXMax(double p[3])
Definition: vtkBox.h:136
virtual void EvaluateGradient(double x[3], double g[3])=0
a simple class to control print indentation
Definition: vtkIndent.h:37
#define VTK_COMMON_EXPORT
void SetXMin(double p[3])
Definition: vtkBox.h:131
double EvaluateFunction(double x, double y, double z)
Definition: vtkBox.h:51
void PrintSelf(ostream &os, vtkIndent indent)
static vtkObject * New()
implicit function for a bounding box
Definition: vtkBox.h:39
Fast Simple Class for dealing with 3D bounds.