VTK  9.1.0
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=========================================================================*/
40#ifndef vtkBox_h
41#define vtkBox_h
42
43#include "vtkCommonDataModelModule.h" // For export macro
44#include "vtkImplicitFunction.h"
45class vtkBoundingBox;
46
47class VTKCOMMONDATAMODEL_EXPORT vtkBox : public vtkImplicitFunction
48{
49public:
51 void PrintSelf(ostream& os, vtkIndent indent) override;
52
56 static vtkBox* New();
57
62 double EvaluateFunction(double x[3]) override;
63
67 void EvaluateGradient(double x[3], double n[3]) override;
68
70
73 void SetXMin(double p[3]);
74 void SetXMin(double x, double y, double z);
75 void GetXMin(double p[3]);
76 void GetXMin(double& x, double& y, double& z);
78
79 void SetXMax(double p[3]);
80 void SetXMax(double x, double y, double z);
81 void GetXMax(double p[3]);
82 void GetXMax(double& x, double& y, double& z);
83
84 void SetBounds(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax);
85 void SetBounds(const double bounds[6]);
87 double& xMin, double& xMax, double& yMin, double& yMax, double& zMin, double& zMax);
88 void GetBounds(double bounds[6]);
89 double* GetBounds() VTK_SIZEHINT(6);
90
97 void AddBounds(const double bounds[6]);
98
108 static char IntersectBox(const double bounds[6], const double origin[3], const double dir[3],
109 double coord[3], double& t, const double tolerance = 0.0);
110
123 static int IntersectWithLine(const double bounds[6], const double p1[3], const double p2[3],
124 double& t1, double& t2, double x1[3], double x2[3], int& plane1, int& plane2);
125
135 static bool IntersectWithInfiniteLine(const double bounds[6], const double p1[3],
136 const double p2[3], double& t1, double& t2, double x1[3], double x2[3], int& plane1,
137 int& plane2);
138
146 static vtkTypeBool IntersectWithPlane(double bounds[6], double origin[3], double normal[3]);
147
159 static vtkTypeBool IntersectWithPlane(
160 double bounds[6], double origin[3], double normal[3], double xout[18]);
161
169 static vtkTypeBool IsBoxInFrustum(double planes[24], double bounds[6]);
170
171protected:
173 ~vtkBox() override;
174
176 double Bounds[6]; // supports the GetBounds() method
177
178private:
179 vtkBox(const vtkBox&) = delete;
180 void operator=(const vtkBox&) = delete;
181};
182
183inline void vtkBox::SetXMin(double p[3])
184{
185 this->SetXMin(p[0], p[1], p[2]);
186}
187
188inline void vtkBox::SetXMax(double p[3])
189{
190 this->SetXMax(p[0], p[1], p[2]);
191}
192
193#endif
Fast, simple class for representing and operating on 3D bounds.
implicit function for a bounding box
Definition: vtkBox.h:48
void EvaluateGradient(double x[3], double n[3]) override
Evaluate the gradient of the box.
void SetBounds(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetBounds(const double bounds[6])
void SetXMax(double x, double y, double z)
void GetXMax(double &x, double &y, double &z)
double * GetBounds()
void GetXMax(double p[3])
void SetXMin(double x, double y, double z)
Set / get the bounding box using various methods.
void GetXMin(double &x, double &y, double &z)
Set / get the bounding box using various methods.
void GetXMin(double p[3])
Set / get the bounding box using various methods.
double EvaluateFunction(double x[3]) override
Evaluate function at position x-y-z and return value.
void SetXMax(double p[3])
Definition: vtkBox.h:188
void GetBounds(double bounds[6])
static vtkBox * New()
Construct box with center at (0,0,0) and each side of length 1.0.
void GetBounds(double &xMin, double &xMax, double &yMin, double &yMax, double &zMin, double &zMax)
abstract interface for implicit functions
virtual double EvaluateFunction(double x[3])=0
Evaluate function at position x-y-z and return value.
a simple class to control print indentation
Definition: vtkIndent.h:43
@ dir
Definition: vtkX3D.h:330
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_SIZEHINT(...)