25VTK_ABI_NAMESPACE_BEGIN
32 vtkRect(
const T& x,
const T& y,
const T& width,
const T& height)
36 this->
Data[2] = width;
37 this->
Data[3] = height;
49 void Set(
const T& x,
const T& y,
const T& width,
const T& height)
53 this->
Data[2] = width;
54 this->
Data[3] = height;
66 const T&
GetX()
const {
return this->
Data[0]; }
76 const T&
GetY()
const {
return this->
Data[1]; }
149 if (point[0] < this->
GetX())
151 T dx = this->
GetX() - point[0];
152 this->
SetX(point[0]);
155 else if (point[0] > this->
GetX())
158 T dx = point[0] - this->
GetX();
163 if (point[1] < this->
GetY())
165 T dy = this->
GetY() - point[1];
166 this->
SetY(point[1]);
169 else if (point[1] > this->
GetY())
172 T dy = point[1] - this->
GetY();
183 T point[2] = { x, y };
194 if (rect.
GetX() < this->GetX())
200 else if (rect.
GetX() > this->GetX())
213 if (rect.
GetY() < this->GetY())
219 else if (rect.
GetY() > this->GetY())
240 bool intersects =
true;
242 if (rect.
GetX() < this->GetX())
245 intersects &= (dx < rect.
GetWidth());
247 else if (rect.
GetX() > this->
GetX())
250 intersects &= (dx < this->
GetWidth());
258 else if (rect.
GetY() > this->
GetY())
294 this->
Data[0] = left;
295 this->
Data[1] = bottom;
296 this->
Data[2] = (right - left);
297 this->
Data[3] = (top - bottom);
318 :
vtkRect<int>(x, y, width, height)
331 vtkRectf(
float x,
float y,
float width,
float height)
332 :
vtkRect<float>(x, y, width, height)
345 vtkRectd(
double x,
double y,
double width,
double height)
346 :
vtkRect<double>(x, y, width, height)
static T Max(const T &a, const T &b)
Returns the maximum of the two arguments provided.
static T Min(const T &a, const T &b)
Returns the minimum of the two arguments provided.
templated base type for storage of 2D rectangles.
vtkVector2< T > GetBottomLeft() const
Get the bottom left corner of the rect as a vtkVector.
vtkVector< T, 2 > GetBottomRight() const
Get the bottom right corner of the rect as a vtkVector.
void SetY(const T &y)
Set the y component of the rectangle bottom corner, i.e.
void AddPoint(T x, T y)
Expand this rect to contain the point passed in.
const T & GetBottom() const
Get the bottom boundary of the rectangle along the Y direction.
void SetX(const T &x)
Set the x component of the rectangle bottom corner, i.e.
void Set(const T &x, const T &y, const T &width, const T &height)
Set the x, y components of the rectangle, and the width/height.
T GetRight() const
Get the right boundary of the rectangle along the X direction.
vtkVector< T, 2 > GetTopLeft() const
Get the top left corner of the rect as a vtkVector.
void SetHeight(const T &height)
Set the height of the rectangle, i.e.
bool IntersectsWith(const vtkRect< T > &rect) const
Returns true if the rect argument overlaps this rect.
void MoveTo(T x, T y)
Move the rectangle, moving the bottom-left corner to the given position.
void AddRect(const vtkRect< T > &rect)
Expand this rect to contain the rect passed in.
const T & GetLeft() const
Get the left boundary of the rectangle along the X direction.
const T & GetX() const
Get the x component of the rectangle bottom corner, i.e.
T GetTop() const
Get the top boundary of the rectangle along the Y direction.
vtkRect(const T &x, const T &y, const T &width, const T &height)
const T & GetHeight() const
Get the height of the rectangle, i.e.
const T & GetWidth() const
Get the width of the rectangle, i.e.
vtkVector2d GetCenter() const
Returns the center of the rect as a vtkVector2d.
const T & GetY() const
Get the y component of the rectangle bottom corner, i.e.
vtkVector< T, 2 > GetTopRight() const
Get the bottom left corner of the rect as a vtkVector.
void AddPoint(const T point[2])
Expand this rect to contain the point passed in.
void SetWidth(const T &width)
Set the width of the rectanle, i.e.
bool Intersect(const vtkRect< T > &other)
Intersect with other rectangle.
vtkRectd(const double *init)
vtkRectd(double x, double y, double width, double height)
vtkRectf(const float *init)
vtkRectf(float x, float y, float width, float height)
vtkRecti(int x, int y, int width, int height)
vtkRecti(const int *init)
T Data[Size]
The only thing stored in memory!
templated base type for storage of vectors.