v0.3.0
Fast, portable C library for geometry input/output
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Modules
stl_occ_brep.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (c) 2016, Fougue Ltd. <http://www.fougue.pro>
3 ** All rights reserved.
4 **
5 ** Redistribution and use in source and binary forms, with or without
6 ** modification, are permitted provided that the following conditions
7 ** are met:
8 **
9 ** 1. Redistributions of source code must retain the above copyright
10 ** notice, this list of conditions and the following disclaimer.
11 **
12 ** 2. Redistributions in binary form must reproduce the above
13 ** copyright notice, this list of conditions and the following
14 ** disclaimer in the documentation and/or other materials provided
15 ** with the distribution.
16 **
17 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 ****************************************************************************/
29 
46 #ifndef __cplusplus
47 # error C++ compiler required
48 #endif
49 
50 #ifndef GMIO_SUPPORT_STL_OCC_BREP_H
51 #define GMIO_SUPPORT_STL_OCC_BREP_H
52 
53 #include "support_global.h"
54 #include "../gmio_stl/stl_mesh.h"
55 
56 #include <vector>
57 
58 #include <Poly_Triangulation.hxx>
59 #include <TopoDS_Shape.hxx>
60 class TopoDS_Face;
61 
76 {
78  explicit gmio_stl_mesh_occshape(const TopoDS_Shape& shape);
79 
80  inline const TopoDS_Shape* shape() const { return m_shape; }
81 
82 private:
83  static void get_triangle(
84  const void* cookie, uint32_t tri_id, gmio_stl_triangle* tri);
85 
86  void init_C_members();
87 
88  struct face_data {
89  gp_Trsf trsf;
90  bool is_reversed;
91  const TColgp_Array1OfPnt* ptr_nodes;
92  };
93  struct triangle_data {
94  const Poly_Triangle* ptr_triangle;
95  const face_data* ptr_face_data;
96  };
97 
98  std::vector<face_data> m_vec_face_data;
99  std::vector<triangle_data> m_vec_triangle_data;
100  const TopoDS_Shape* m_shape;
101 };
102 
103 #endif /* GMIO_SUPPORT_STL_OCC_BREP_H */
104 
Provides an interface for accessing the underlying(hidden) user mesh.
Definition: stl_mesh.h:44
const void * cookie
Opaque pointer on the user mesh, passed as first argument to hook functions.
Definition: stl_mesh.h:48
STL mesh triangle.
Definition: stl_triangle.h:44
Provides access to all the internal triangles of OpenCascade's TopoDS_Shape.
Definition: stl_occ_brep.h:75
Global declarations for the support module.
const TopoDS_Shape * shape() const
Definition: stl_occ_brep.h:80
Fougue © 2016