This file is indexed.

/usr/include/vmmlib/aabb.hpp is in libvmmlib-dev 1.0-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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
#ifndef __VMML__AXIS_ALIGNED_BOUNDING_BOX__HPP__
#define __VMML__AXIS_ALIGNED_BOUNDING_BOX__HPP__

#include <vmmlib/vector.hpp>

namespace vmml
{

template< typename T >
class AxisAlignedBoundingBox
{
public:
    AxisAlignedBoundingBox();
    AxisAlignedBoundingBox( const vector< 3, T >& pMin, const vector< 3, T >& pMax );
    AxisAlignedBoundingBox( const vector< 4, T >& sphere );
    AxisAlignedBoundingBox( T cx, T cy, T cz, T size );
    
    inline bool isIn( const vector< 3, T >& pos );
    inline bool isIn2d( const vector< 3, T >& pos ); // only x and y components are checked
    inline bool isIn( const vector< 4, T >& sphere );

    inline void set( const vector< 3, T >& pMin, const vector< 3, T >& pMax );
    inline void set( T cx, T cy, T cz, T size );
	inline void setMin( const vector< 3, T >& pMin );
	inline void setMax( const vector< 3, T >& pMax );
    inline const vector< 3, T >& getMin() const;
    inline const vector< 3, T >& getMax() const;
    
    inline void merge( const AxisAlignedBoundingBox< T >& aabb );
    
    inline void setEmpty( bool empty = true );
    inline bool isEmpty() const;
    inline void setDirty( bool dirty = true );
    inline bool isDirty() const;
    
    vector< 3, T > getCenter() const;

protected:
	vector< 3, T > _min;
	vector< 3, T > _max;
    bool _dirty;
    bool _empty;
    
};



template< typename T >
AxisAlignedBoundingBox< T >::AxisAlignedBoundingBox()
    : _dirty( false )
    , _empty( true )
{}



template< typename T >
AxisAlignedBoundingBox< T >::AxisAlignedBoundingBox( const vector< 3, T >& pMin, const vector< 3, T >& pMax )
    : _min( pMin )
    , _max( pMax )
    , _dirty( false )
    , _empty( false )
{}



template< typename T >
AxisAlignedBoundingBox< T >::AxisAlignedBoundingBox( const vector< 4, T >& sphere )
    : _dirty( false )
    , _empty( false )
{
    _max = _min = sphere.getCenter();
    _max += sphere.getRadius();
    _min -= sphere.getRadius();
}



template< typename T >
AxisAlignedBoundingBox< T >::AxisAlignedBoundingBox( T cx, T cy, T cz, T size )
    : _dirty( false )
    , _empty( false )
{
    _max = _min = Vector3f( cx, cy, cz );
    _max += size;
    _min -= size;
}



template< typename T >
inline bool AxisAlignedBoundingBox< T >::isIn( const vector< 4, T >& sphere )
{
    if ( _empty ) 
        return false;
    vector< 3, T > sv ( sphere.getCenter() );
    sv += sphere.getRadius();
    if ( sv.x() > _max.x() || sv.y() > _max.y() || sv.z() > _max.z() )
        return false;
    sv -= sphere.getRadius() * 2.0f;
    if ( sv.x() < _min.x() || sv.y() < _min.y() || sv.z() < _min.z() )
        return false;
    return true;
}



template< typename T >
inline bool AxisAlignedBoundingBox< T >::isIn( const vector< 3, T >& pos )
{
    if ( _empty ) 
        return false;
    if ( pos.x() > _max.x() || pos.y() > _max.y() || pos.z() > _max.z() 
            || pos.x() < _min.x() || pos.y() < _min.y() || pos.z() < _min.z() )
    {
        return false;
    }
    return true;
}



template< typename T >
inline bool AxisAlignedBoundingBox< T >::isIn2d( const vector< 3, T >& pos )
{
    if ( _empty ) 
        return false;
    if ( pos.x() > _max.x() || pos.y() > _max.y() || pos.x() < _min.x() 
        || pos.y() < _min.y() )
    {
        return false;
    }
    return true;
}



template< typename T >
inline void AxisAlignedBoundingBox< T >::set( const vector< 3, T >& pMin, 
    const vector< 3, T >& pMax )
{
    _min = pMin;
    _max = pMax;
    _empty = false;
}



template< typename T >
inline void AxisAlignedBoundingBox< T >::set( T cx, T cy, T cz, T size )
{
    vector< 3, T > center( cx, cy, cz );
    _min = center - size;
    _max = center + size;
    _empty = false;
}



template< typename T >
inline void AxisAlignedBoundingBox< T >::setMin( const vector< 3, T >& pMin ) 
{ 
    _min = pMin; 
}



template< typename T >
inline void AxisAlignedBoundingBox< T >::setMax( const vector< 3, T >& pMax ) 
{ 
    _max = pMax; 
}



template< typename T >
inline const vector< 3, T >& AxisAlignedBoundingBox< T >::getMin() const 
{   
    return _min; 
}



template< typename T >
inline const vector< 3, T >& AxisAlignedBoundingBox< T >::getMax() const
{ 
    return _max; 
}



template< typename T >
vector< 3, T > 
AxisAlignedBoundingBox< T >::getCenter() const
{
    return _min + ( ( _max - _min ) * 0.5f );
}



template< typename T >
void 
AxisAlignedBoundingBox< T >::merge( const AxisAlignedBoundingBox< T >& aabb )
{
    if ( aabb._empty )
        return; // nothing to do

    if ( _empty )
    {
        // copy non-empty aabb
        _min = aabb._min;
        _max = aabb._max;
        _empty = _dirty = false;
        return;
    }
    
    // else merge the two aabbs
    const vector< 3, T >& min = aabb.getMin();
    const vector< 3, T >& max = aabb.getMax();
    
    if ( min.x() < _min.x() )
        _min.x() = min.x();
    if ( min.y() < _min.y() )
        _min.y() = min.y();
    if ( min.z() < _min.z() )
        _min.z() = min.z();

    if ( max.x() > _max.x() )
        _max.x() = max.x();
    if ( max.y() > _max.y() )
        _max.y() = max.y();
    if ( max.z() > _max.z() )
        _max.z() = max.z();
}



template< typename T >
inline void  
AxisAlignedBoundingBox< T >::setEmpty( bool empty )
{
    _empty = empty;
}



template< typename T >
inline bool 
AxisAlignedBoundingBox< T >::isEmpty() const
{
    return _empty;
}



template< typename T >
inline void  
AxisAlignedBoundingBox< T >::setDirty( bool dirty )
{
    _dirty = dirty;
}



template< typename T >
inline bool 
AxisAlignedBoundingBox< T >::isDirty() const
{
    return _dirty;
}



typedef AxisAlignedBoundingBox< float > Aabbf;

}; //namespace vmml

#endif