VTK: Common/DataModel/vtkBox.h Source File

| VTK 9.3.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
31 #ifndef vtkBox_h
32 #define vtkBox_h
33
34 #include "vtkCommonDataModelModule.h" // For export macro
35 #include "vtkImplicitFunction.h"
36 VTK_ABI_NAMESPACE_BEGIN
37 class vtkBoundingBox;
38
39 class VTKCOMMONDATAMODEL_EXPORT vtkBox : public vtkImplicitFunction
40 {
41 public:
42 vtkTypeMacro(vtkBox, vtkImplicitFunction);
43 void PrintSelf(ostream& os, vtkIndent indent) override;
44
48 static vtkBox* New();
49
53 using vtkImplicitFunction::EvaluateFunction;
54 double EvaluateFunction(double x[3]) override;
55
59 void EvaluateGradient(double x[3], double n[3]) override;
60
62
65 void SetXMin(double p[3]);
66 void SetXMin(double x, double y, double z);
67 void GetXMin(double p[3]);
68 void GetXMin(double& x, double& y, double& z);
70
71 void SetXMax(double p[3]);
72 void SetXMax(double x, double y, double z);
73 void GetXMax(double p[3]);
74 void GetXMax(double& x, double& y, double& z);
75
76 void SetBounds(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax);
77 void SetBounds(const double bounds[6]);
78 void GetBounds(
79 double& xMin, double& xMax, double& yMin, double& yMax, double& zMin, double& zMax);
80 void GetBounds(double bounds[6]);
81 double* GetBounds() VTK_SIZEHINT(6);
82
89 void AddBounds(const double bounds[6]);
90
100 static char IntersectBox(const double bounds[6], const double origin[3], const double dir[3],
101 double coord[3], double& t, double tolerance = 0.0);
102
115 static int IntersectWithLine(const double bounds[6], const double p1[3], const double p2[3],
116 double& t1, double& t2, double x1[3], double x2[3], int& plane1, int& plane2);
117
127 static bool IntersectWithInfiniteLine(const double bounds[6], const double p1[3],
128 const double p2[3], double& t1, double& t2, double x1[3], double x2[3], int& plane1,
129 int& plane2);
130
138 static vtkTypeBool IntersectWithPlane(double bounds[6], double origin[3], double normal[3]);
139
151 static vtkTypeBool IntersectWithPlane(
152 double bounds[6], double origin[3], double normal[3], double xout[18]);
153
161 static vtkTypeBool IsBoxInFrustum(double planes[24], double bounds[6]);
162
163 protected:
164 vtkBox();
165 ~vtkBox() override;
166
167 vtkBoundingBox* BBox;
168 double Bounds[6]; // supports the GetBounds() method
169
170 private:
171 vtkBox(const vtkBox&) = delete;
172 void operator=(const vtkBox&) = delete;
173 };
174
175 inline void vtkBox::SetXMin(double p[3])
176 {
177 this->SetXMin(p[0], p[1], p[2]);
178 }
179
180 inline void vtkBox::SetXMax(double p[3])
181 {
182 this->SetXMax(p[0], p[1], p[2]);
183 }
184
185 VTK_ABI_NAMESPACE_END
186 #endif
vtkBoundingBox
Fast, simple class for representing and operating on 3D bounds.
Definition: vtkBoundingBox.h:38
vtkBox
implicit function for a bounding box
Definition: vtkBox.h:40
vtkBox::EvaluateGradient
void EvaluateGradient(double x[3], double n[3]) override
Evaluate the gradient of the box.
vtkBox::SetBounds
void SetBounds(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax)
vtkBox::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkBox::SetBounds
void SetBounds(const double bounds[6])
vtkBox::SetXMax
void SetXMax(double x, double y, double z)
vtkBox::GetXMax
void GetXMax(double &x, double &y, double &z)
vtkBox::New
static vtkBox * New()
Construct box with center at (0,0,0) and each side of length 1.0.
vtkBox::GetXMax
void GetXMax(double p[3])
vtkBox::SetXMin
void SetXMin(double x, double y, double z)
Set / get the bounding box using various methods.
vtkBox::GetBounds
double * GetBounds()
vtkBox::GetXMin
void GetXMin(double &x, double &y, double &z)
Set / get the bounding box using various methods.
vtkBox::GetXMin
void GetXMin(double p[3])
Set / get the bounding box using various methods.
vtkBox::EvaluateFunction
double EvaluateFunction(double x[3]) override
Evaluate function at position x-y-z and return value.
vtkBox::SetXMax
void SetXMax(double p[3])
Definition: vtkBox.h:180
vtkBox::GetBounds
void GetBounds(double bounds[6])
vtkBox::GetBounds
void GetBounds(double &xMin, double &xMax, double &yMin, double &yMax, double &zMin, double &zMax)
vtkImplicitFunction
abstract interface for implicit functions
Definition: vtkImplicitFunction.h:59
vtkImplicitFunction::EvaluateFunction
virtual double EvaluateFunction(double x[3])=0
Evaluate function at position x-y-z and return value.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkX3D::dir
@ dir
Definition: vtkX3D.h:324
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:64
vtkImplicitFunction.h
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:36