This file is indexed.

/usr/include/CGAL/IO/STL_reader.h is in libcgal-dev 4.11-2build1.

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
// Copyright (c) 2015 GeometryFactory
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 3 of the License,
// or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
// Author(s)     : Andreas Fabri

#ifndef CGAL_IO_STL_READER_H
#define CGAL_IO_STL_READER_H

#include <CGAL/license/Polyhedron.h>


#include <CGAL/array.h>
#include <boost/cstdint.hpp> 
#include <vector>
#include <map>
#include <iostream>
#include <string>

namespace CGAL{

  bool
  read_STL( std::istream& input,
            std::vector< cpp11::array<double,3> >& points,
            std::vector< cpp11::array<int,3> >& facets,
            bool verbose = false)
  {
    std::string s, solid("solid");
    std::map<cpp11::array<double,3>, int> pmap;
    int index = 0;
    cpp11::array<int,3> ijk;
    cpp11::array<double,3> p;

    char line[80];
    for(int i=0;i < 80; i++){
      boost::uint8_t c;
      input.read(reinterpret_cast<char*>(&c), sizeof(c));
      line[i]=c;
      if(i==5){
        s = std::string(line,5);
        if(s == solid){
          break;
        }
      }
    }

    if(s!= solid){
      boost::uint32_t N32;
      input.read(reinterpret_cast<char*>(&N32), sizeof(N32));
      unsigned int N = N32;

      for(unsigned int i=0; i < N; i++){
        float normal[3];
        input.read(reinterpret_cast<char*>(&normal[0]), sizeof(normal[0]));
        input.read(reinterpret_cast<char*>(&normal[1]), sizeof(normal[1]));
        input.read(reinterpret_cast<char*>(&normal[2]), sizeof(normal[2]));

        for(int j=0; j < 3; j++){
          float x,y,z;
          input.read(reinterpret_cast<char*>(&x), sizeof(x));
          input.read(reinterpret_cast<char*>(&y), sizeof(y));
          input.read(reinterpret_cast<char*>(&z), sizeof(z));
          p[0]=x; p[1]=y; p[2]=z;
          std::map<cpp11::array<double,3>, int>::iterator iti=
            pmap.insert(std::make_pair(p,-1)).first;
          if(iti->second==-1){
            ijk[j] = index;
            iti->second = index++;
            points.push_back(p);
          } else {
            ijk[j] = iti->second;
          }
        }
        if((ijk[0] != ijk[1]) && 
           (ijk[0] != ijk[2]) &&
           (ijk[1] != ijk[2])){
          facets.push_back(ijk);
        }else{
          if(verbose){
            std::cerr << "ignore degenerate face" << std::endl;
          }
        }
        char c;
        input.read(reinterpret_cast<char*>(&c), sizeof(c));
        input.read(reinterpret_cast<char*>(&c), sizeof(c));
      }
      return true;
    } else {
      std::string facet("facet"),
        outer("outer"),
        loop("loop"),
        vertex("vertex"),
        endloop("endloop"),
        endsolid("endsolid");

      while(input >> s){
        if(s == endsolid){
          //std::cerr << "found endsolid" << std::endl;
        } else if(s == facet){
          //std::cerr << "found facet" << std::endl;
          std::getline(input, s); // ignore the normal
          input >> s;
          if(s != outer){
            if (verbose)
              std::cerr << "Expect 'outer' and got " << s << std::endl;
            return false;
          }
          input >> s;
          if(s != loop){
            if (verbose)
              std::cerr << "Expect 'loop' and got " << s << std::endl;
            return false;
          }
          int count = 0;
          do {
            input >> s;
            if(s == vertex){
              //      std::cerr << "found vertex" << std::endl;
              if(count < 3){
                input >> p[0] >> p[1] >> p[2];
                std::map<cpp11::array<double,3>, int>::iterator iti=
                  pmap.insert(std::make_pair(p,-1)).first;
                if(iti->second==-1){
                  ijk[count] = index;
                  iti->second = index++;
                  points.push_back(p);
                } else {
                  ijk[count] = iti->second;
                }
                ++count;
              } else {
                if (verbose)
                  std::cerr << "We can only read triangulated surfaces" << std::endl;
                return false;
              }
            }
          }while(s != endloop);
          
          facets.push_back(ijk);
        }
      }
      return true;
    }
  }
} // namespace CGAL

#endif // CGAL_IO_STL_READER_H