OCCT-Light 0.1
C ABI and C++ veneer for multi-language CAD workflows
Loading...
Searching...
No Matches
mesh.hpp
Go to the documentation of this file.
1// Copyright (c) 2026 Capgemini Engineering Research and Development.
2//
3// This file is part of OCCT-Light software library.
4//
5// This library is free software; you can redistribute it and/or modify it under
6// the terms of the GNU Affero General Public License version 3 as published
7// by the Free Software Foundation, with an option to use any later version.
8// Consult the file LICENSE_AGPL_30.txt included in OCCT-Light distribution
9// for complete text of the license and disclaimer of any warranty.
10//
11// Alternatively, this file may be used under the terms of a commercial
12// license or contractual agreement.
13//
14// SPDX-License-Identifier: AGPL-3.0-or-later
15
24#ifndef OCCTL_HPP_MESH_HPP
25#define OCCTL_HPP_MESH_HPP
26
27#include <occtl/occtl_mesh.h>
28
29#include <occtl-hpp/core.hpp>
30#include <occtl-hpp/geom.hpp>
31#include <occtl-hpp/topo.hpp>
32
33#include <cstddef>
34#include <cstdint>
35#include <optional>
36#include <string>
37#include <vector>
38
39#if defined(__cpp_lib_span) && __cpp_lib_span >= 202002L
40 #include <span>
41 #ifndef OCCTL_HPP_HAS_SPAN
42 #define OCCTL_HPP_HAS_SPAN 1
43 #endif
44#else
45 #ifndef OCCTL_HPP_HAS_SPAN
46 #define OCCTL_HPP_HAS_SPAN 0
47 #endif
48#endif
49
50namespace occtl::mesh
51{
52
54struct AABB3
55{
56 Point3 min;
57 Point3 max;
58};
59
64struct Options
65{
66 double deflection = 0.001;
67 double angle = 0.5;
68 double deflection_interior = -1.0;
69 double angle_interior = -1.0;
70 double min_size = -1.0;
71 bool in_parallel = false;
72 bool relative = false;
73 bool internal_vertices_mode = true;
74 bool control_surface_deflection = true;
75 bool control_surface_deflection_all = false;
76 bool clean_model = true;
77 bool adjust_min_size = false;
78 bool force_face_deflection = false;
79 bool allow_quality_decrease = false;
80
81 std::optional<AABB3> bbox;
82 double deviation_coefficient = 0.001;
83 double deviation_angle = 0.3490658503988659; // 20°
84
86 [[nodiscard]] ::occtl_mesh_options_t to_c() const noexcept
87 {
89 aOpts.deflection = deflection;
90 aOpts.angle = angle;
91 aOpts.deflection_interior = deflection_interior;
92 aOpts.angle_interior = angle_interior;
93 aOpts.min_size = min_size;
94 aOpts.in_parallel = in_parallel ? 1 : 0;
95 aOpts.relative = relative ? 1 : 0;
96 aOpts.internal_vertices_mode = internal_vertices_mode ? 1 : 0;
97 aOpts.control_surface_deflection = control_surface_deflection ? 1 : 0;
98 aOpts.control_surface_deflection_all = control_surface_deflection_all ? 1 : 0;
99 aOpts.clean_model = clean_model ? 1 : 0;
100 aOpts.adjust_min_size = adjust_min_size ? 1 : 0;
101 aOpts.force_face_deflection = force_face_deflection ? 1 : 0;
102 aOpts.allow_quality_decrease = allow_quality_decrease ? 1 : 0;
103 aOpts.deviation_coefficient = deviation_coefficient;
104 aOpts.deviation_angle = deviation_angle;
105 if (bbox.has_value())
106 {
107 aOpts.use_bbox = 1;
108 aOpts.bbox.min = bbox->min.c_type();
109 aOpts.bbox.max = bbox->max.c_type();
110 }
111 return aOpts;
112 }
113};
114
117
120{
121public:
122 TriangulationView() noexcept = default;
123
124 explicit TriangulationView(const ::occtl_triangulation_view_t& theC) noexcept
125 : myC(theC)
126 {
127 }
128
129#if OCCTL_HPP_HAS_SPAN
130 [[nodiscard]] std::span<const double> nodes() const noexcept
131 {
132 return {myC.nodes, myC.node_count * 3u};
133 }
134
135 [[nodiscard]] std::span<const double> normals() const noexcept
136 {
137 return myC.normals != nullptr ? std::span<const double>{myC.normals, myC.node_count * 3u}
138 : std::span<const double>{};
139 }
140
141 [[nodiscard]] std::span<const double> uvs() const noexcept
142 {
143 return myC.uvs != nullptr ? std::span<const double>{myC.uvs, myC.node_count * 2u}
144 : std::span<const double>{};
145 }
146
147 [[nodiscard]] std::span<const uint32_t> triangles() const noexcept
148 {
149 return {myC.triangles, myC.triangle_count * 3u};
150 }
151#else
152 [[nodiscard]] const double* nodes() const noexcept { return myC.nodes; }
153
154 [[nodiscard]] const double* normals() const noexcept { return myC.normals; }
155
156 [[nodiscard]] const double* uvs() const noexcept { return myC.uvs; }
157
158 [[nodiscard]] const uint32_t* triangles() const noexcept { return myC.triangles; }
159#endif
160
161 [[nodiscard]] std::size_t node_count() const noexcept { return myC.node_count; }
162
163 [[nodiscard]] std::size_t triangle_count() const noexcept { return myC.triangle_count; }
164
165 [[nodiscard]] double deflection() const noexcept { return myC.deflection; }
166
167 [[nodiscard]] UID source_uid() const noexcept { return UID(myC.source_uid); }
168
169 [[nodiscard]] bool has_normals() const noexcept { return myC.normals != nullptr; }
170
171 [[nodiscard]] bool has_uvs() const noexcept { return myC.uvs != nullptr; }
172
173 [[nodiscard]] const ::occtl_triangulation_view_t& c() const noexcept { return myC; }
174
175private:
177};
178
181{
182public:
183 Polygon3DView() noexcept = default;
184
185 explicit Polygon3DView(const ::occtl_polygon3d_view_t& theC) noexcept
186 : myC(theC)
187 {
188 }
189
190#if OCCTL_HPP_HAS_SPAN
191 [[nodiscard]] std::span<const double> nodes() const noexcept
192 {
193 return {myC.nodes, myC.node_count * 3u};
194 }
195
196 [[nodiscard]] std::span<const double> parameters() const noexcept
197 {
198 return myC.parameters != nullptr ? std::span<const double>{myC.parameters, myC.node_count}
199 : std::span<const double>{};
200 }
201#else
202 [[nodiscard]] const double* nodes() const noexcept { return myC.nodes; }
203
204 [[nodiscard]] const double* parameters() const noexcept { return myC.parameters; }
205#endif
206
207 [[nodiscard]] std::size_t node_count() const noexcept { return myC.node_count; }
208
209 [[nodiscard]] double deflection() const noexcept { return myC.deflection; }
210
211 [[nodiscard]] UID source_uid() const noexcept { return UID(myC.source_uid); }
212
213 [[nodiscard]] bool has_parameters() const noexcept { return myC.parameters != nullptr; }
214
215 [[nodiscard]] const ::occtl_polygon3d_view_t& c() const noexcept { return myC; }
216
217private:
219};
220
223{
224public:
225 PolygonOnTriView() noexcept = default;
226
227 explicit PolygonOnTriView(const ::occtl_polygon_on_tri_view_t& theC) noexcept
228 : myC(theC)
229 {
230 }
231
232#if OCCTL_HPP_HAS_SPAN
233 [[nodiscard]] std::span<const uint32_t> node_indices() const noexcept
234 {
235 return {myC.node_indices, myC.node_count};
236 }
237
238 [[nodiscard]] std::span<const double> parameters() const noexcept
239 {
240 return myC.parameters != nullptr ? std::span<const double>{myC.parameters, myC.node_count}
241 : std::span<const double>{};
242 }
243#else
244 [[nodiscard]] const uint32_t* node_indices() const noexcept { return myC.node_indices; }
245
246 [[nodiscard]] const double* parameters() const noexcept { return myC.parameters; }
247#endif
248
249 [[nodiscard]] std::size_t node_count() const noexcept { return myC.node_count; }
250
251 [[nodiscard]] double deflection() const noexcept { return myC.deflection; }
252
253 [[nodiscard]] UID source_uid() const noexcept { return UID(myC.source_uid); }
254
255 [[nodiscard]] bool has_parameters() const noexcept { return myC.parameters != nullptr; }
256
257 [[nodiscard]] const ::occtl_polygon_on_tri_view_t& c() const noexcept { return myC; }
258
259private:
261};
262
265{
266public:
267 TriangleBuffersView() noexcept = default;
268
269 explicit TriangleBuffersView(const ::occtl_mesh_triangle_buffers_view_t& theC) noexcept
270 : myC(theC)
271 {
272 }
273
274#if OCCTL_HPP_HAS_SPAN
275 [[nodiscard]] std::span<const double> nodes() const noexcept
276 {
277 return {myC.nodes, myC.node_count * 3u};
278 }
279
280 [[nodiscard]] std::span<const uint32_t> triangles() const noexcept
281 {
282 return {myC.triangles, myC.triangle_count * 3u};
283 }
284#else
285 [[nodiscard]] const double* nodes() const noexcept { return myC.nodes; }
286
287 [[nodiscard]] const uint32_t* triangles() const noexcept { return myC.triangles; }
288#endif
289
290 [[nodiscard]] std::size_t node_count() const noexcept { return myC.node_count; }
291
292 [[nodiscard]] std::size_t triangle_count() const noexcept { return myC.triangle_count; }
293
294 [[nodiscard]] std::size_t face_count() const noexcept { return myC.face_count; }
295
296 [[nodiscard]] NodeId root() const noexcept { return NodeId(myC.root); }
297
298 [[nodiscard]] const ::occtl_mesh_triangle_buffers_view_t& c() const noexcept { return myC; }
299
300private:
302};
303
306{
307public:
308 TriangleAnalysisView() noexcept = default;
309
310 explicit TriangleAnalysisView(const ::occtl_mesh_triangle_analysis_view_t& theC) noexcept
311 : myC(theC)
312 {
313 }
314
315#if OCCTL_HPP_HAS_SPAN
316 [[nodiscard]] std::span<const double> triangle_normals() const noexcept
317 {
318 return {myC.triangle_normals, myC.triangle_count * 3u};
319 }
320
321 [[nodiscard]] std::span<const uint32_t> triangle_adjacency() const noexcept
322 {
323 return {myC.triangle_adjacency, myC.triangle_count * 3u};
324 }
325#else
326 [[nodiscard]] const double* triangle_normals() const noexcept { return myC.triangle_normals; }
327
328 [[nodiscard]] const uint32_t* triangle_adjacency() const noexcept
329 {
330 return myC.triangle_adjacency;
331 }
332#endif
333
334 [[nodiscard]] std::size_t triangle_count() const noexcept { return myC.triangle_count; }
335
336 [[nodiscard]] std::size_t face_count() const noexcept { return myC.face_count; }
337
338 [[nodiscard]] NodeId root() const noexcept { return NodeId(myC.root); }
339
340 [[nodiscard]] const ::occtl_mesh_triangle_analysis_view_t& c() const noexcept { return myC; }
341
342private:
344};
345
347
350{
351public:
352 TriangleComponentsView() noexcept = default;
353
354 explicit TriangleComponentsView(const ::occtl_mesh_triangle_components_view_t& theC) noexcept
355 : myC(theC)
356 {
357 }
358
359#if OCCTL_HPP_HAS_SPAN
360 [[nodiscard]] std::span<const uint32_t> triangle_component_ids() const noexcept
361 {
362 return {myC.triangle_component_ids, myC.triangle_count};
363 }
364
365 [[nodiscard]] std::span<const uint32_t> component_sizes() const noexcept
366 {
367 return {myC.component_sizes, myC.component_count};
368 }
369#else
370 [[nodiscard]] const uint32_t* triangle_component_ids() const noexcept
371 {
372 return myC.triangle_component_ids;
373 }
374
375 [[nodiscard]] const uint32_t* component_sizes() const noexcept { return myC.component_sizes; }
376#endif
377
378 [[nodiscard]] std::size_t triangle_count() const noexcept { return myC.triangle_count; }
379
380 [[nodiscard]] std::size_t component_count() const noexcept { return myC.component_count; }
381
382 [[nodiscard]] NodeId root() const noexcept { return NodeId(myC.root); }
383
384 [[nodiscard]] const ::occtl_mesh_triangle_components_view_t& c() const noexcept { return myC; }
385
386private:
388};
389
392{
393public:
394 TriangleComponentTrianglesView() noexcept = default;
395
397 const ::occtl_mesh_triangle_component_triangles_view_t& theC) noexcept
398 : myC(theC)
399 {
400 }
401
402#if OCCTL_HPP_HAS_SPAN
403 [[nodiscard]] std::span<const uint32_t> triangles() const noexcept
404 {
405 return {myC.triangles, myC.triangle_count};
406 }
407#else
408 [[nodiscard]] const uint32_t* triangles() const noexcept { return myC.triangles; }
409#endif
410
411 [[nodiscard]] std::size_t triangle_count() const noexcept { return myC.triangle_count; }
412
413 [[nodiscard]] uint32_t component_id() const noexcept { return myC.component_id; }
414
415 [[nodiscard]] NodeId root() const noexcept { return NodeId(myC.root); }
416
417 [[nodiscard]] const ::occtl_mesh_triangle_component_triangles_view_t& c() const noexcept
418 {
419 return myC;
420 }
421
422private:
424};
425
428{
429public:
430 TriangleComponentBoundaryView() noexcept = default;
431
433 const ::occtl_mesh_triangle_component_boundary_view_t& theC) noexcept
434 : myC(theC)
435 {
436 }
437
438#if OCCTL_HPP_HAS_SPAN
439 [[nodiscard]] std::span<const ::occtl_mesh_triangle_component_boundary_edge_t> edges()
440 const noexcept
441 {
442 return {myC.edges, myC.edge_count};
443 }
444#else
445 [[nodiscard]] const ::occtl_mesh_triangle_component_boundary_edge_t* edges() const noexcept
446 {
447 return myC.edges;
448 }
449#endif
450
451 [[nodiscard]] std::size_t edge_count() const noexcept { return myC.edge_count; }
452
453 [[nodiscard]] uint32_t component_id() const noexcept { return myC.component_id; }
454
455 [[nodiscard]] NodeId root() const noexcept { return NodeId(myC.root); }
456
457 [[nodiscard]] const ::occtl_mesh_triangle_component_boundary_view_t& c() const noexcept
458 {
459 return myC;
460 }
461
462private:
464};
465
468{
469public:
470 TriangleComponentBoundaryChainsView() noexcept = default;
471
473 const ::occtl_mesh_triangle_component_boundary_chains_view_t& theC) noexcept
474 : myC(theC)
475 {
476 }
477
478#if OCCTL_HPP_HAS_SPAN
479 [[nodiscard]] std::span<const ::occtl_mesh_triangle_component_boundary_edge_t> edges()
480 const noexcept
481 {
482 return {myC.edges, myC.edge_count};
483 }
484
485 [[nodiscard]] std::span<const ::occtl_mesh_triangle_component_boundary_chain_t> chains()
486 const noexcept
487 {
488 return {myC.chains, myC.chain_count};
489 }
490#else
491 [[nodiscard]] const ::occtl_mesh_triangle_component_boundary_edge_t* edges() const noexcept
492 {
493 return myC.edges;
494 }
495
496 [[nodiscard]] const ::occtl_mesh_triangle_component_boundary_chain_t* chains() const noexcept
497 {
498 return myC.chains;
499 }
500#endif
501
502 [[nodiscard]] std::size_t edge_count() const noexcept { return myC.edge_count; }
503
504 [[nodiscard]] std::size_t chain_count() const noexcept { return myC.chain_count; }
505
506 [[nodiscard]] uint32_t component_id() const noexcept { return myC.component_id; }
507
508 [[nodiscard]] NodeId root() const noexcept { return NodeId(myC.root); }
509
510 [[nodiscard]] const ::occtl_mesh_triangle_component_boundary_chains_view_t& c() const noexcept
511 {
512 return myC;
513 }
514
515private:
517};
518
521{
522public:
523 TriangleComponentBoundaryPolylinesView() noexcept = default;
524
526 const ::occtl_mesh_component_boundary_polylines_view_t& theC) noexcept
527 : myC(theC)
528 {
529 }
530
531#if OCCTL_HPP_HAS_SPAN
532 [[nodiscard]] std::span<const ::occtl_point3_t> points() const noexcept
533 {
534 return {myC.points, myC.point_count};
535 }
536
537 [[nodiscard]] std::span<const ::occtl_mesh_component_boundary_polyline_t> polylines()
538 const noexcept
539 {
540 return {myC.polylines, myC.polyline_count};
541 }
542#else
543 [[nodiscard]] const ::occtl_point3_t* points() const noexcept { return myC.points; }
544
545 [[nodiscard]] const ::occtl_mesh_component_boundary_polyline_t* polylines() const noexcept
546 {
547 return myC.polylines;
548 }
549#endif
550
551 [[nodiscard]] std::size_t point_count() const noexcept { return myC.point_count; }
552
553 [[nodiscard]] std::size_t polyline_count() const noexcept { return myC.polyline_count; }
554
555 [[nodiscard]] uint32_t component_id() const noexcept { return myC.component_id; }
556
557 [[nodiscard]] NodeId root() const noexcept { return NodeId(myC.root); }
558
559 [[nodiscard]] const ::occtl_mesh_component_boundary_polylines_view_t& c() const noexcept
560 {
561 return myC;
562 }
563
564private:
566};
567
570{
571public:
572 TriangleComponentSummariesView() noexcept = default;
573
575 const ::occtl_mesh_triangle_component_summaries_view_t& theC) noexcept
576 : myC(theC)
577 {
578 }
579
580#if OCCTL_HPP_HAS_SPAN
581 [[nodiscard]] std::span<const ::occtl_mesh_triangle_component_summary_t> summaries()
582 const noexcept
583 {
584 return {myC.summaries, myC.component_count};
585 }
586#else
587 [[nodiscard]] const ::occtl_mesh_triangle_component_summary_t* summaries() const noexcept
588 {
589 return myC.summaries;
590 }
591#endif
592
593 [[nodiscard]] std::size_t component_count() const noexcept { return myC.component_count; }
594
595 [[nodiscard]] std::size_t triangle_count() const noexcept { return myC.triangle_count; }
596
597 [[nodiscard]] NodeId root() const noexcept { return NodeId(myC.root); }
598
599 [[nodiscard]] const ::occtl_mesh_triangle_component_summaries_view_t& c() const noexcept
600 {
601 return myC;
602 }
603
604private:
606};
607
609
612{
613public:
614 TrianglePlaneComponentsView() noexcept = default;
615
617 const ::occtl_mesh_triangle_plane_components_view_t& theC) noexcept
618 : myC(theC)
619 {
620 }
621
622#if OCCTL_HPP_HAS_SPAN
623 [[nodiscard]] std::span<const ::occtl_mesh_triangle_plane_component_t> components() const noexcept
624 {
625 return {myC.components, myC.component_count};
626 }
627#else
628 [[nodiscard]] const ::occtl_mesh_triangle_plane_component_t* components() const noexcept
629 {
630 return myC.components;
631 }
632#endif
633
634 [[nodiscard]] std::size_t component_count() const noexcept { return myC.component_count; }
635
636 [[nodiscard]] std::size_t triangle_count() const noexcept { return myC.triangle_count; }
637
638 [[nodiscard]] NodeId root() const noexcept { return NodeId(myC.root); }
639
640 [[nodiscard]] const ::occtl_mesh_triangle_plane_components_view_t& c() const noexcept
641 {
642 return myC;
643 }
644
645private:
647};
648
650
653{
654public:
655 TriangleSphereComponentsView() noexcept = default;
656
658 const ::occtl_mesh_triangle_sphere_components_view_t& theC) noexcept
659 : myC(theC)
660 {
661 }
662
663#if OCCTL_HPP_HAS_SPAN
664 [[nodiscard]] std::span<const ::occtl_mesh_triangle_sphere_component_t> components()
665 const noexcept
666 {
667 return {myC.components, myC.component_count};
668 }
669#else
670 [[nodiscard]] const ::occtl_mesh_triangle_sphere_component_t* components() const noexcept
671 {
672 return myC.components;
673 }
674#endif
675
676 [[nodiscard]] std::size_t component_count() const noexcept { return myC.component_count; }
677
678 [[nodiscard]] std::size_t triangle_count() const noexcept { return myC.triangle_count; }
679
680 [[nodiscard]] NodeId root() const noexcept { return NodeId(myC.root); }
681
682 [[nodiscard]] const ::occtl_mesh_triangle_sphere_components_view_t& c() const noexcept
683 {
684 return myC;
685 }
686
687private:
689};
690
692
695{
696public:
697 TriangleCylinderComponentsView() noexcept = default;
698
700 const ::occtl_mesh_triangle_cylinder_components_view_t& theC) noexcept
701 : myC(theC)
702 {
703 }
704
705#if OCCTL_HPP_HAS_SPAN
706 [[nodiscard]] std::span<const ::occtl_mesh_triangle_cylinder_component_t> components()
707 const noexcept
708 {
709 return {myC.components, myC.component_count};
710 }
711#else
712 [[nodiscard]] const ::occtl_mesh_triangle_cylinder_component_t* components() const noexcept
713 {
714 return myC.components;
715 }
716#endif
717
718 [[nodiscard]] std::size_t component_count() const noexcept { return myC.component_count; }
719
720 [[nodiscard]] std::size_t triangle_count() const noexcept { return myC.triangle_count; }
721
722 [[nodiscard]] NodeId root() const noexcept { return NodeId(myC.root); }
723
724 [[nodiscard]] const ::occtl_mesh_triangle_cylinder_components_view_t& c() const noexcept
725 {
726 return myC;
727 }
728
729private:
731};
732
734inline void generate(Graph& theGraph, const Options& theOpts)
735{
736 ::occtl_mesh_options_t aOpts = theOpts.to_c();
737 check(::occtl_mesh_generate(theGraph.get(), nullptr, 0, &aOpts));
738}
739
741inline void generate(Graph& theGraph, const std::vector<NodeId>& theNodes, const Options& theOpts)
742{
743 std::vector<::occtl_node_id_t> aIds;
744 aIds.reserve(theNodes.size());
745 for (const NodeId& aId : theNodes)
746 {
747 aIds.emplace_back(aId.get());
748 }
749
750 ::occtl_mesh_options_t aOpts = theOpts.to_c();
752 aIds.empty() ? nullptr : aIds.data(),
753 aIds.size(),
754 &aOpts));
755}
756
757#if OCCTL_HPP_HAS_SPAN
759inline void generate(Graph& theGraph, std::span<const NodeId> theNodes, const Options& theOpts)
760{
761 std::vector<::occtl_node_id_t> aIds;
762 aIds.reserve(theNodes.size());
763 for (const NodeId& aId : theNodes)
764 aIds.emplace_back(aId.get());
765
766 ::occtl_mesh_options_t aOpts = theOpts.to_c();
768 aIds.empty() ? nullptr : aIds.data(),
769 aIds.size(),
770 &aOpts));
771}
772#endif
773
775[[nodiscard]] inline std::pair<Graph, NodeId> from_buffers(const FromBuffersOptions& theOptions)
776{
777 ::occtl_graph_t* aGraph = nullptr;
779 check(::occtl_mesh_from_buffers(&theOptions, &aGraph, &aRoot));
780 return {Graph(aGraph), NodeId(aRoot)};
781}
782
784inline void model_metadata_set(Graph& theGraph,
785 const char* const theKey,
786 const std::size_t theKeyLen,
787 const char* const theValue,
788 const std::size_t theValueLen)
789{
790 check(::occtl_mesh_model_metadata_set(theGraph.get(), theKey, theKeyLen, theValue, theValueLen));
791}
792
794[[nodiscard]] inline std::string model_metadata_get(const Graph& theGraph,
795 const char* const theKey,
796 const std::size_t theKeyLen)
797{
798 std::size_t aRequired = 0;
799 check(::occtl_mesh_model_metadata_get(theGraph.get(), theKey, theKeyLen, nullptr, 0, &aRequired));
800 if (aRequired <= 1)
801 {
802 return {};
803 }
804 std::string aResult(aRequired - 1, '\0');
806 theKey,
807 theKeyLen,
808 aResult.data(),
809 aResult.size() + 1,
810 &aRequired));
811 return aResult;
812}
813
815[[nodiscard]] inline std::vector<std::string> model_metadata_keys(const Graph& theGraph)
816{
817 std::size_t aCount = 0;
818 check(::occtl_mesh_model_metadata_keys(theGraph.get(), nullptr, 0, &aCount));
819
820 std::vector<::occtl_metadata_key_view_t> aViews(aCount);
821 if (!aViews.empty())
822 {
823 check(::occtl_mesh_model_metadata_keys(theGraph.get(), aViews.data(), aViews.size(), &aCount));
824 }
825
826 std::vector<std::string> aKeys;
827 aKeys.reserve(aCount);
828 for (const ::occtl_metadata_key_view_t& aView : aViews)
829 {
830 aKeys.emplace_back(aView.key, aView.key_len);
831 }
832 return aKeys;
833}
834
836inline void model_metadata_unset(Graph& theGraph,
837 const char* const theKey,
838 const std::size_t theKeyLen)
839{
840 check(::occtl_mesh_model_metadata_unset(theGraph.get(), theKey, theKeyLen));
841}
842
844[[nodiscard]] inline TriangulationView face_triangulation(const Graph& theGraph,
845 const NodeId theFace)
846{
848 check(::occtl_mesh_face_triangulation(theGraph.get(), theFace.get(), &aView));
849 return TriangulationView(aView);
850}
851
853[[nodiscard]] inline uint32_t face_triangulation_count(const Graph& theGraph, const NodeId theFace)
854{
855 uint32_t aCount = 0;
856 check(::occtl_mesh_face_triangulation_count(theGraph.get(), theFace.get(), &aCount));
857 return aCount;
858}
859
861[[nodiscard]] inline TriangulationView face_triangulation_at(const Graph& theGraph,
862 const NodeId theFace,
863 const uint32_t theIndex)
864{
866 check(::occtl_mesh_face_triangulation_indexed(theGraph.get(), theFace.get(), theIndex, &aView));
867 return TriangulationView(aView);
868}
869
871[[nodiscard]] inline Polygon3DView edge_polygon3d(const Graph& theGraph, const NodeId theEdge)
872{
874 check(::occtl_mesh_edge_polygon3d(theGraph.get(), theEdge.get(), &aView));
875 return Polygon3DView(aView);
876}
877
879[[nodiscard]] inline PolygonOnTriView coedge_polygon_on_tri(const Graph& theGraph,
880 const NodeId theCoEdge)
881{
883 check(::occtl_mesh_coedge_polygon_on_tri(theGraph.get(), theCoEdge.get(), &aView));
884 return PolygonOnTriView(aView);
885}
886
888[[nodiscard]] inline TriangleBuffersView triangle_buffers(const Graph& theGraph,
889 const NodeId theRoot = NodeId::invalid())
890{
892 check(::occtl_mesh_triangle_buffers(theGraph.get(), theRoot.get(), &aView));
893 return TriangleBuffersView(aView);
894}
895
898 const Graph& theGraph,
899 const NodeId theRoot = NodeId::invalid())
900{
902 check(::occtl_mesh_triangle_analysis(theGraph.get(), theRoot.get(), &aView));
903 return TriangleAnalysisView(aView);
904}
905
908 const Graph& theGraph,
909 const TriangleComponentsOptions& theOptions)
910{
912 check(::occtl_mesh_triangle_components(theGraph.get(), &theOptions, &aView));
913 return TriangleComponentsView(aView);
914}
915
918 const Graph& theGraph,
919 const NodeId theRoot = NodeId::invalid())
920{
921 TriangleComponentsOptions anOptions = OCCTL_MESH_TRIANGLE_COMPONENTS_OPTIONS_INIT;
922 anOptions.root = theRoot.get();
923 return triangle_components(theGraph, anOptions);
924}
925
928 const Graph& theGraph,
929 const TriangleComponentsOptions& theOptions)
930{
932 check(::occtl_mesh_triangle_component_summaries(theGraph.get(), &theOptions, &aView));
933 return TriangleComponentSummariesView(aView);
934}
935
938 const Graph& theGraph,
939 const NodeId theRoot = NodeId::invalid())
940{
941 TriangleComponentsOptions anOptions = OCCTL_MESH_TRIANGLE_COMPONENTS_OPTIONS_INIT;
942 anOptions.root = theRoot.get();
943 return triangle_component_summaries(theGraph, anOptions);
944}
945
948 const Graph& theGraph,
949 const TriangleComponentsOptions& theOptions,
950 const uint32_t theComponentId)
951{
953 check(
954 ::occtl_mesh_triangle_component_triangles(theGraph.get(), &theOptions, theComponentId, &aView));
955 return TriangleComponentTrianglesView(aView);
956}
957
960 const Graph& theGraph,
961 const uint32_t theComponentId,
962 const NodeId theRoot = NodeId::invalid())
963{
964 TriangleComponentsOptions anOptions = OCCTL_MESH_TRIANGLE_COMPONENTS_OPTIONS_INIT;
965 anOptions.root = theRoot.get();
966 return triangle_component_triangles(theGraph, anOptions, theComponentId);
967}
968
971 const Graph& theGraph,
972 const TriangleComponentsOptions& theOptions,
973 const uint32_t theComponentId)
974{
976 check(
977 ::occtl_mesh_triangle_component_boundary(theGraph.get(), &theOptions, theComponentId, &aView));
978 return TriangleComponentBoundaryView(aView);
979}
980
983 const Graph& theGraph,
984 const uint32_t theComponentId,
985 const NodeId theRoot = NodeId::invalid())
986{
987 TriangleComponentsOptions anOptions = OCCTL_MESH_TRIANGLE_COMPONENTS_OPTIONS_INIT;
988 anOptions.root = theRoot.get();
989 return triangle_component_boundary(theGraph, anOptions, theComponentId);
990}
991
994 const Graph& theGraph,
995 const TriangleComponentsOptions& theOptions,
996 const uint32_t theComponentId)
997{
1000 &theOptions,
1001 theComponentId,
1002 &aView));
1004}
1005
1008 const Graph& theGraph,
1009 const uint32_t theComponentId,
1010 const NodeId theRoot = NodeId::invalid())
1011{
1012 TriangleComponentsOptions anOptions = OCCTL_MESH_TRIANGLE_COMPONENTS_OPTIONS_INIT;
1013 anOptions.root = theRoot.get();
1014 return triangle_component_boundary_chains(theGraph, anOptions, theComponentId);
1015}
1016
1019 const Graph& theGraph,
1020 const TriangleComponentsOptions& theOptions,
1021 const uint32_t theComponentId)
1022{
1024 check(
1025 ::occtl_mesh_component_boundary_polylines(theGraph.get(), &theOptions, theComponentId, &aView));
1027}
1028
1031 const Graph& theGraph,
1032 const uint32_t theComponentId,
1033 const NodeId theRoot = NodeId::invalid())
1034{
1035 TriangleComponentsOptions anOptions = OCCTL_MESH_TRIANGLE_COMPONENTS_OPTIONS_INIT;
1036 anOptions.root = theRoot.get();
1037 return triangle_component_boundary_polylines(theGraph, anOptions, theComponentId);
1038}
1039
1042 const Graph& theGraph,
1043 const TrianglePlaneComponentsOptions& theOptions)
1044{
1046 check(::occtl_mesh_triangle_plane_components(theGraph.get(), &theOptions, &aView));
1047 return TrianglePlaneComponentsView(aView);
1048}
1049
1052 const Graph& theGraph,
1053 const NodeId theRoot = NodeId::invalid())
1054{
1055 TrianglePlaneComponentsOptions anOptions = OCCTL_MESH_TRIANGLE_PLANE_COMPONENTS_OPTIONS_INIT;
1056 anOptions.root = theRoot.get();
1057 return triangle_plane_components(theGraph, anOptions);
1058}
1059
1062 const Graph& theGraph,
1063 const TriangleSphereComponentsOptions& theOptions)
1064{
1066 check(::occtl_mesh_triangle_sphere_components(theGraph.get(), &theOptions, &aView));
1067 return TriangleSphereComponentsView(aView);
1068}
1069
1072 const Graph& theGraph,
1073 const NodeId theRoot = NodeId::invalid())
1074{
1075 TriangleSphereComponentsOptions anOptions = OCCTL_MESH_TRIANGLE_SPHERE_COMPONENTS_OPTIONS_INIT;
1076 anOptions.root = theRoot.get();
1077 return triangle_sphere_components(theGraph, anOptions);
1078}
1079
1082 const Graph& theGraph,
1083 const TriangleCylinderComponentsOptions& theOptions)
1084{
1086 check(::occtl_mesh_triangle_cylinder_components(theGraph.get(), &theOptions, &aView));
1087 return TriangleCylinderComponentsView(aView);
1088}
1089
1092 const Graph& theGraph,
1093 const NodeId theRoot = NodeId::invalid())
1094{
1096 OCCTL_MESH_TRIANGLE_CYLINDER_COMPONENTS_OPTIONS_INIT;
1097 anOptions.root = theRoot.get();
1098 return triangle_cylinder_components(theGraph, anOptions);
1099}
1100
1103 Graph& theGraph,
1104 const TriangleSphereComponentsOptions& theOptions,
1105 const uint32_t theComponentId)
1106{
1108 check(
1109 ::occtl_mesh_make_sphere_component_solid(theGraph.get(), &theOptions, theComponentId, &aSolid));
1110 return NodeId(aSolid);
1111}
1112
1115[[nodiscard]] inline NodeId make_sphere_component_solid(Graph& theGraph,
1116 const uint32_t theComponentId,
1117 const NodeId theRoot = NodeId::invalid())
1118{
1119 TriangleSphereComponentsOptions anOptions = OCCTL_MESH_TRIANGLE_SPHERE_COMPONENTS_OPTIONS_INIT;
1120 anOptions.root = theRoot.get();
1121 return make_sphere_component_solid(theGraph, anOptions, theComponentId);
1122}
1123
1126 Graph& theGraph,
1127 const TriangleCylinderComponentsOptions& theOptions,
1128 const uint32_t theComponentId)
1129{
1132 &theOptions,
1133 theComponentId,
1134 &aSolid));
1135 return NodeId(aSolid);
1136}
1137
1140[[nodiscard]] inline NodeId make_cylinder_component_solid(Graph& theGraph,
1141 const uint32_t theComponentId,
1142 const NodeId theRoot = NodeId::invalid())
1143{
1145 OCCTL_MESH_TRIANGLE_CYLINDER_COMPONENTS_OPTIONS_INIT;
1146 anOptions.root = theRoot.get();
1147 return make_cylinder_component_solid(theGraph, anOptions, theComponentId);
1148}
1149
1151[[nodiscard]] inline std::vector<NodeId> make_sphere_component_solids(
1152 Graph& theGraph,
1153 const TriangleSphereComponentsOptions& theOptions)
1154{
1155 size_t aCount = 0u;
1156 check(
1157 ::occtl_mesh_make_sphere_component_solids(theGraph.get(), &theOptions, nullptr, 0u, &aCount));
1158
1159 std::vector<::occtl_node_id_t> aCSolids(aCount, OCCTL_NODE_ID_INVALID);
1160 if (aCount != 0u)
1161 {
1163 &theOptions,
1164 aCSolids.data(),
1165 aCSolids.size(),
1166 &aCount));
1167 }
1168
1169 std::vector<NodeId> aSolids;
1170 aSolids.reserve(aCount);
1171 for (const ::occtl_node_id_t& aSolid : aCSolids)
1172 {
1173 aSolids.emplace_back(aSolid);
1174 }
1175 return aSolids;
1176}
1177
1180[[nodiscard]] inline std::vector<NodeId> make_sphere_component_solids(
1181 Graph& theGraph,
1182 const NodeId theRoot = NodeId::invalid())
1183{
1184 TriangleSphereComponentsOptions anOptions = OCCTL_MESH_TRIANGLE_SPHERE_COMPONENTS_OPTIONS_INIT;
1185 anOptions.root = theRoot.get();
1186 return make_sphere_component_solids(theGraph, anOptions);
1187}
1188
1190[[nodiscard]] inline std::vector<NodeId> make_cylinder_component_solids(
1191 Graph& theGraph,
1192 const TriangleCylinderComponentsOptions& theOptions)
1193{
1194 size_t aCount = 0u;
1195 check(
1196 ::occtl_mesh_make_cylinder_component_solids(theGraph.get(), &theOptions, nullptr, 0u, &aCount));
1197
1198 std::vector<::occtl_node_id_t> aCSolids(aCount, OCCTL_NODE_ID_INVALID);
1199 if (aCount != 0u)
1200 {
1202 &theOptions,
1203 aCSolids.data(),
1204 aCSolids.size(),
1205 &aCount));
1206 }
1207
1208 std::vector<NodeId> aSolids;
1209 aSolids.reserve(aCount);
1210 for (const ::occtl_node_id_t& aSolid : aCSolids)
1211 {
1212 aSolids.emplace_back(aSolid);
1213 }
1214 return aSolids;
1215}
1216
1219[[nodiscard]] inline std::vector<NodeId> make_cylinder_component_solids(
1220 Graph& theGraph,
1221 const NodeId theRoot = NodeId::invalid())
1222{
1224 OCCTL_MESH_TRIANGLE_CYLINDER_COMPONENTS_OPTIONS_INIT;
1225 anOptions.root = theRoot.get();
1226 return make_cylinder_component_solids(theGraph, anOptions);
1227}
1228
1231 Graph& theGraph,
1232 const TrianglePlaneComponentsOptions& theOptions,
1233 const uint32_t theComponentId)
1234{
1236 check(
1237 ::occtl_mesh_make_plane_component_face(theGraph.get(), &theOptions, theComponentId, &aFace));
1238 return NodeId(aFace);
1239}
1240
1242[[nodiscard]] inline NodeId make_plane_component_face(Graph& theGraph,
1243 const uint32_t theComponentId,
1244 const NodeId theRoot = NodeId::invalid())
1245{
1246 TrianglePlaneComponentsOptions anOptions = OCCTL_MESH_TRIANGLE_PLANE_COMPONENTS_OPTIONS_INIT;
1247 anOptions.root = theRoot.get();
1248 return make_plane_component_face(theGraph, anOptions, theComponentId);
1249}
1250
1252[[nodiscard]] inline std::vector<NodeId> make_plane_component_faces(
1253 Graph& theGraph,
1254 const TrianglePlaneComponentsOptions& theOptions)
1255{
1256 size_t aCount = 0u;
1257 check(::occtl_mesh_make_plane_component_faces(theGraph.get(), &theOptions, nullptr, 0u, &aCount));
1258
1259 std::vector<::occtl_node_id_t> aCFaces(aCount, OCCTL_NODE_ID_INVALID);
1260 if (aCount != 0u)
1261 {
1263 &theOptions,
1264 aCFaces.data(),
1265 aCFaces.size(),
1266 &aCount));
1267 }
1268
1269 std::vector<NodeId> aFaces;
1270 aFaces.reserve(aCount);
1271 for (const ::occtl_node_id_t& aFace : aCFaces)
1272 {
1273 aFaces.emplace_back(aFace);
1274 }
1275 return aFaces;
1276}
1277
1279[[nodiscard]] inline std::vector<NodeId> make_plane_component_faces(
1280 Graph& theGraph,
1281 const NodeId theRoot = NodeId::invalid())
1282{
1283 TrianglePlaneComponentsOptions anOptions = OCCTL_MESH_TRIANGLE_PLANE_COMPONENTS_OPTIONS_INIT;
1284 anOptions.root = theRoot.get();
1285 return make_plane_component_faces(theGraph, anOptions);
1286}
1287
1288} // namespace occtl::mesh
1289
1290#endif // OCCTL_HPP_MESH_HPP
RAII handle for a topology graph. Mirrors occtl_graph_t.
Definition topo.hpp:1444
::occtl_graph_t * get() const noexcept
Borrows-it pointer to the underlying C handle, for direct ABI calls.
Definition topo.hpp:1494
Session-local identity of a graph node. Mirrors occtl_node_id_t.
Definition topo.hpp:52
::occtl_node_id_t get() const noexcept
Borrows-it view of the underlying C value type, for direct ABI calls.
Definition topo.hpp:64
static NodeId invalid() noexcept
Returns the invalid sentinel (all-zero bits).
Definition topo.hpp:61
Persistent identity surviving node removal and graph compaction. Mirrors occtl_uid_t.
Definition uid.hpp:39
Borrowed view of a 3D polyline cached on an edge.
Definition mesh.hpp:181
Borrowed view of a coedge polyline indexed onto its parent face's triangulation.
Definition mesh.hpp:223
Borrowed per-triangle normals and adjacency for a graph/root.
Definition mesh.hpp:306
Borrowed aggregate triangle-soup buffers for a graph/root.
Definition mesh.hpp:265
Borrowed ordered boundary chains belonging to one triangle component.
Definition mesh.hpp:468
Borrowed ordered boundary polylines belonging to one triangle component.
Definition mesh.hpp:521
Borrowed boundary edges belonging to one triangle component.
Definition mesh.hpp:428
Borrowed summaries for normal-connected triangle components.
Definition mesh.hpp:570
Borrowed aggregate triangle indices belonging to one component.
Definition mesh.hpp:392
Borrowed normal-connected triangle component labels.
Definition mesh.hpp:350
Borrowed cylinder-like normal-connected triangle components.
Definition mesh.hpp:695
Borrowed plane-like normal-connected triangle components.
Definition mesh.hpp:612
Borrowed sphere-like normal-connected triangle components.
Definition mesh.hpp:653
Borrowed view of a face triangulation. Lifetime tied to the source graph.
Definition mesh.hpp:120
C++ veneer for the core module.
void check(const ::occtl_status_t theStatus)
Throw on non-OK; otherwise a no-op.
Definition core.hpp:85
C++ veneer for the geom module.
void generate(Graph &theGraph, const Options &theOpts)
Tessellate every active face and free edge in theGraph.
Definition mesh.hpp:734
std::pair< Graph, NodeId > from_buffers(const FromBuffersOptions &theOptions)
Creates a new graph containing one triangulated Face from caller buffers.
Definition mesh.hpp:775
TriangleComponentBoundaryPolylinesView triangle_component_boundary_polylines(const Graph &theGraph, const TriangleComponentsOptions &theOptions, const uint32_t theComponentId)
Ordered boundary polylines belonging to one triangle component.
Definition mesh.hpp:1018
NodeId make_plane_component_face(Graph &theGraph, const TrianglePlaneComponentsOptions &theOptions, const uint32_t theComponentId)
Rebuild one plane-like triangle component as a planar Face root.
Definition mesh.hpp:1230
std::vector< NodeId > make_plane_component_faces(Graph &theGraph, const TrianglePlaneComponentsOptions &theOptions)
Rebuild all plane-like triangle components as planar Face roots.
Definition mesh.hpp:1252
TrianglePlaneComponentsView triangle_plane_components(const Graph &theGraph, const TrianglePlaneComponentsOptions &theOptions)
Plane-like normal-connected triangle components.
Definition mesh.hpp:1041
TriangleCylinderComponentsView triangle_cylinder_components(const Graph &theGraph, const TriangleCylinderComponentsOptions &theOptions)
Cylinder-like normal-connected triangle components.
Definition mesh.hpp:1081
PolygonOnTriView coedge_polygon_on_tri(const Graph &theGraph, const NodeId theCoEdge)
Cached polygon-on-triangulation for theCoEdge.
Definition mesh.hpp:879
void model_metadata_set(Graph &theGraph, const char *const theKey, const std::size_t theKeyLen, const char *const theValue, const std::size_t theValueLen)
Sets mesh-model metadata on the graph metadata storage.
Definition mesh.hpp:784
std::vector< std::string > model_metadata_keys(const Graph &theGraph)
Lists mesh-model metadata keys from the graph metadata storage.
Definition mesh.hpp:815
TriangleSphereComponentsView triangle_sphere_components(const Graph &theGraph, const TriangleSphereComponentsOptions &theOptions)
Sphere-like normal-connected triangle components.
Definition mesh.hpp:1061
NodeId make_cylinder_component_solid(Graph &theGraph, const TriangleCylinderComponentsOptions &theOptions, const uint32_t theComponentId)
Rebuild one cylinder-like triangle component as an analytic Solid root.
Definition mesh.hpp:1125
TriangulationView face_triangulation(const Graph &theGraph, const NodeId theFace)
Active cached triangulation of theFace.
Definition mesh.hpp:844
std::vector< NodeId > make_sphere_component_solids(Graph &theGraph, const TriangleSphereComponentsOptions &theOptions)
Rebuild all sphere-like triangle components as analytic Solid roots.
Definition mesh.hpp:1151
TriangleAnalysisView triangle_analysis(const Graph &theGraph, const NodeId theRoot=NodeId::invalid())
Cached per-triangle normals and adjacency for graph-owned mesh buffers.
Definition mesh.hpp:897
TriangleComponentsView triangle_components(const Graph &theGraph, const TriangleComponentsOptions &theOptions)
Normal-connected triangle components for graph-owned mesh buffers.
Definition mesh.hpp:907
std::string model_metadata_get(const Graph &theGraph, const char *const theKey, const std::size_t theKeyLen)
Retrieves mesh-model metadata from the graph metadata storage.
Definition mesh.hpp:794
TriangulationView face_triangulation_at(const Graph &theGraph, const NodeId theFace, const uint32_t theIndex)
theIndex-th cached triangulation of theFace.
Definition mesh.hpp:861
TriangleComponentTrianglesView triangle_component_triangles(const Graph &theGraph, const TriangleComponentsOptions &theOptions, const uint32_t theComponentId)
Aggregate triangle indices belonging to one component.
Definition mesh.hpp:947
void model_metadata_unset(Graph &theGraph, const char *const theKey, const std::size_t theKeyLen)
Removes one mesh-model metadata key. Idempotent.
Definition mesh.hpp:836
Polygon3DView edge_polygon3d(const Graph &theGraph, const NodeId theEdge)
Cached 3D polyline on theEdge.
Definition mesh.hpp:871
TriangleBuffersView triangle_buffers(const Graph &theGraph, const NodeId theRoot=NodeId::invalid())
Aggregate cached triangulations into graph-owned triangle-soup buffers.
Definition mesh.hpp:888
TriangleComponentBoundaryChainsView triangle_component_boundary_chains(const Graph &theGraph, const TriangleComponentsOptions &theOptions, const uint32_t theComponentId)
Ordered boundary chains belonging to one triangle component.
Definition mesh.hpp:993
TriangleComponentSummariesView triangle_component_summaries(const Graph &theGraph, const TriangleComponentsOptions &theOptions)
Summaries for normal-connected triangle components.
Definition mesh.hpp:927
std::vector< NodeId > make_cylinder_component_solids(Graph &theGraph, const TriangleCylinderComponentsOptions &theOptions)
Rebuild all cylinder-like triangle components as analytic Solid roots.
Definition mesh.hpp:1190
uint32_t face_triangulation_count(const Graph &theGraph, const NodeId theFace)
Number of cached triangulations on theFace.
Definition mesh.hpp:853
NodeId make_sphere_component_solid(Graph &theGraph, const TriangleSphereComponentsOptions &theOptions, const uint32_t theComponentId)
Rebuild one sphere-like triangle component as an analytic Solid root.
Definition mesh.hpp:1102
TriangleComponentBoundaryView triangle_component_boundary(const Graph &theGraph, const TriangleComponentsOptions &theOptions, const uint32_t theComponentId)
Boundary edges belonging to one triangle component.
Definition mesh.hpp:970
OCCT-Light: mesh (triangulation) module public API.
occtl_status_t occtl_mesh_model_metadata_set(occtl_graph_t *graph, const char *key, size_t keyLen, const char *value, size_t valueLen)
occtl_status_t occtl_mesh_generate(occtl_graph_t *graph, const occtl_node_id_t *nodes, size_t n_nodes, const occtl_mesh_options_t *options)
occtl_status_t occtl_mesh_triangle_sphere_components(const occtl_graph_t *graph, const occtl_mesh_triangle_sphere_components_options_t *options, occtl_mesh_triangle_sphere_components_view_t *out_view)
occtl_status_t occtl_mesh_coedge_polygon_on_tri(const occtl_graph_t *graph, occtl_node_id_t coedge, occtl_polygon_on_tri_view_t *out_view)
occtl_status_t occtl_mesh_from_buffers(const occtl_mesh_from_buffers_options_t *options, occtl_graph_t **out_graph, occtl_node_id_t *out_root)
struct occtl_mesh_triangle_cylinder_components_options occtl_mesh_triangle_cylinder_components_options_t
occtl_status_t occtl_mesh_triangle_component_boundary(const occtl_graph_t *graph, const occtl_mesh_triangle_components_options_t *options, uint32_t component_id, occtl_mesh_triangle_component_boundary_view_t *out_view)
occtl_status_t occtl_mesh_model_metadata_unset(occtl_graph_t *graph, const char *key, size_t keyLen)
occtl_status_t occtl_mesh_make_plane_component_face(occtl_graph_t *graph, const occtl_mesh_triangle_plane_components_options_t *options, uint32_t component_id, occtl_node_id_t *out_face)
occtl_status_t occtl_mesh_make_sphere_component_solid(occtl_graph_t *graph, const occtl_mesh_triangle_sphere_components_options_t *options, uint32_t component_id, occtl_node_id_t *out_solid)
occtl_status_t occtl_mesh_triangle_analysis(const occtl_graph_t *graph, occtl_node_id_t root, occtl_mesh_triangle_analysis_view_t *out_view)
struct occtl_mesh_triangle_sphere_components_options occtl_mesh_triangle_sphere_components_options_t
occtl_status_t occtl_mesh_make_cylinder_component_solid(occtl_graph_t *graph, const occtl_mesh_triangle_cylinder_components_options_t *options, uint32_t component_id, occtl_node_id_t *out_solid)
occtl_status_t occtl_mesh_face_triangulation_indexed(const occtl_graph_t *graph, occtl_node_id_t face, uint32_t index, occtl_triangulation_view_t *out_view)
occtl_status_t occtl_mesh_model_metadata_keys(const occtl_graph_t *graph, occtl_metadata_key_view_t *out_keys, size_t cap, size_t *out_count)
occtl_status_t occtl_mesh_edge_polygon3d(const occtl_graph_t *graph, occtl_node_id_t edge, occtl_polygon3d_view_t *out_view)
occtl_status_t occtl_mesh_triangle_buffers(const occtl_graph_t *graph, occtl_node_id_t root, occtl_mesh_triangle_buffers_view_t *out_view)
occtl_status_t occtl_mesh_make_sphere_component_solids(occtl_graph_t *graph, const occtl_mesh_triangle_sphere_components_options_t *options, occtl_node_id_t *out_buf, size_t cap, size_t *out_count)
occtl_status_t occtl_mesh_face_triangulation(const occtl_graph_t *graph, occtl_node_id_t face, occtl_triangulation_view_t *out_view)
occtl_status_t occtl_mesh_make_plane_component_faces(occtl_graph_t *graph, const occtl_mesh_triangle_plane_components_options_t *options, occtl_node_id_t *out_buf, size_t cap, size_t *out_count)
occtl_status_t occtl_mesh_face_triangulation_count(const occtl_graph_t *graph, occtl_node_id_t face, uint32_t *out_count)
struct occtl_mesh_from_buffers_options occtl_mesh_from_buffers_options_t
occtl_status_t occtl_mesh_model_metadata_get(const occtl_graph_t *graph, const char *key, size_t keyLen, char *buf, size_t bufSize, size_t *out_required)
struct occtl_mesh_triangle_components_options occtl_mesh_triangle_components_options_t
occtl_status_t occtl_mesh_make_cylinder_component_solids(occtl_graph_t *graph, const occtl_mesh_triangle_cylinder_components_options_t *options, occtl_node_id_t *out_buf, size_t cap, size_t *out_count)
occtl_status_t occtl_mesh_triangle_components(const occtl_graph_t *graph, const occtl_mesh_triangle_components_options_t *options, occtl_mesh_triangle_components_view_t *out_view)
#define OCCTL_MESH_OPTIONS_INIT
Definition occtl_mesh.h:139
occtl_status_t occtl_mesh_triangle_component_boundary_chains(const occtl_graph_t *graph, const occtl_mesh_triangle_components_options_t *options, uint32_t component_id, occtl_mesh_triangle_component_boundary_chains_view_t *out_view)
struct occtl_mesh_triangle_plane_components_options occtl_mesh_triangle_plane_components_options_t
occtl_status_t occtl_mesh_triangle_cylinder_components(const occtl_graph_t *graph, const occtl_mesh_triangle_cylinder_components_options_t *options, occtl_mesh_triangle_cylinder_components_view_t *out_view)
occtl_status_t occtl_mesh_triangle_plane_components(const occtl_graph_t *graph, const occtl_mesh_triangle_plane_components_options_t *options, occtl_mesh_triangle_plane_components_view_t *out_view)
occtl_status_t occtl_mesh_component_boundary_polylines(const occtl_graph_t *graph, const occtl_mesh_triangle_components_options_t *options, uint32_t component_id, occtl_mesh_component_boundary_polylines_view_t *out_view)
occtl_status_t occtl_mesh_triangle_component_triangles(const occtl_graph_t *graph, const occtl_mesh_triangle_components_options_t *options, uint32_t component_id, occtl_mesh_triangle_component_triangles_view_t *out_view)
occtl_status_t occtl_mesh_triangle_component_summaries(const occtl_graph_t *graph, const occtl_mesh_triangle_components_options_t *options, occtl_mesh_triangle_component_summaries_view_t *out_view)
#define OCCTL_NODE_ID_INVALID
Definition occtl_topo_types.h:138
struct occtl_graph occtl_graph_t
Definition occtl_topo_types.h:152
3D point value type. Mirrors occtl_point3_t with STL-flavoured access.
Definition geom.hpp:82
Axis-aligned bounding box. Aggregate over the C POD.
Definition mesh.hpp:55
Idiomatic mirror of occtl_mesh_options_t.
Definition mesh.hpp:65
::occtl_mesh_options_t to_c() const noexcept
Project into the C ABI options struct.
Definition mesh.hpp:86
occtl_point3_t min
Definition occtl_mesh.h:67
occtl_point3_t max
Definition occtl_mesh.h:68
size_t polyline_count
Definition occtl_mesh.h:826
const occtl_point3_t * points
Definition occtl_mesh.h:822
occtl_node_id_t root
Definition occtl_mesh.h:828
size_t point_count
Definition occtl_mesh.h:823
const occtl_mesh_component_boundary_polyline_t * polylines
Definition occtl_mesh.h:825
uint32_t component_id
Definition occtl_mesh.h:827
Definition occtl_mesh.h:299
Definition occtl_mesh.h:97
double min_size
Definition occtl_mesh.h:108
int32_t in_parallel
Definition occtl_mesh.h:110
int32_t allow_quality_decrease
Definition occtl_mesh.h:122
int32_t clean_model
Definition occtl_mesh.h:117
double deflection_interior
Definition occtl_mesh.h:104
double angle_interior
Definition occtl_mesh.h:105
double angle
Definition occtl_mesh.h:102
int32_t control_surface_deflection
Definition occtl_mesh.h:114
int32_t force_face_deflection
Definition occtl_mesh.h:120
double deflection
Definition occtl_mesh.h:101
occtl_aabb3_t bbox
Definition occtl_mesh.h:128
double deviation_angle
Definition occtl_mesh.h:130
double deviation_coefficient
Definition occtl_mesh.h:129
int32_t internal_vertices_mode
Definition occtl_mesh.h:112
int32_t use_bbox
Definition occtl_mesh.h:125
int32_t relative
Definition occtl_mesh.h:111
int32_t adjust_min_size
Definition occtl_mesh.h:119
int32_t control_surface_deflection_all
Definition occtl_mesh.h:115
Definition occtl_mesh.h:652
const double * triangle_normals
Definition occtl_mesh.h:653
size_t triangle_count
Definition occtl_mesh.h:656
occtl_node_id_t root
Definition occtl_mesh.h:658
const uint32_t * triangle_adjacency
Definition occtl_mesh.h:655
size_t face_count
Definition occtl_mesh.h:657
Definition occtl_mesh.h:626
size_t node_count
Definition occtl_mesh.h:628
occtl_node_id_t root
Definition occtl_mesh.h:632
const uint32_t * triangles
Definition occtl_mesh.h:629
size_t face_count
Definition occtl_mesh.h:631
const double * nodes
Definition occtl_mesh.h:627
size_t triangle_count
Definition occtl_mesh.h:630
size_t chain_count
Definition occtl_mesh.h:806
size_t edge_count
Definition occtl_mesh.h:803
const occtl_mesh_triangle_component_boundary_chain_t * chains
Definition occtl_mesh.h:805
uint32_t component_id
Definition occtl_mesh.h:807
occtl_node_id_t root
Definition occtl_mesh.h:808
const occtl_mesh_triangle_component_boundary_edge_t * edges
Definition occtl_mesh.h:802
occtl_node_id_t root
Definition occtl_mesh.h:787
uint32_t component_id
Definition occtl_mesh.h:786
size_t edge_count
Definition occtl_mesh.h:785
const occtl_mesh_triangle_component_boundary_edge_t * edges
Definition occtl_mesh.h:784
size_t component_count
Definition occtl_mesh.h:861
size_t triangle_count
Definition occtl_mesh.h:862
occtl_node_id_t root
Definition occtl_mesh.h:863
const occtl_mesh_triangle_component_summary_t * summaries
Definition occtl_mesh.h:860
occtl_node_id_t root
Definition occtl_mesh.h:723
const uint32_t * triangles
Definition occtl_mesh.h:720
uint32_t component_id
Definition occtl_mesh.h:722
size_t triangle_count
Definition occtl_mesh.h:721
Definition occtl_mesh.h:673
occtl_node_id_t root
Definition occtl_mesh.h:676
Definition occtl_mesh.h:700
const uint32_t * triangle_component_ids
Definition occtl_mesh.h:702
const uint32_t * component_sizes
Definition occtl_mesh.h:704
size_t triangle_count
Definition occtl_mesh.h:703
size_t component_count
Definition occtl_mesh.h:705
occtl_node_id_t root
Definition occtl_mesh.h:706
occtl_node_id_t root
Definition occtl_mesh.h:1016
const occtl_mesh_triangle_cylinder_component_t * components
Definition occtl_mesh.h:1069
occtl_node_id_t root
Definition occtl_mesh.h:1072
size_t component_count
Definition occtl_mesh.h:1070
size_t triangle_count
Definition occtl_mesh.h:1071
occtl_node_id_t root
Definition occtl_mesh.h:880
const occtl_mesh_triangle_plane_component_t * components
Definition occtl_mesh.h:926
occtl_node_id_t root
Definition occtl_mesh.h:929
size_t triangle_count
Definition occtl_mesh.h:928
size_t component_count
Definition occtl_mesh.h:927
occtl_node_id_t root
Definition occtl_mesh.h:946
size_t component_count
Definition occtl_mesh.h:995
size_t triangle_count
Definition occtl_mesh.h:996
occtl_node_id_t root
Definition occtl_mesh.h:997
const occtl_mesh_triangle_sphere_component_t * components
Definition occtl_mesh.h:994
Definition occtl_topo_types.h:50
Definition occtl_mesh.h:541
double deflection
Definition occtl_mesh.h:546
occtl_uid_t source_uid
Definition occtl_mesh.h:547
const double * nodes
Definition occtl_mesh.h:542
size_t node_count
Definition occtl_mesh.h:543
const double * parameters
Definition occtl_mesh.h:545
Definition occtl_mesh.h:581
double deflection
Definition occtl_mesh.h:587
occtl_uid_t source_uid
Definition occtl_mesh.h:588
const double * parameters
Definition occtl_mesh.h:586
const uint32_t * node_indices
Definition occtl_mesh.h:582
size_t node_count
Definition occtl_mesh.h:584
Definition occtl_mesh.h:439
size_t node_count
Definition occtl_mesh.h:441
occtl_uid_t source_uid
Definition occtl_mesh.h:448
const double * nodes
Definition occtl_mesh.h:440
const double * uvs
Definition occtl_mesh.h:444
const uint32_t * triangles
Definition occtl_mesh.h:445
const double * normals
Definition occtl_mesh.h:443
size_t triangle_count
Definition occtl_mesh.h:446
double deflection
Definition occtl_mesh.h:447
C++ veneer for the topo module.