/usr/include/vtk-7.1/vtkStructuredExtent.h is in libvtk7-dev 7.1.1+dfsg1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkStructuredExtent.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* @class vtkStructuredExtent
* @brief helper class to aid working with structured
* extents.
*
*
* vtkStructuredExtent is an helper class that helps in arithmetic with
* structured extents. It defines a bunch of static methods (most of which are
* inlined) to aid in dealing with extents.
*/
#ifndef vtkStructuredExtent_h
#define vtkStructuredExtent_h
#include "vtkCommonDataModelModule.h" // For export macro
#include "vtkObject.h"
class VTKCOMMONDATAMODEL_EXPORT vtkStructuredExtent : public vtkObject
{
public:
static vtkStructuredExtent* New();
vtkTypeMacro(vtkStructuredExtent, vtkObject);
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
/**
* Clamps \c ext to fit in \c wholeExt.
*/
static void Clamp(int ext[6], const int wholeExt[]);
/**
* Returns true if \c ext is fits within \c wholeExt with atleast 1 dimension
* smaller than the \c wholeExt.
*/
static bool StrictlySmaller(const int ext[6], const int wholeExt[6]);
/**
* Returns if \c ext fits within \c wholeExt. Unline StrictlySmaller, this
* method returns true even if \c ext == \c wholeExt.
*/
static bool Smaller(const int ext[6], const int wholeExt[6]);
/**
* Grows the \c ext on each side by the given \c count.
*/
static void Grow(int ext[6], int count);
/**
* Makes \c ext relative to \c wholeExt.
*/
static void Transform(int ext[6], int wholeExt[6]);
/**
* Given the extents, computes the dimensions.
*/
static void GetDimensions(const int ext[6], int dims[3]);
protected:
vtkStructuredExtent();
~vtkStructuredExtent() VTK_OVERRIDE;
private:
vtkStructuredExtent(const vtkStructuredExtent&) VTK_DELETE_FUNCTION;
void operator=(const vtkStructuredExtent&) VTK_DELETE_FUNCTION;
};
//----------------------------------------------------------------------------
inline void vtkStructuredExtent::Clamp(int ext[6], const int wholeExt[6])
{
ext[0] = (ext[0] < wholeExt[0])? wholeExt[0] : ext[0];
ext[1] = (ext[1] > wholeExt[1])? wholeExt[1] : ext[1];
ext[2] = (ext[2] < wholeExt[2])? wholeExt[2] : ext[2];
ext[3] = (ext[3] > wholeExt[3])? wholeExt[3] : ext[3];
ext[4] = (ext[4] < wholeExt[4])? wholeExt[4] : ext[4];
ext[5] = (ext[5] > wholeExt[5])? wholeExt[5] : ext[5];
}
//----------------------------------------------------------------------------
inline bool vtkStructuredExtent::Smaller(const int ext[6], const int wholeExt[6])
{
if (ext[0] < wholeExt[0] || ext[0] > wholeExt[0 + 1] ||
ext[0 + 1] < wholeExt[0] || ext[0 + 1] > wholeExt[0 + 1])
{
return false;
}
if (ext[2] < wholeExt[2] || ext[2] > wholeExt[2 + 1] ||
ext[2 + 1] < wholeExt[2] || ext[2 + 1] > wholeExt[2 + 1])
{
return false;
}
if (ext[4] < wholeExt[4] || ext[4] > wholeExt[4 + 1] ||
ext[4 + 1] < wholeExt[4] || ext[4 + 1] > wholeExt[4 + 1])
{
return false;
}
return true;
}
//----------------------------------------------------------------------------
inline bool vtkStructuredExtent::StrictlySmaller(const int ext[6], const int wholeExt[6])
{
if (!vtkStructuredExtent::Smaller(ext, wholeExt))
{
return false;
}
if (ext[0] > wholeExt[0] || ext[1] < wholeExt[1] ||
ext[2] > wholeExt[2] || ext[3] < wholeExt[3] ||
ext[4] > wholeExt[4] || ext[5] < wholeExt[5])
{
return true;
}
return false;
}
//----------------------------------------------------------------------------
inline void vtkStructuredExtent::Grow(int ext[6], int count)
{
ext[0] -= count;
ext[2] -= count;
ext[4] -= count;
ext[1] += count;
ext[3] += count;
ext[5] += count;
}
//----------------------------------------------------------------------------
inline void vtkStructuredExtent::Transform(int ext[6], int wholeExt[6])
{
ext[0] -= wholeExt[0];
ext[1] -= wholeExt[0];
ext[2] -= wholeExt[2];
ext[3] -= wholeExt[2];
ext[4] -= wholeExt[4];
ext[5] -= wholeExt[4];
}
//----------------------------------------------------------------------------
inline void vtkStructuredExtent::GetDimensions(const int ext[6], int dims[3])
{
dims[0] = ext[1]-ext[0] + 1;
dims[1] = ext[3]-ext[2] + 1;
dims[2] = ext[5]-ext[4] + 1;
}
#endif
|