This file is indexed.

/usr/include/osgSim/Sector is in libopenscenegraph-dev 3.0.1-4.

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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 
 *
 * This library is open source and may be redistributed and/or modified under  
 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 
 * (at your option) any later version.  The full license is in LICENSE file
 * included with this distribution, and on the openscenegraph.org website.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 * OpenSceneGraph Public License for more details.
*/

#ifndef OSGSIM_SECTOR
#define OSGSIM_SECTOR 1

#include <osgSim/Export>

#include <osg/Quat>
#include <osg/Vec3>
#include <osg/Vec4>
#include <osg/Matrix>
#include <osg/Math>
#include <osg/Object>

namespace osgSim {

class Sector : public osg::Object
{
    public:
    
        Sector() {}
        
        Sector(const Sector& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY):
            osg::Object(copy,copyop) {}

        virtual const char *libraryName() const { return "osgSim"; }
        virtual const char *className() const { return "Sector"; }
        virtual bool isSameKindAs(const osg::Object *obj) const { return dynamic_cast<const Sector *>(obj) != 0; }
    
        virtual float operator() (const osg::Vec3& /*eyeLocal*/) const = 0;

    protected:

        virtual ~Sector() {}
};

class OSGSIM_EXPORT AzimRange
{
    public:

       AzimRange():
            _cosAzim(1.0f),
            _sinAzim(0.0f),
            _cosAngle(-1.0f),
            _cosFadeAngle(-1.0f) {}
            
        void setAzimuthRange(float minAzimuth,float maxAzimuth,float fadeAngle=0.0f);
        void getAzimuthRange(float& minAzimuth, float& maxAzimuth, float& fadeAngle) const;


        inline float azimSector(const osg::Vec3& eyeLocal) const
        {
            float dotproduct = eyeLocal.x()*_sinAzim+eyeLocal.y()*_cosAzim;
            float length = sqrt(osg::square(eyeLocal.x())+osg::square(eyeLocal.y()));
            if (dotproduct<_cosFadeAngle*length) return 0.0f; // out of sector.
            if (dotproduct>=_cosAngle*length) return 1.0f; // fully in sector.
            return (dotproduct-_cosFadeAngle*length)/((_cosAngle-_cosFadeAngle)*length);
        }

    protected:

        float _cosAzim;
        float _sinAzim;
        float _cosAngle;
        float _cosFadeAngle;
};


class OSGSIM_EXPORT ElevationRange
{
    public:
    
    
        ElevationRange():
            _cosMinElevation(-1.0f),
            _cosMinFadeElevation(-1.0f),
            _cosMaxElevation(1.0),
            _cosMaxFadeElevation(1.0) {}
            
        void setElevationRange(float minElevation,float maxElevation,float fadeAngle=0.0f);
        
        float getMinElevation() const;

        float getMaxElevation() const;

        float getFadeAngle() const;

        inline float elevationSector(const osg::Vec3& eyeLocal) const
        {
            float dotproduct = eyeLocal.z(); // against z axis - eyeLocal*(0,0,1).
            float length = eyeLocal.length();
            if (dotproduct>_cosMaxFadeElevation*length) return 0.0f; // out of sector
            if (dotproduct<_cosMinFadeElevation*length) return 0.0f; // out of sector
            if (dotproduct>_cosMaxElevation*length)
            {
                // in uppoer fade band.
                return (dotproduct-_cosMaxFadeElevation*length)/((_cosMaxElevation-_cosMaxFadeElevation)*length);
            }
            if (dotproduct<_cosMinElevation*length)
            {
                // in lower fade band.
                return (dotproduct-_cosMinFadeElevation*length)/((_cosMinElevation-_cosMinFadeElevation)*length);
            }
            return 1.0f; // fully in sector
        }
        
    protected:

        float _cosMinElevation;
        float _cosMinFadeElevation;
        float _cosMaxElevation;
        float _cosMaxFadeElevation;
};

class OSGSIM_EXPORT AzimSector : public Sector, public AzimRange
{
    public:
    
        AzimSector():
            Sector(),
            AzimRange() {}
    
        AzimSector(const AzimSector& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY):
            Sector(copy,copyop),
            AzimRange(copy) {}

        AzimSector(float minAzimuth,float maxAzimuth,float fadeAngle=0.0f);

        META_Object(osgSim,AzimSector);

        virtual float operator() (const osg::Vec3& eyeLocal) const;

    protected:

        virtual ~AzimSector() {}

};

class OSGSIM_EXPORT ElevationSector : public Sector, public ElevationRange
{
    public:
    
    
        ElevationSector():
            Sector(),
            ElevationRange() {}
            
        ElevationSector(const ElevationSector& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY):
            Sector(copy,copyop),
            ElevationRange(copy) {}
            
        ElevationSector(float minElevation,float maxElevation,float fadeAngle=0.0f);
    
        META_Object(osgSim,ElevationSector);

        virtual float operator() (const osg::Vec3& eyeLocal) const;
        
    protected:

        virtual ~ElevationSector() {}
};


class OSGSIM_EXPORT AzimElevationSector : public Sector, public AzimRange, public ElevationRange
{
    public:
    
        AzimElevationSector():
            Sector(),
            AzimRange(),
            ElevationRange() {}
    
        AzimElevationSector(const AzimElevationSector& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY):
            Sector(copy,copyop),
            AzimRange(copy),
            ElevationRange(copy) {}

        AzimElevationSector(float minAzimuth,float maxAzimuth,float minElevation,float maxElevation,float fadeAngle=0.0f);

        META_Object(osgSim,AzimElevationSector);

        virtual float operator() (const osg::Vec3& eyeLocal) const;

    protected:

        virtual ~AzimElevationSector() {}
};


class OSGSIM_EXPORT ConeSector : public Sector
{
    public:
    
        ConeSector():
            Sector(),
            _axis(0.0f,0.0f,1.0f),
            _cosAngle(-1.0f),
            _cosAngleFade(-1.0f) {}

        ConeSector(const ConeSector& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY):
            Sector(copy,copyop),
            _axis(copy._axis),
            _cosAngle(copy._cosAngle),
            _cosAngleFade(copy._cosAngleFade) {}

        ConeSector(const osg::Vec3& axis,float angle,float fadeangle=0.0f);

        META_Object(osgSim,ConeSector);

        void setAxis(const osg::Vec3& axis);
        
        const osg::Vec3& getAxis() const;

        void setAngle(float angle,float fadeangle=0.0f);
        
        float getAngle() const;
    
        float getFadeAngle() const;

        virtual float operator() (const osg::Vec3& eyeLocal) const;

    protected:

        virtual ~ConeSector() {}
    
        osg::Vec3   _axis;
        float       _cosAngle;
        float       _cosAngleFade;
};


/* The DirectionalSector class was created to better handle OpenFlight directional
  lightpoints.  The Elevation and Azimuth Sectors above impose invalid limits on
  the elevation range which cause lightpoints whose direction vectors are not
  on the XY plane to be displayed incorrectly.  Corbin Holtz 4/04 */

class OSGSIM_EXPORT DirectionalSector : public Sector
{
    public:
    
        DirectionalSector():
            Sector(),
            _direction(0.0f, 0.0f, 1.0f),
            _rollAngle(0.0f),
            _cosHorizAngle(-1.0f),
            _cosVertAngle(-1.0f),
            _cosHorizFadeAngle(-1.0f),
            _cosVertFadeAngle(-1.0f) {computeMatrix();}

        DirectionalSector(const DirectionalSector& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY):
            Sector(copy,copyop),
            _direction(copy._direction),
            _rollAngle(copy._rollAngle),
            _local_to_LP(copy._local_to_LP),
            _cosHorizAngle(copy._cosHorizAngle),
            _cosVertAngle(copy._cosVertAngle),
            _cosHorizFadeAngle(copy._cosHorizFadeAngle),
            _cosVertFadeAngle(copy._cosVertFadeAngle) {}

        DirectionalSector(const osg::Vec3& direction,float horizLobeAngle, float vertLobeAngle, float lobeRollAngle, float fadeAngle=0.0f);

        META_Object(osgSim,DirectionalSector);

        void setDirection(const osg::Vec3& direction);
        
        const osg::Vec3& getDirection() const;

        void setHorizLobeAngle(float angle);
        
        float getHorizLobeAngle() const;
    
        void setLobeRollAngle(float angle);
        
        float getLobeRollAngle() const;
    
        void setVertLobeAngle(float angle);
        
        float getVertLobeAngle() const;
    
        void setFadeAngle(float angle);
            
        float getFadeAngle() const;

        virtual float operator() (const osg::Vec3& eyeLocal) const;

        void computeMatrix() ;

    protected:

        virtual ~DirectionalSector() {}
    
        osg::Vec3   _direction ;
        float       _rollAngle ;
        osg::Matrix _local_to_LP ;
        float       _cosHorizAngle;
        float       _cosVertAngle;
        float       _cosHorizFadeAngle;
        float       _cosVertFadeAngle;
};

}

#endif