All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
STLLoader.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2011 Nate Koenig
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 #ifndef STLLOADER_HH
18 #define STLLOADER_HH
19 
20 #include <stdint.h>
21 #include <string>
22 
23 #include "common/MeshLoader.hh"
24 
25 #define LINE_MAX_LEN 256
26 #define COR3_MAX 200000
27 #define ORDER_MAX 10
28 #define FACE_MAX 200000
29 
30 namespace gazebo
31 {
32  namespace common
33  {
36 
38  class STLLoader : public MeshLoader
39  {
41  public: STLLoader();
42 
44  public: virtual ~STLLoader();
45 
48  public: virtual Mesh *Load(const std::string &filename);
49 
53  private: bool ReadAscii(FILE *_filein, Mesh *_mesh);
54 
58  private: bool ReadBinary(FILE *_filein, Mesh *_mesh);
59 
64  private: bool Leqi(char* _string1, char* _string2);
65 
71  private: int RcolFind(float _a[][COR3_MAX], int _m, int _n, float _r[]);
72 
76  private: uint32_t LongIntRead(FILE *_filein);
77 
82  private: bool ShortIntRead(FILE *_filein, uint16_t &_value);
83 
88  private: bool FloatRead(FILE *_filein, double &_value);
89  };
91  }
92 }
93 #endif
94