VTK  9.6.1
vtkBox.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
21
22#ifndef vtkBox_h
23#define vtkBox_h
24
25#include "vtkCommonDataModelModule.h" // For export macro
26#include "vtkImplicitFunction.h"
27VTK_ABI_NAMESPACE_BEGIN
28class vtkBoundingBox;
29
30class VTKCOMMONDATAMODEL_EXPORT vtkBox : public vtkImplicitFunction
31{
32public:
34 void PrintSelf(ostream& os, vtkIndent indent) override;
35
39 static vtkBox* New();
40
45 double EvaluateFunction(double x[3]) override;
46
50 void EvaluateGradient(double x[3], double n[3]) override;
51
53
56 void SetXMin(VTK_FUTURE_CONST double p[3]);
57 void SetXMin(double x, double y, double z);
58 void GetXMin(double p[3]) VTK_FUTURE_CONST;
59 void GetXMin(double& x, double& y, double& z) VTK_FUTURE_CONST;
61
62 void SetXMax(VTK_FUTURE_CONST double p[3]);
63 void SetXMax(double x, double y, double z);
64 void GetXMax(double p[3]) VTK_FUTURE_CONST;
65 void GetXMax(double& x, double& y, double& z) VTK_FUTURE_CONST;
66
67 void SetBounds(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax);
68 void SetBounds(const double bounds[6]);
69 void GetBounds(double& xMin, double& xMax, double& yMin, double& yMax, double& zMin,
70 double& zMax) VTK_FUTURE_CONST;
71 void GetBounds(double bounds[6]) VTK_FUTURE_CONST;
72 double* GetBounds() VTK_SIZEHINT(6);
73
80 void AddBounds(const double bounds[6]);
81
91 static char IntersectBox(const double bounds[6], const double origin[3], const double dir[3],
92 double coord[3], double& t, double tolerance = 0.0);
93
106 static int IntersectWithLine(const double bounds[6], const double p1[3], const double p2[3],
107 double& t1, double& t2, double x1[3], double x2[3], int& plane1, int& plane2);
108
118 static bool IntersectWithInfiniteLine(const double bounds[6], const double p1[3],
119 const double p2[3], double& t1, double& t2, double x1[3], double x2[3], int& plane1,
120 int& plane2);
121
129 static vtkTypeBool IntersectWithPlane(double bounds[6], double origin[3], double normal[3]);
130
143 double bounds[6], double origin[3], double normal[3], double xout[18]);
144
152 static vtkTypeBool IsBoxInFrustum(double planes[24], double bounds[6]);
153
154protected:
156 ~vtkBox() override;
157
159 double Bounds[6]; // supports the GetBounds() method
160
161private:
162 vtkBox(const vtkBox&) = delete;
163 void operator=(const vtkBox&) = delete;
164};
165
166inline void vtkBox::SetXMin(VTK_FUTURE_CONST double p[3])
167{
168 this->SetXMin(p[0], p[1], p[2]);
169}
170
171inline void vtkBox::SetXMax(VTK_FUTURE_CONST double p[3])
172{
173 this->SetXMax(p[0], p[1], p[2]);
174}
175
176VTK_ABI_NAMESPACE_END
177#endif
RealT t2
Definition PyrC2Basis.h:22
Fast, simple class for representing and operating on 3D bounds.
void EvaluateGradient(double x[3], double n[3]) override
Evaluate the gradient of the box.
static char IntersectBox(const double bounds[6], const double origin[3], const double dir[3], double coord[3], double &t, double tolerance=0.0)
Bounding box intersection with line modified from Graphics Gems Vol I.
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)
static int IntersectWithLine(const double bounds[6], const double p1[3], const double p2[3], double &t1, double &t2, double x1[3], double x2[3], int &plane1, int &plane2)
Intersect a line with the box.
double Bounds[6]
Definition vtkBox.h:159
void GetBounds(double bounds[6]) VTK_FUTURE_CONST
void GetXMax(double &x, double &y, double &z) VTK_FUTURE_CONST
static vtkTypeBool IsBoxInFrustum(double planes[24], double bounds[6])
Is a box in a frustum.
double * GetBounds()
vtkBoundingBox * BBox
Definition vtkBox.h:158
void GetXMin(double p[3]) VTK_FUTURE_CONST
Set / get the bounding box using various methods.
void SetXMin(double x, double y, double z)
Set / get the bounding box using various methods.
static vtkTypeBool IntersectWithPlane(double bounds[6], double origin[3], double normal[3])
Plane intersection with the box.
static bool IntersectWithInfiniteLine(const double bounds[6], const double p1[3], const double p2[3], double &t1, double &t2, double x1[3], double x2[3], int &plane1, int &plane2)
Same method as vtkBox::IntersectWithLine, except that t1 and t2 can be outside of [0,...
void SetXMax(VTK_FUTURE_CONST double p[3])
Definition vtkBox.h:171
double EvaluateFunction(double x[3]) override
Evaluate function at position x-y-z and return value.
void GetXMax(double p[3]) VTK_FUTURE_CONST
void GetBounds(double &xMin, double &xMax, double &yMin, double &yMax, double &zMin, double &zMax) VTK_FUTURE_CONST
static vtkBox * New()
Construct box with center at (0,0,0) and each side of length 1.0.
void AddBounds(const double bounds[6])
A special method that allows union set operation on bounding boxes.
void GetXMin(double &x, double &y, double &z) VTK_FUTURE_CONST
Set / get the bounding box using various methods.
void SetXMin(VTK_FUTURE_CONST double p[3])
Set / get the bounding box using various methods.
Definition vtkBox.h:166
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:29
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_SIZEHINT(...)