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 =========================================================================*/
34 #ifndef vtkBox_h
35 #define vtkBox_h
36 
37 #include "vtkCommonDataModelModule.h" // For export macro
38 #include "vtkImplicitFunction.h"
39 class vtkBoundingBox;
40 
41 class VTKCOMMONDATAMODEL_EXPORT vtkBox : public vtkImplicitFunction
42 {
43 public:
44  vtkTypeMacro(vtkBox,vtkImplicitFunction);
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
50  static vtkBox *New();
51 
56  double EvaluateFunction(double x[3]) override;
57 
61  void EvaluateGradient(double x[3], double n[3]) override;
62 
64 
67  void SetXMin(double p[3]);
68  void SetXMin(double x, double y, double z);
69  void GetXMin(double p[3]);
70  void GetXMin(double &x, double &y, double &z);
72 
73  void SetXMax(double p[3]);
74  void SetXMax(double x, double y, double z);
75  void GetXMax(double p[3]);
76  void GetXMax(double &x, double &y, double &z);
77 
78  void SetBounds(double xMin, double xMax,
79  double yMin, double yMax,
80  double zMin, double zMax);
81  void SetBounds(const double bounds[6]);
82  void GetBounds(double &xMin, double &xMax,
83  double &yMin, double &yMax,
84  double &zMin, double &zMax);
85  void GetBounds(double bounds[6]);
86  double *GetBounds() VTK_SIZEHINT(6);
87 
94  void AddBounds(const double bounds[6]);
95 
105  static char IntersectBox(double bounds[6], const double origin[3], double dir[3],
106  double coord[3], double& t);
107 
120  static int IntersectWithLine(const double bounds[6],
121  const double p1[3], const double p2[3],
122  double &t1, double &t2,
123  double x1[3], double x2[3],
124  int &plane1, int &plane2);
125 
133  static vtkTypeBool IntersectWithPlane(double bounds[6], double origin[3],
134  double normal[3]);
135 
147  static vtkTypeBool IntersectWithPlane(double bounds[6], double origin[3],
148  double normal[3], double xints[18]);
149 
150 protected:
152  ~vtkBox() override;
153 
155  double Bounds[6]; //supports the GetBounds() method
156 
157 private:
158  vtkBox(const vtkBox&) = delete;
159  void operator=(const vtkBox&) = delete;
160 };
161 
162 
163 
164 inline void vtkBox::SetXMin(double p[3])
165 {
166  this->SetXMin(p[0], p[1], p[2]);
167 }
168 
169 inline void vtkBox::SetXMax(double p[3])
170 {
171  this->SetXMax(p[0], p[1], p[2]);
172 }
173 
174 
175 #endif
vtkBox::SetBounds
void SetBounds(const double bounds[6])
vtkBox::SetXMin
void SetXMin(double x, double y, double z)
vtkImplicitFunction::EvaluateFunction
virtual double EvaluateFunction(double x[3])=0
Evaluate function at position x-y-z and return value.
vtkBox::GetXMax
void GetXMax(double &x, double &y, double &z)
vtkBox::GetXMax
void GetXMax(double p[3])
vtkX3D::dir
@ dir
Definition: vtkX3D.h:324
vtkBox::GetBounds
void GetBounds(double &xMin, double &xMax, double &yMin, double &yMax, double &zMin, double &zMax)
vtkBox::GetXMin
void GetXMin(double p[3])
vtkBox::SetXMax
void SetXMax(double p[3])
Definition: vtkBox.h:169
vtkImplicitFunction
abstract interface for implicit functions
Definition: vtkImplicitFunction.h:61
vtkBoundingBox
Fast Simple Class for dealing with 3D bounds.
Definition: vtkBoundingBox.h:36
vtkBox::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:42
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkBox::GetBounds
double * GetBounds()
vtkBox::EvaluateGradient
void EvaluateGradient(double x[3], double n[3]) override
Evaluate the gradient of the box.
vtkBox::New
static vtkBox * New()
Construct box with center at (0,0,0) and each side of length 1.0.
vtkBox::EvaluateFunction
double EvaluateFunction(double x[3]) override
Evaluate function at position x-y-z and return value.
vtkBox
implicit function for a bounding box
Definition: vtkBox.h:42
vtkImplicitFunction.h
vtkBox::SetXMax
void SetXMax(double x, double y, double z)
vtkBox::SetBounds
void SetBounds(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax)
vtkBox::GetXMin
void GetXMin(double &x, double &y, double &z)
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkBox::GetBounds
void GetBounds(double bounds[6])