v0.1.0
Fast, portable C library for geometry input/output
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Modules
stl_occ_mesh.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** gmio
3 ** Copyright Fougue (24 Jun. 2016)
4 ** contact@fougue.pro
5 **
6 ** This software is a reusable library whose purpose is to provide complete
7 ** I/O support for various CAD file formats (eg. STL)
8 **
9 ** This software is governed by the CeCILL-B license under French law and
10 ** abiding by the rules of distribution of free software. You can use,
11 ** modify and/ or redistribute the software under the terms of the CeCILL-B
12 ** license as circulated by CEA, CNRS and INRIA at the following URL
13 ** "http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html".
14 ****************************************************************************/
15 
32 #ifndef __cplusplus
33 # error C++ compiler required
34 #endif
35 
36 #ifndef GMIO_SUPPORT_STL_OCC_MESH_H
37 #define GMIO_SUPPORT_STL_OCC_MESH_H
38 
39 #include "support_global.h"
40 #include "../gmio_stl/stl_mesh.h"
41 #include "../gmio_stl/stl_mesh_creator.h"
42 
43 #include <vector>
44 
45 #include <StlMesh_Mesh.hxx>
46 #include <StlMesh_MeshTriangle.hxx>
47 #include <TColgp_SequenceOfXYZ.hxx>
48 
62 {
64  explicit gmio_stl_mesh_occmesh(const StlMesh_Mesh* mesh);
65  explicit gmio_stl_mesh_occmesh(const Handle_StlMesh_Mesh& hnd);
66 
67  inline const StlMesh_Mesh* mesh() const { return m_mesh; }
68 
69 private:
70  static void get_triangle(
71  const void* cookie, uint32_t tri_id, gmio_stl_triangle* tri);
72 
73  void init_C_members();
74  void init_cache();
75 
76  struct triangle_data
77  {
78  const StlMesh_MeshTriangle* ptr_triangle;
79  const TColgp_SequenceOfXYZ* ptr_vec_vertices;
80  };
81 
82  const StlMesh_Mesh* m_mesh;
83  int m_mesh_domain_count;
84 
85  // Data to be used when mesh domain_count > 1
86  std::vector<triangle_data> m_vec_triangle_data;
87  // Data to be used when mesh domain_count == 1
88  const StlMesh_SequenceOfMeshTriangle* m_seq_triangle;
89  const TColgp_SequenceOfXYZ* m_seq_vertex;
90 };
91 
98 
104 gmio_stl_mesh_creator gmio_stl_occmesh_creator(const Handle_StlMesh_Mesh& hnd);
105 
106 #endif /* GMIO_SUPPORT_STL_OCC_MESH_H */
107 
const StlMesh_Mesh * mesh() const
Definition: stl_occ_mesh.h:67
gmio_stl_mesh_creator gmio_stl_occmesh_creator(StlMesh_Mesh *mesh)
Returns a gmio_stl_mesh_creator that will build a new domain in a StlMesh_Mesh object.
Provides an interface for accessing the underlying(hidden) user mesh.
Definition: stl_mesh.h:30
const void * cookie
Opaque pointer on the user mesh, passed as first argument to hook functions.
Definition: stl_mesh.h:34
STL mesh triangle.
Definition: stl_triangle.h:30
Provides access to all the triangles of OpenCascade's StlMesh_Mesh.
Definition: stl_occ_mesh.h:61
Provides an interface for the creation of the underlying(hidden) user mesh.
Definition: stl_mesh_creator.h:71
Global declarations for the support module.
Fougue © 2016