VTK  9.4.20250307
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
101#ifndef vtkBox_h
102#define vtkBox_h
103
104#include "vtkCommonDataModelModule.h" // For export macro
105#include "vtkImplicitFunction.h"
106VTK_ABI_NAMESPACE_BEGIN
107class vtkBoundingBox;
108
109class VTKCOMMONDATAMODEL_EXPORT vtkBox : public vtkImplicitFunction
110{
111public:
113 void PrintSelf(ostream& os, vtkIndent indent) override;
114
118 static vtkBox* New();
119
124 double EvaluateFunction(double x[3]) override;
125
129 void EvaluateGradient(double x[3], double n[3]) override;
130
132
135 void SetXMin(double p[3]);
136 void SetXMin(double x, double y, double z);
137 void GetXMin(double p[3]);
138 void GetXMin(double& x, double& y, double& z);
140
141 void SetXMax(double p[3]);
142 void SetXMax(double x, double y, double z);
143 void GetXMax(double p[3]);
144 void GetXMax(double& x, double& y, double& z);
145
146 void SetBounds(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax);
147 void SetBounds(const double bounds[6]);
149 double& xMin, double& xMax, double& yMin, double& yMax, double& zMin, double& zMax);
150 void GetBounds(double bounds[6]);
152
159 void AddBounds(const double bounds[6]);
160
170 static char IntersectBox(const double bounds[6], const double origin[3], const double dir[3],
171 double coord[3], double& t, double tolerance = 0.0);
172
185 static int IntersectWithLine(const double bounds[6], const double p1[3], const double p2[3],
186 double& t1, double& t2, double x1[3], double x2[3], int& plane1, int& plane2);
187
197 static bool IntersectWithInfiniteLine(const double bounds[6], const double p1[3],
198 const double p2[3], double& t1, double& t2, double x1[3], double x2[3], int& plane1,
199 int& plane2);
200
208 static vtkTypeBool IntersectWithPlane(double bounds[6], double origin[3], double normal[3]);
209
221 static vtkTypeBool IntersectWithPlane(
222 double bounds[6], double origin[3], double normal[3], double xout[18]);
223
231 static vtkTypeBool IsBoxInFrustum(double planes[24], double bounds[6]);
232
233protected:
235 ~vtkBox() override;
236
238 double Bounds[6]; // supports the GetBounds() method
239
240private:
241 vtkBox(const vtkBox&) = delete;
242 void operator=(const vtkBox&) = delete;
243};
244
245inline void vtkBox::SetXMin(double p[3])
246{
247 this->SetXMin(p[0], p[1], p[2]);
248}
249
250inline void vtkBox::SetXMax(double p[3])
251{
252 this->SetXMax(p[0], p[1], p[2]);
253}
254
255VTK_ABI_NAMESPACE_END
256#endif
RealT t2
Definition PyrC2Basis.h:22
Fast, simple class for representing and operating on 3D bounds.
implicit function for a bounding box
Definition vtkBox.h:110
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:250
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:108
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_SIZEHINT(...)