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"
39class vtkBoundingBox;
40
41class VTKCOMMONDATAMODEL_EXPORT vtkBox : public vtkImplicitFunction
42{
43public:
45 void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
46
50 static vtkBox *New();
51
55 double EvaluateFunction(double x[3]) VTK_OVERRIDE;
56 double EvaluateFunction(double x, double y, double z)
57 {return this->vtkImplicitFunction::EvaluateFunction(x, y, z); }
58
62 void EvaluateGradient(double x[3], double n[3]) VTK_OVERRIDE;
63
65
68 void SetXMin(double p[3]);
69 void SetXMin(double x, double y, double z);
70 void GetXMin(double p[3]);
71 void GetXMin(double &x, double &y, double &z);
73
74 void SetXMax(double p[3]);
75 void SetXMax(double x, double y, double z);
76 void GetXMax(double p[3]);
77 void GetXMax(double &x, double &y, double &z);
78
79 void SetBounds(double xMin, double xMax,
80 double yMin, double yMax,
81 double zMin, double zMax);
82 void SetBounds(const double bounds[6]);
83 void GetBounds(double &xMin, double &xMax,
84 double &yMin, double &yMax,
85 double &zMin, double &zMax);
86 void GetBounds(double bounds[6]);
87 double *GetBounds();
88
95 void AddBounds(const double bounds[6]);
96
105 static char IntersectBox(double bounds[6], 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
126protected:
128 ~vtkBox() VTK_OVERRIDE;
129
131 double Bounds[6]; //supports the GetBounds() method
132
133private:
134 vtkBox(const vtkBox&) VTK_DELETE_FUNCTION;
135 void operator=(const vtkBox&) VTK_DELETE_FUNCTION;
136};
137
138
139
140inline void vtkBox::SetXMin(double p[3])
141{
142 this->SetXMin(p[0], p[1], p[2]);
143}
144
145inline void vtkBox::SetXMax(double p[3])
146{
147 this->SetXMax(p[0], p[1], p[2]);
148}
149
150
151#endif
152
153
Fast Simple Class for dealing with 3D bounds.
implicit function for a bounding box
Definition: vtkBox.h:42
void EvaluateGradient(double x[3], double n[3]) override
Evaluate the gradient of the box.
static char IntersectBox(double bounds[6], double origin[3], double dir[3], double coord[3], double &t)
Bounding box intersection 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)
void GetXMax(double &x, double &y, double &z)
~vtkBox() override
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 * GetBounds()
void GetXMax(double p[3])
double EvaluateFunction(double x, double y, double z)
Definition: vtkBox.h:56
void SetXMin(double x, double y, double z)
void GetXMin(double &x, double &y, double &z)
void GetXMin(double p[3])
double EvaluateFunction(double x[3]) override
Evaluate box defined by the two points (pMin,pMax).
void SetXMax(double p[3])
Definition: vtkBox.h:145
void GetBounds(double bounds[6])
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 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:40
@ dir
Definition: vtkX3D.h:324