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 =========================================================================*/
31 #ifndef vtkBox_h
32 #define vtkBox_h
33 
34 #include "vtkCommonDataModelModule.h" // For export macro
35 #include "vtkImplicitFunction.h"
36 class vtkBoundingBox;
37 
38 class VTKCOMMONDATAMODEL_EXPORT vtkBox : public vtkImplicitFunction
39 {
40 public:
41  vtkTypeMacro(vtkBox,vtkImplicitFunction);
42  void PrintSelf(ostream& os, vtkIndent indent) override;
43 
47  static vtkBox *New();
48 
53  double EvaluateFunction(double x[3]) override;
54 
58  void EvaluateGradient(double x[3], double n[3]) override;
59 
61 
64  void SetXMin(double p[3]);
65  void SetXMin(double x, double y, double z);
66  void GetXMin(double p[3]);
67  void GetXMin(double &x, double &y, double &z);
69 
70  void SetXMax(double p[3]);
71  void SetXMax(double x, double y, double z);
72  void GetXMax(double p[3]);
73  void GetXMax(double &x, double &y, double &z);
74 
75  void SetBounds(double xMin, double xMax,
76  double yMin, double yMax,
77  double zMin, double zMax);
78  void SetBounds(const double bounds[6]);
79  void GetBounds(double &xMin, double &xMax,
80  double &yMin, double &yMax,
81  double &zMin, double &zMax);
82  void GetBounds(double bounds[6]);
83  double *GetBounds() VTK_SIZEHINT(6);
84 
91  void AddBounds(const double bounds[6]);
92 
102  static char IntersectBox(double bounds[6], const double origin[3], double dir[3],
103  double coord[3], double& t);
104 
117  static int IntersectWithLine(const double bounds[6],
118  const double p1[3], const double p2[3],
119  double &t1, double &t2,
120  double x1[3], double x2[3],
121  int &plane1, int &plane2);
122 
130  static int IntersectWithPlane(double bounds[6], double origin[3],
131  double normal[3]);
132 
144  static int IntersectWithPlane(double bounds[6], double origin[3],
145  double normal[3], double xints[18]);
146 
147 protected:
148  vtkBox();
149  ~vtkBox() override;
150 
152  double Bounds[6]; //supports the GetBounds() method
153 
154 private:
155  vtkBox(const vtkBox&) = delete;
156  void operator=(const vtkBox&) = delete;
157 };
158 
159 
160 
161 inline void vtkBox::SetXMin(double p[3])
162 {
163  this->SetXMin(p[0], p[1], p[2]);
164 }
165 
166 inline void vtkBox::SetXMax(double p[3])
167 {
168  this->SetXMax(p[0], p[1], p[2]);
169 }
170 
171 
172 #endif
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkImplicitFunction::EvaluateFunction
virtual double EvaluateFunction(double x[3])=0
Evaluate function at position x-y-z and return value.
vtkX3D::dir
Definition: vtkX3D.h:324
vtkBox::SetXMax
void SetXMax(double p[3])
Definition: vtkBox.h:166
vtkImplicitFunction
abstract interface for implicit functions
Definition: vtkImplicitFunction.h:60
vtkBoundingBox
Fast Simple Class for dealing with 3D bounds.
Definition: vtkBoundingBox.h:32
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:42
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkImplicitFunction::EvaluateGradient
virtual void EvaluateGradient(double x[3], double g[3])=0
Evaluate function gradient at position x-y-z and pass back vector.
vtkBox
implicit function for a bounding box
Definition: vtkBox.h:38
vtkImplicitFunction.h
vtkImplicitFunction::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.