Gazebo Common

API Reference

4.7.0
gz/common/STLLoader.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Open Source Robotics Foundation
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 IGNITION_COMMON_STLLOADER_HH_
18 #define IGNITION_COMMON_STLLOADER_HH_
19 
20 #include <stdint.h>
21 #include <string>
22 
23 #include <ignition/utils/ImplPtr.hh>
24 
25 #include <gz/common/config.hh>
26 #include "gz/common/MeshLoader.hh"
27 #include "gz/common/graphics/Export.hh"
28 
29 #define LINE_MAX_LEN 256
30 #define COR3_MAX 200000
31 #define ORDER_MAX 10
32 #define FACE_MAX 200000
33 
34 namespace ignition
35 {
36  namespace common
37  {
40  class IGNITION_COMMON_GRAPHICS_VISIBLE STLLoader : public MeshLoader
41  {
43  public: STLLoader();
44 
46  public: virtual ~STLLoader();
47 
50  public: virtual Mesh *Load(const std::string &_filename);
51 
56  private: bool ReadAscii(FILE *_filein, Mesh *_mesh);
57 
62  private: bool ReadBinary(FILE *_filein, Mesh *_mesh);
63 
68  private: bool Leqi(char* _string1, char* _string2);
69 
76  private: int RcolFind(float _a[][COR3_MAX], int _m, int _n, float _r[]);
77 
81  private: uint32_t LongIntRead(FILE *_filein);
82 
87  private: bool ShortIntRead(FILE *_filein, uint16_t &_value);
88 
93  private: bool FloatRead(FILE *_filein, double &_value);
94 
96  IGN_UTILS_IMPL_PTR(dataPtr)
97  };
98  }
99 }
100 #endif
Forward declarations for the common classes.
STL class.
Class used to load STL mesh files.
Definition: gz/common/STLLoader.hh:40
#define COR3_MAX
Definition: gz/common/STLLoader.hh:30
Base class for loading meshes.
Definition: gz/common/MeshLoader.hh:33
A 3D mesh.
Definition: gz/common/Mesh.hh:42