BRL-CAD
csg.h
Go to the documentation of this file.
1/* C S G . H
2 * BRL-CAD
3 *
4 * Copyright (c) 2007-2023 United States Government as represented by
5 * the U.S. Army Research Laboratory.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License
9 * version 2.1 as published by the Free Software Foundation.
10 *
11 * This library is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this file; see the file named COPYING for more
18 * information.
19 */
20/** @addtogroup brep_csg
21 * @brief
22 * Reconstruct CSG Implicit Boolean Hierarchies from Non-Uniform Rational
23 * B-Spline (NURBS) Boundary Representations.
24 */
25#ifndef BREP_CSG_H
26#define BREP_CSG_H
27
28#include "common.h"
29#include "bu/ptbl.h"
30#include "brep/defines.h"
31
32/** @{ */
33/** @file brep/csg.h */
34
35#ifdef __cplusplus
36
37extern "C++" {
38
39/* Shape recognition functions - HIGHLY EXPERIMENTAL,
40 * DO NOT RELY ON - the odds are quite good that this whole
41 * setup will be moving to libanalyze and it's public API
42 * there will likely be quite different */
43
44/* Structure for holding parameters corresponding
45 * to a csg primitive. Not all parameters will be
46 * used for all primitives - the structure includes
47 * enough data slots to describe any primitive that may
48 * be matched by the shape recognition logic */
53 /* Unique id number */
54 int csg_id;
55 char bool_op; /* Boolean operator - u = union (default), - = subtraction, + = intersection */
63 size_t plane_cnt;
65 /* An implicit plane, if present, may close a face on a parent solid */
69 /* bot */
74 /* information flags */
76};
77
78/* Forward declarations */
80
81/* Topological shoal */
85 /* Unique id number */
88 /* struct csg_obj_params */
90
91 /* Working information */
94};
95
96/* Topological island */
98
99 /* Overall type of island - typically comb or brep, but may
100 * be an actual type if the nucleus corresponds to a single
101 * implicit primitive */
103
104 /* Unique id number */
106
107 /* Context information */
108 const ON_Brep *brep;
109
110 /* Shape representation data */
111 ON_Brep *local_brep;
112 char local_brep_bool_op; /* Boolean operator - u = union (default), - = subtraction, + = intersection */
113
114 /* Nucleus */
116 /* struct subbrep_shoal_data */
118
119 /* For union objects, we list the subtractions it needs */
121
122 /* subbrep metadata */
123 struct bu_vls *key;
124 ON_BoundingBox *bbox;
125
126 /* Working information - should probably be in private struct */
131 int *fol; /* Faces with outer loops in object loop network */
132 int *fil; /* Faces with only inner loops in object loop network */
141};
142
143
144extern BREP_EXPORT struct bu_ptbl *brep_to_csg(struct bu_vls *msgs, const ON_Brep *brep);
145
146
147} /* extern C++ */
148#endif
149
150#endif /* BREP_CSG_H */
151/** @} */
152/*
153 * Local Variables:
154 * mode: C
155 * tab-width: 8
156 * indent-tabs-mode: t
157 * c-file-style: "stroustrup"
158 * End:
159 * ex: shiftwidth=4 tabstop=8
160 */
Header file for the BRL-CAD common definitions.
struct bu_ptbl * brep_to_csg(struct bu_vls *msgs, const ON_Brep *brep)
fastf_t vect_t[ELEMENTS_PER_VECT]
3-tuple vector
Definition: vmath.h:345
double fastf_t
fastest 64-bit (or larger) floating point type
Definition: vmath.h:330
fastf_t plane_t[ELEMENTS_PER_PLANE]
Definition of a plane equation.
Definition: vmath.h:393
fastf_t point_t[ELEMENTS_PER_POINT]
3-tuple point
Definition: vmath.h:351
Definition: ptbl.h:53
Definition: vls.h:53
fastf_t height
Definition: csg.h:60
int * csg_faces
Definition: csg.h:72
fastf_t radius
Definition: csg.h:58
int arb_type
Definition: csg.h:61
int csg_id
Definition: csg.h:54
size_t plane_cnt
Definition: csg.h:63
char bool_op
Definition: csg.h:55
vect_t hv
Definition: csg.h:57
point_t * csg_verts
Definition: csg.h:73
int csg_face_cnt
Definition: csg.h:70
int half_cyl
Definition: csg.h:75
point_t implicit_plane_origin
Definition: csg.h:67
int csg_vert_cnt
Definition: csg.h:71
int negative
Definition: csg.h:52
point_t p[8]
Definition: csg.h:62
int csg_type
Definition: csg.h:51
struct subbrep_shoal_data * s
Definition: csg.h:50
plane_t * planes
Definition: csg.h:64
fastf_t r2
Definition: csg.h:59
int have_implicit_plane
Definition: csg.h:66
point_t origin
Definition: csg.h:56
vect_t implicit_plane_normal
Definition: csg.h:68
int null_vert_cnt
Definition: csg.h:137
void * face_surface_types
Definition: csg.h:127
int null_edge_cnt
Definition: csg.h:139
int * obj_cnt
Definition: csg.h:128
int * null_edges
Definition: csg.h:140
struct subbrep_shoal_data * nucleus
Definition: csg.h:115
int * island_loops
Definition: csg.h:130
int island_loops_cnt
Definition: csg.h:134
const ON_Brep * brep
Definition: csg.h:108
int * null_verts
Definition: csg.h:138
int island_faces_cnt
Definition: csg.h:133
ON_Brep * local_brep
Definition: csg.h:111
struct bu_ptbl * subtractions
Definition: csg.h:120
struct bu_ptbl * island_children
Definition: csg.h:117
char local_brep_bool_op
Definition: csg.h:112
ON_BoundingBox * bbox
Definition: csg.h:124
int * island_faces
Definition: csg.h:129
struct bu_vls * key
Definition: csg.h:123
struct bu_ptbl * shoal_children
Definition: csg.h:89
int shoal_loops_cnt
Definition: csg.h:93
int shoal_id
Definition: csg.h:86
struct csg_object_params * params
Definition: csg.h:87
struct subbrep_island_data * i
Definition: csg.h:83
int shoal_type
Definition: csg.h:84
int * shoal_loops
Definition: csg.h:92