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 "vtkCommonDataModelModule.h" // For export macro
37 #include "vtkImplicitFunction.h"
38 class vtkBoundingBox;
39 
41 {
42 public:
43  vtkTypeMacro(vtkBox,vtkImplicitFunction);
44  void PrintSelf(ostream& os, vtkIndent indent);
45 
47  static vtkBox *New();
48 
50 
51  double EvaluateFunction(double x[3]);
52  double EvaluateFunction(double x, double y, double z)
53  {return this->vtkImplicitFunction::EvaluateFunction(x, y, z); }
55 
57  void EvaluateGradient(double x[3], double n[3]);
58 
60 
61  void SetXMin(double p[3]);
62  void SetXMin(double x, double y, double z);
63  void GetXMin(double p[3]);
64  void GetXMin(double &x, double &y, double &z);
66 
67  void SetXMax(double p[3]);
68  void SetXMax(double x, double y, double z);
69  void GetXMax(double p[3]);
70  void GetXMax(double &x, double &y, double &z);
71 
72  void SetBounds(double xMin, double xMax,
73  double yMin, double yMax,
74  double zMin, double zMax);
75  void SetBounds(const double bounds[6]);
76  void GetBounds(double &xMin, double &xMax,
77  double &yMin, double &yMax,
78  double &zMin, double &zMax);
79  void GetBounds(double bounds[6]);
80  double *GetBounds();
81 
86  void AddBounds(const double bounds[6]);
87 
89 
96  static char IntersectBox(double bounds[6], double origin[3], double dir[3],
97  double coord[3], double& t);
99 
101 
111  static int IntersectWithLine(const double bounds[6],
112  const double p1[3], const double p2[3],
113  double &t1, double &t2,
114  double x1[3], double x2[3],
115  int &plane1, int &plane2);
117 
118 protected:
119  vtkBox();
120  ~vtkBox();
121 
123  double Bounds[6]; //supports the GetBounds() method
124 
125 private:
126  vtkBox(const vtkBox&); // Not implemented.
127  void operator=(const vtkBox&); // Not implemented.
128 };
129 
130 
131 
132 inline void vtkBox::SetXMin(double p[3])
133 {
134  this->SetXMin(p[0], p[1], p[2]);
135 }
136 
137 inline void vtkBox::SetXMax(double p[3])
138 {
139  this->SetXMax(p[0], p[1], p[2]);
140 }
141 
142 
143 #endif
144 
145 
vtkBoundingBox * BBox
Definition: vtkBox.h:122
abstract interface for implicit functions
virtual double EvaluateFunction(double x[3])=0
void SetXMax(double p[3])
Definition: vtkBox.h:137
virtual void EvaluateGradient(double x[3], double g[3])=0
a simple class to control print indentation
Definition: vtkIndent.h:38
void SetXMin(double p[3])
Definition: vtkBox.h:132
double EvaluateFunction(double x, double y, double z)
Definition: vtkBox.h:52
void PrintSelf(ostream &os, vtkIndent indent)
static vtkObject * New()
implicit function for a bounding box
Definition: vtkBox.h:40
#define VTKCOMMONDATAMODEL_EXPORT
Fast Simple Class for dealing with 3D bounds.