This file is indexed.

/usr/include/psurface/Box.h is in libpsurface-dev 2.0.0-2+b1.

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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
/**
 * @file Box.hh
 * @brief Implement an axis-parallel box
 */

#ifndef BOX_H
#define BOX_H

#include <algorithm>

// Check for VC9 / VS2008 with installed feature pack.
#if defined(_MSC_VER) && (_MSC_VER>=1500)
    #if defined(_CPPLIB_VER) && _CPPLIB_VER>=505
        #include <array>
    #else
        #error Please install the Visual Studio 2008 SP1 for TR1 support.
    #endif
#else
    #include <tr1/array>
#endif

#ifndef PSURFACE_STANDALONE
#include <mclib/McVec3f.h>
#endif

namespace psurface {

/** \brief A axis-parallel box in a Euclidean space
    \tparam C Type used for coordinate components
    \tparam dim Dimension of the box
*/
template<typename C, int dim>
class Box
{
public:

    /** \brief Default constructor.  Box is not initialized! */
    Box()
    {}

    /** \brief Set box from two points */
    Box(const std::tr1::array<C,dim>& lower, const std::tr1::array<C,dim>& upper) 
        : _lower(lower), _upper(upper)
    {
        for (int i=0; i<dim; i++) {
            _lower[i] = std::min(lower[i],upper[i]);
            _upper[i] = std::max(lower[i],upper[i]);
        }
    }

#ifndef PSURFACE_STANDALONE
    /** \brief Set box from two McVec3f */
    Box(const McVec3f& lower, const McVec3f& upper) 
    {
        for (int i=0; i<dim; i++) {
            _lower[i] = std::min(lower[i],upper[i]);
            _upper[i] = std::max(lower[i],upper[i]);
        }
    }
#endif

    /** \brief Copy constructor */
    Box(const Box& b) : _lower(b._lower), _upper(b._upper)
    {}

    /** \brief Set up box from to diagonal corners */
    void set(const std::tr1::array<C,dim>& lower, const std::tr1::array<C,dim>& upper)
    {
        for (int i=0; i<dim; i++) {
            _lower[i] = std::min(lower[i],upper[i]);
            _upper[i] = std::max(lower[i],upper[i]);
        }
    }

    /** \brief Test whether box contains a given point */
    bool contains(const std::tr1::array<C,dim>& c) const
    {
        for (int i = 0; i < dim; ++i)
            if (c[i] < this->_lower[i] || c[i] >= this->_upper[i])
                return false;
        return true;
    }

#ifndef PSURFACE_STANDALONE
    /** \brief Test whether box contains a given point */
    bool contains(const McVec3f& c) const
    {
        for (int i = 0; i < dim; ++i)
            if (c[i] < this->_lower[i] || c[i] >= this->_upper[i])
                return false;
        return true;
    }
#endif

    bool intersects(const Box& b)
    {
        for (int i = 0; i < dim; ++i)
            if (this->_lower[i] >= b._upper[i] || b._lower[i] >= this->_upper[i])
                return false;
        return true;
    }

    /// Returns intersection of two boxes.
    Box<C,dim> intersectWith(const Box<C,dim> &other) const {

        std::tr1::array<C,dim> zero;
        zero.assign(0);

        Box<C,dim> innerBox(zero,zero);

        for (int i = 0; i < dim; i++) {

            if ((upper()[i] < other.lower()[i]) || (lower()[i] > other.upper()[i]))
                return Box<C,dim>(zero,zero);
            
            innerBox._lower[i] = std::max(lower()[i],other.lower()[i]);
            innerBox._upper[i] = std::min(upper()[i],other.upper()[i]);
        }

        return innerBox;
    }

    std::tr1::array<C,dim> center() const
    {
            std::tr1::array<C,dim> center;
            for (int i = 0; i < dim; ++i)
                center[i] = 0.5*(_upper[i]+_lower[i]);
            return center;
    }


    double size(int i)
    {
        return _upper[i]-_lower[i];
    }

        std::tr1::array<C,dim>& lower()
    {
        return _lower;
    }

    std::tr1::array<C,dim>& upper()
    {
        return _upper;
    }

    const std::tr1::array<C,dim>& lower() const
    {
        return _lower;
    }

    const std::tr1::array<C,dim>& upper() const
    {
        return _upper;
    }

        /// Extends the box to contain given point.
    void extendBy(const std::tr1::array<C,dim>& point){
        for (int i=0; i<dim; i++) {
            _lower[i] = std::min(_lower[i], point[i]);
            _upper[i] = std::max(_upper[i], point[i]);
        }
    }

#ifndef PSURFACE_STANDALONE
    void extendBy(const McVec3f& point){
        for (int i=0; i<dim; i++) {
            _lower[i] = std::min(_lower[i], point[i]);
            _upper[i] = std::max(_upper[i], point[i]);
        }
    }
#endif

    /// Enlarges the box by 'eps' to each side
    void extendByEps(float eps){
        for (int i=0; i<dim; i++) {
            _lower[i] -= eps;
            _upper[i] += eps;
        }
    }


private:

    std::tr1::array<C,dim> _lower;
    std::tr1::array<C,dim> _upper;
};

} // namespace psurface

#endif // BOX_HH_