v0.4.1
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) 2017, 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 
47 #ifndef __cplusplus
48 # error C++ compiler required
49 #endif
50 
51 #pragma once
52 
53 #include "support_global.h"
54 #include "stl_occ_polytri.h"
55 #include "../gmio_stl/stl_mesh.h"
56 
57 #include <Poly_Triangulation.hxx>
58 #include <TopoDS_Shape.hxx>
59 #include <vector>
60 
74 {
76  explicit gmio_stl_mesh_occshape(const TopoDS_Shape& shape);
77 
78  const TopoDS_Shape* shape() const { return m_shape; }
79 
80 private:
81  static void get_triangle(
82  const void* cookie, uint32_t tri_id, gmio_stl_triangle* tri);
83 
84  void init_C_members();
85 
86  struct face_data {
87  gp_Trsf trsf;
88  bool is_reversed;
89  const TColgp_Array1OfPnt* ptr_nodes;
90  };
91  struct triangle_data {
92  const Poly_Triangle* ptr_triangle;
93  const face_data* ptr_face_data;
94  };
95 
96  std::vector<face_data> m_vec_face_data;
97  std::vector<triangle_data> m_vec_triangle_data;
98  const TopoDS_Shape* m_shape;
99 };
100 
112 {
113 public:
115  TopoDS_Shape& shape() { return m_shape; }
116 
117 private:
118  static void end_solid(void* cookie);
119  void (*m_func_end_solid_occpolytri)(void* cookie);
120  TopoDS_Shape m_shape;
121 };
122 
Provides creation of an OpenCascade TopoDS_Shape containing no geometrical surfaces but only a Poly_T...
Definition: stl_occ_brep.h:111
TopoDS_Shape & shape()
Definition: stl_occ_brep.h:115
Provides an interface for accessing the underlying(hidden) user mesh.
Definition: stl_mesh.h:43
STL support of OpenCascade's Poly_Triangulation.
const void * cookie
Opaque pointer on the user mesh, passed as first argument to hook functions.
Definition: stl_mesh.h:47
void * cookie
Opaque pointer on the user mesh, passed as first argument to hook functions.
Definition: stl_mesh_creator.h:82
STL mesh triangle.
Definition: stl_triangle.h:43
Provides access to the internal triangles of an OpenCascade TopoDS_Shape.
Definition: stl_occ_brep.h:73
Provides creation of an OpenCascade Poly_Triangulation.
Definition: stl_occ_polytri.h:99
Global declarations for the support module.
const TopoDS_Shape * shape() const
Definition: stl_occ_brep.h:78
Fougue © 2017