BRL-CAD
Loading...
Searching...
No Matches
edit.h
Go to the documentation of this file.
1/* E D I T . H
2 * BRL-CAD
3 *
4 * Copyright (c) 2023-2025 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_edit
21 * @brief
22 * Implementation of edit support for brep.
23 * C functions and Cpp functions are provided.
24 */
25#ifndef BREP_EDIT_H
26#define BREP_EDIT_H
27
28#include "common.h"
29#include "brep/defines.h"
30
31/** @{ */
32/** @file brep/edit.h */
33
34/// function below are C interface
36
37/**
38 * create an empty ON_Brep. return pointer to the ON_Brep object
39 */
40BREP_EXPORT extern void *
42
44
45/// function below are C++ interface
46#ifdef __cplusplus
47extern "C++"
48{
49#include <vector>
50
51 /**
52 * create a brep vertex
53 */
54 BREP_EXPORT extern int
56
57 /**
58 * remove a brep vertex
59 */
60 BREP_EXPORT extern bool
62
63 /**
64 * create a 2D parameter space geometric line
65 * return id of the curve2d
66 */
67 BREP_EXPORT extern int
68 brep_curve2d_make_line(ON_Brep *brep, const ON_2dPoint &start, const ON_2dPoint &end);
69
70 /**
71 * remove a curve2d from brep
72 */
73 BREP_EXPORT extern bool
75
76 /**
77 * create a nurbs curve using a template.
78 * position can be specified if position != NULL
79 * return id of the curve
80 */
81 BREP_EXPORT extern int
83
84 /**
85 * create a nurbs curve given detailed information
86 * return id of the curve
87 */
88 BREP_EXPORT extern int
90
91 /**
92 * create a cubic nurbs curve by interpolating a set of points
93 * return id of the curve
94 * method: Local cubic interpolation with C1 continuity
95 * reference: The NURBS Book (2nd Edition), chapter 9.3.4
96 */
97 BREP_EXPORT extern int
99
100 /**
101 * copy a curve from brep
102 * return id of the new curve
103 */
104 BREP_EXPORT extern int
106
107 /**
108 * remove a curve from brep
109 * @attention the index of m_C3 is changed after remove!!!
110 */
111 BREP_EXPORT extern bool
113
114 /**
115 * move curve along a vector.
116 */
117 BREP_EXPORT extern bool
118 brep_curve_move(ON_Brep *brep, int curve_id, const ON_3dVector &point);
119
120 /**
121 * set control vertex of a curve
122 */
123 BREP_EXPORT extern bool
124 brep_curve_set_cv(ON_Brep *brep, int curve_id, int cv_id, const ON_4dPoint &point);
125
126 /**
127 * reverse parameterizatrion by negating all knots
128 * and reversing the order of the control vertices.
129 */
130 BREP_EXPORT extern bool
132
133 /**
134 * insert knots into a curve
135 */
136 BREP_EXPORT extern bool
138
139 /**
140 * trim a curve using a parameter range
141 */
142 BREP_EXPORT extern bool
143 brep_curve_trim(ON_Brep *brep, int curve_id, double t0, double t1);
144
145 /**
146 * split a curve at a parameter. Old curve will be deleted.
147 */
148 BREP_EXPORT extern bool
149 brep_curve_split(ON_Brep *brep, int curve_id, double t);
150
151 /**
152 * join the end of curve_id_1 to the start of curve_id_2.
153 * return id of the new curve, delete the two old curves.
154 * @attention the index of m_C3 is changed after join!!!
155 */
156 BREP_EXPORT extern int
158
159 /**
160 * create a nurbs curve using a template
161 * position can be specified if argc == 3
162 * return id of the surface
163 */
164 BREP_EXPORT extern int
166
167 /**
168 * extract a vertex from a surface
169 */
170 BREP_EXPORT extern int
171 brep_surface_extract_vertex(ON_Brep *brep, int surface_id, double u, double v);
172
173 /**
174 * extract a curve from a surface
175 */
176 BREP_EXPORT extern int
177 brep_surface_extract_curve(ON_Brep *brep, int surface_id, int dir, double t);
178
179 /**
180 * create a bicubic nurbs surface by interpolating a set of points
181 * return id of the surface
182 * method: Global cubic interpolation with C2 continuity
183 * reference: The NURBS Book (2nd Edition), chapter 9.2.5
184 */
185 BREP_EXPORT extern int
187
188 /**
189 * copy a surface from brep
190 * return id of the new surface
191 */
192 BREP_EXPORT extern int
194
195 /**
196 * move surface to a new position
197 */
198 BREP_EXPORT extern bool
200
201 /**
202 * set control vertex of a curve
203 */
204 BREP_EXPORT extern bool
205 brep_surface_set_cv(ON_Brep *brep, int surface_id, int cv_id_u, int cv_id_v, const ON_4dPoint &point);
206
207 /**
208 * trim a surface using a parameter range
209 * dir = 0: u direction
210 * dir = 1: v direction
211 */
212 BREP_EXPORT extern bool
213 brep_surface_trim(ON_Brep *brep, int surface_id, int dir, double t0, double t1);
214
215 /**
216 * split a surface at a parameter. Old surface will be deleted.
217 */
218 BREP_EXPORT extern bool
219 brep_surface_split(ON_Brep *brep, int surface_id, int dir, double t);
220
221 /**
222 * create a ruled surface.
223 * The two curves must have the same NURBS form knots.
224 * srf(s,t) = (1.0-t)*curveA(s) + t*curveB(s).
225 * return: if successful, id of the new surface; otherwise, -1.
226 */
227 BREP_EXPORT extern int
229
230 /**
231 * create a surface by extruding a curve along another curve.
232 * return: if successful, id of the new surface; otherwise, -1.
233 */
234 BREP_EXPORT extern int
236
237 /**
238 * create a surface by rotating a curve around an axis.
239 * return: if successful, id of the new surface; otherwise, -1.
240 */
241 BREP_EXPORT extern int
243
244 /**
245 * remove a surface from brep
246 * @attention the index of m_S is changed after remove!!!
247 */
248 BREP_EXPORT extern bool
250
251 /**
252 * create a brep edge
253 */
254 BREP_EXPORT extern int
255 brep_edge_create(ON_Brep *brep, int from, int to, int curve);
256
257 /**
258 * create a brep face
259 */
260 BREP_EXPORT extern int
262
263 /**
264 * reverse a brep face
265 */
266 BREP_EXPORT extern bool
268
269 /**
270 * create a brep face loop
271 */
272 BREP_EXPORT extern int
273 brep_loop_create(ON_Brep *brep, int face_id);
274
275 /**
276 * create a trim of a loop
277 */
278 BREP_EXPORT extern int
279 brep_trim_create(ON_Brep *brep, int loop_id, int edge_id, int orientation, int para_curve_id);
280} /* extern C++ */
281#endif
282
283#endif /* BREP_EDIT_H */
284/** @} */
285/*
286 * Local Variables:
287 * mode: C
288 * tab-width: 8
289 * indent-tabs-mode: t
290 * c-file-style: "stroustrup"
291 * End:
292 * ex: shiftwidth=4 tabstop=8
293 */
Definition dvec.h:74
dvec(double s)
Header file for the BRL-CAD common definitions.
bool brep_curve_reverse(ON_Brep *brep, int curve_id)
int brep_surface_interpCrv(ON_Brep *brep, int cv_count_x, int cv_count_y, std::vector< ON_3dPoint > points)
int brep_surface_extract_curve(ON_Brep *brep, int surface_id, int dir, double t)
int brep_vertex_create(ON_Brep *brep, ON_3dPoint point)
function below are C++ interface
int brep_curve2d_make_line(ON_Brep *brep, const ON_2dPoint &start, const ON_2dPoint &end)
bool brep_vertex_remove(ON_Brep *brep, int v_id)
int brep_curve_in(ON_Brep *brep, bool is_rational, int order, int cv_count, std::vector< ON_4dPoint > cv)
bool brep_curve_split(ON_Brep *brep, int curve_id, double t)
int brep_surface_extract_vertex(ON_Brep *brep, int surface_id, double u, double v)
int brep_curve_interpCrv(ON_Brep *brep, std::vector< ON_3dPoint > points)
bool brep_surface_trim(ON_Brep *brep, int surface_id, int dir, double t0, double t1)
int brep_trim_create(ON_Brep *brep, int loop_id, int edge_id, int orientation, int para_curve_id)
bool brep_curve_insert_knot(ON_Brep *brep, int curve_id, double knot, int multiplicity)
bool brep_face_reverse(ON_Brep *brep, int face)
bool brep_curve2d_remove(ON_Brep *brep, int curve_id)
bool brep_curve_move(ON_Brep *brep, int curve_id, const ON_3dVector &point)
int brep_curve_join(ON_Brep *brep, int curve_id_1, int curve_id_2)
bool brep_curve_set_cv(ON_Brep *brep, int curve_id, int cv_id, const ON_4dPoint &point)
int brep_face_create(ON_Brep *brep, int surface)
int brep_loop_create(ON_Brep *brep, int face_id)
int brep_edge_create(ON_Brep *brep, int from, int to, int curve)
void * brep_create(void)
function below are C interface
int brep_curve_copy(ON_Brep *brep, int curve_id)
int brep_curve_make(ON_Brep *brep, const ON_3dPoint &position)
int brep_surface_tensor_product(ON_Brep *brep, int curve_id0, int curve_id1)
bool brep_curve_remove(ON_Brep *brep, int curve_id)
bool brep_curve_trim(ON_Brep *brep, int curve_id, double t0, double t1)
int brep_surface_create_ruled(ON_Brep *brep, int curve_id0, int curve_id1)
bool brep_surface_set_cv(ON_Brep *brep, int surface_id, int cv_id_u, int cv_id_v, const ON_4dPoint &point)
int brep_surface_revolution(ON_Brep *brep, int curve_id0, ON_3dPoint line_start, ON_3dPoint line_end, double angle=2 *ON_PI)
bool brep_surface_move(ON_Brep *brep, int surface_id, const ON_3dVector &point)
int brep_surface_copy(ON_Brep *brep, int surface_id)
bool brep_surface_split(ON_Brep *brep, int surface_id, int dir, double t)
bool brep_surface_remove(ON_Brep *brep, int surface_id)
int brep_surface_make(ON_Brep *brep, const ON_3dPoint &position)
NMG topological face.
Definition topology.h:210