BRL-CAD
make.c
Go to the documentation of this file.
1 /* M A K E . C
2  * BRL-CAD
3  *
4  * Copyright (c) 2008-2014 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 /** @file libged/make.c
21  *
22  * The make command.
23  *
24  */
25 
26 #include "common.h"
27 
28 #include <signal.h>
29 #include <stdlib.h>
30 #include <string.h>
31 
32 
33 #include "bu/getopt.h"
34 #include "rtgeom.h"
35 #include "wdb.h"
36 
37 #include "./ged_private.h"
38 
39 
40 int
41 ged_make(struct ged *gedp, int argc, const char *argv[])
42 {
43  size_t i;
44  int k;
45  int save_bu_optind;
46  struct directory *dp;
47 
48  /* intentionally double for sscanf */
49  double scale = 1.0;
50  double origin[3] = {0.0, 0.0, 0.0};
51 
52  struct rt_db_internal internal;
53  struct rt_arb_internal *arb_ip;
54  struct rt_ars_internal *ars_ip;
55  struct rt_tgc_internal *tgc_ip;
56  struct rt_ell_internal *ell_ip;
57  struct rt_tor_internal *tor_ip;
58  struct rt_grip_internal *grp_ip;
59  struct rt_half_internal *half_ip;
60  struct rt_rpc_internal *rpc_ip;
61  struct rt_rhc_internal *rhc_ip;
62  struct rt_epa_internal *epa_ip;
63  struct rt_ehy_internal *ehy_ip;
64  struct rt_eto_internal *eto_ip;
65  struct rt_part_internal *part_ip;
66  struct rt_pipe_internal *pipe_ip;
67  struct rt_sketch_internal *sketch_ip;
68  struct rt_extrude_internal *extrude_ip;
69  struct rt_bot_internal *bot_ip;
70  struct rt_arbn_internal *arbn_ip;
71  struct rt_superell_internal *superell_ip;
72  struct rt_metaball_internal *metaball_ip;
73  struct rt_pnts_internal *pnts_ip;
74 
75  static const char *usage = "-h | -t | -o origin -s sf name <arb8|arb7|arb6|arb5|arb4|arbn|ars|bot|ehy|ell|ell1|epa|eto|extrude|grip|half|hyp|nmg|part|pipe|pnts|rcc|rec|rhc|rpc|rpp|sketch|sph|tec|tgc|tor|trc>";
76 
79  GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
80 
81  /* initialize result */
82  bu_vls_trunc(gedp->ged_result_str, 0);
83 
84  /* must be wanting help */
85  if (argc == 1) {
86  bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
87  return GED_HELP;
88  }
89 
90  bu_optind = 1;
91 
92  /* Process arguments */
93  while ((k = bu_getopt(argc, (char * const *)argv, "hHo:O:s:S:tT?")) != -1) {
94  if (bu_optopt == '?') k='h';
95  switch (k) {
96  case 'o':
97  case 'O':
98  if (sscanf(bu_optarg, "%lf %lf %lf",
99  &origin[X],
100  &origin[Y],
101  &origin[Z]) != 3) {
102  bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
103  return GED_ERROR;
104  }
105  break;
106  case 's':
107  case 'S':
108  if (sscanf(bu_optarg, "%lf", &scale) != 1) {
109  bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
110  return GED_ERROR;
111  }
112  break;
113  case 't':
114  case 'T':
115  if (argc == 2) {
116  bu_vls_printf(gedp->ged_result_str, "arb8 arb7 arb6 arb5 arb4 arbn ars bot ehy ell ell1 epa eto extrude grip half hyp nmg part pipe pnts rcc rec rhc rpc rpp sketch sph tec tgc tor trc superell metaball");
117  return GED_HELP;
118  }
119 
120  bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
121  return GED_ERROR;
122  case 'h':
123  case 'H':
124  bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
125  return GED_HELP;
126  default:
127  bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
128  return GED_ERROR;
129  }
130  }
131 
132  argc -= bu_optind;
133 
134  if (argc != 2) {
135  bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
136  return GED_ERROR;
137  }
138 
139  save_bu_optind = bu_optind;
140 
142  RT_DB_INTERNAL_INIT(&internal);
143 
144  if (BU_STR_EQUAL(argv[bu_optind+1], "arb8") ||
145  BU_STR_EQUAL(argv[bu_optind+1], "rpp")) {
146  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
147  internal.idb_type = ID_ARB8;
148  internal.idb_meth = &OBJ[ID_ARB8];
149  BU_ALLOC(internal.idb_ptr, struct rt_arb_internal);
150  arb_ip = (struct rt_arb_internal *)internal.idb_ptr;
151  arb_ip->magic = RT_ARB_INTERNAL_MAGIC;
152  VSET(arb_ip->pt[0] ,
153  origin[X] + 0.5*scale,
154  origin[Y] - 0.5*scale,
155  origin[Z] - 0.5*scale);
156  for (i = 1; i < 8; i++)
157  VMOVE(arb_ip->pt[i], arb_ip->pt[0]);
158  arb_ip->pt[1][Y] += scale;
159  arb_ip->pt[2][Y] += scale;
160  arb_ip->pt[2][Z] += scale;
161  arb_ip->pt[3][Z] += scale;
162  for (i = 4; i < 8; i++)
163  arb_ip->pt[i][X] -= scale;
164  arb_ip->pt[5][Y] += scale;
165  arb_ip->pt[6][Y] += scale;
166  arb_ip->pt[6][Z] += scale;
167  arb_ip->pt[7][Z] += scale;
168  } else if (BU_STR_EQUAL(argv[bu_optind+1], "arb7")) {
169  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
170  internal.idb_type = ID_ARB8;
171  internal.idb_meth = &OBJ[ID_ARB8];
172  BU_ALLOC(internal.idb_ptr, struct rt_arb_internal);
173  arb_ip = (struct rt_arb_internal *)internal.idb_ptr;
174  arb_ip->magic = RT_ARB_INTERNAL_MAGIC;
175  VSET(arb_ip->pt[0] ,
176  origin[X] + 0.5*scale,
177  origin[Y] - 0.5*scale,
178  origin[Z] - 0.25*scale);
179  for (i = 1; i < 8; i++)
180  VMOVE(arb_ip->pt[i], arb_ip->pt[0]);
181  arb_ip->pt[1][Y] += scale;
182  arb_ip->pt[2][Y] += scale;
183  arb_ip->pt[2][Z] += scale;
184  arb_ip->pt[3][Z] += 0.5*scale;
185  for (i = 4; i < 8; i++)
186  arb_ip->pt[i][X] -= scale;
187  arb_ip->pt[5][Y] += scale;
188  arb_ip->pt[6][Y] += scale;
189  arb_ip->pt[6][Z] += 0.5*scale;
190  } else if (BU_STR_EQUAL(argv[bu_optind+1], "arb6")) {
191  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
192  internal.idb_type = ID_ARB8;
193  internal.idb_meth = &OBJ[ID_ARB8];
194  BU_ALLOC(internal.idb_ptr, struct rt_arb_internal);
195  arb_ip = (struct rt_arb_internal *)internal.idb_ptr;
196  arb_ip->magic = RT_ARB_INTERNAL_MAGIC;
197  VSET(arb_ip->pt[0],
198  origin[X] + 0.5*scale,
199  origin[Y] - 0.5*scale,
200  origin[Z] - 0.5*scale);
201  for (i = 1; i < 8; i++)
202  VMOVE(arb_ip->pt[i], arb_ip->pt[0]);
203  arb_ip->pt[1][Y] += scale;
204  arb_ip->pt[2][Y] += scale;
205  arb_ip->pt[2][Z] += scale;
206  arb_ip->pt[3][Z] += scale;
207  for (i = 4; i < 8; i++)
208  arb_ip->pt[i][X] -= scale;
209  arb_ip->pt[4][Y] += 0.5*scale;
210  arb_ip->pt[5][Y] += 0.5*scale;
211  arb_ip->pt[6][Y] += 0.5*scale;
212  arb_ip->pt[6][Z] += scale;
213  arb_ip->pt[7][Y] += 0.5*scale;
214  arb_ip->pt[7][Z] += scale;
215  } else if (BU_STR_EQUAL(argv[bu_optind+1], "arb5")) {
216  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
217  internal.idb_type = ID_ARB8;
218  internal.idb_meth = &OBJ[ID_ARB8];
219  BU_ALLOC(internal.idb_ptr, struct rt_arb_internal);
220  arb_ip = (struct rt_arb_internal *)internal.idb_ptr;
221  arb_ip->magic = RT_ARB_INTERNAL_MAGIC;
222  VSET(arb_ip->pt[0] ,
223  origin[X] + 0.5*scale,
224  origin[Y] - 0.5*scale,
225  origin[Z] - 0.5*scale);
226  for (i = 1; i < 8; i++)
227  VMOVE(arb_ip->pt[i], arb_ip->pt[0]);
228  arb_ip->pt[1][Y] += scale;
229  arb_ip->pt[2][Y] += scale;
230  arb_ip->pt[2][Z] += scale;
231  arb_ip->pt[3][Z] += scale;
232  for (i = 4; i < 8; i++)
233  {
234  arb_ip->pt[i][X] -= scale;
235  arb_ip->pt[i][Y] += 0.5*scale;
236  arb_ip->pt[i][Z] += 0.5*scale;
237  }
238  } else if (BU_STR_EQUAL(argv[bu_optind+1], "arb4")) {
239  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
240  internal.idb_type = ID_ARB8;
241  internal.idb_meth = &OBJ[ID_ARB8];
242  BU_ALLOC(internal.idb_ptr, struct rt_arb_internal);
243  arb_ip = (struct rt_arb_internal *)internal.idb_ptr;
244  arb_ip->magic = RT_ARB_INTERNAL_MAGIC;
245  VSET(arb_ip->pt[0] ,
246  origin[X] + 0.5*scale,
247  origin[Y] - 0.5*scale,
248  origin[Z] - 0.5*scale);
249  for (i = 1; i < 8; i++)
250  VMOVE(arb_ip->pt[i], arb_ip->pt[0]);
251  arb_ip->pt[1][Y] += scale;
252  arb_ip->pt[2][Y] += scale;
253  arb_ip->pt[2][Z] += scale;
254  arb_ip->pt[3][Y] += scale;
255  arb_ip->pt[3][Z] += scale;
256  for (i = 4; i < 8; i++)
257  {
258  arb_ip->pt[i][X] -= scale;
259  arb_ip->pt[i][Y] += scale;
260  }
261  } else if (BU_STR_EQUAL(argv[bu_optind+1], "arbn")) {
262  point_t view_center;
263 
264  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
265  internal.idb_type = ID_ARBN;
266  internal.idb_meth = &OBJ[ID_ARBN];
267  BU_ALLOC(internal.idb_ptr, struct rt_arbn_internal);
268  arbn_ip = (struct rt_arbn_internal *)internal.idb_ptr;
269  arbn_ip->magic = RT_ARBN_INTERNAL_MAGIC;
270  arbn_ip->neqn = 8;
271  arbn_ip->eqn = (plane_t *)bu_calloc(arbn_ip->neqn,
272  sizeof(plane_t), "arbn plane eqns");
273  VSET(arbn_ip->eqn[0], 1, 0, 0);
274  arbn_ip->eqn[0][W] = 0.5*scale;
275  VSET(arbn_ip->eqn[1], -1, 0, 0);
276  arbn_ip->eqn[1][W] = 0.5*scale;
277  VSET(arbn_ip->eqn[2], 0, 1, 0);
278  arbn_ip->eqn[2][W] = 0.5*scale;
279  VSET(arbn_ip->eqn[3], 0, -1, 0);
280  arbn_ip->eqn[3][W] = 0.5*scale;
281  VSET(arbn_ip->eqn[4], 0, 0, 1);
282  arbn_ip->eqn[4][W] = 0.5*scale;
283  VSET(arbn_ip->eqn[5], 0, 0, -1);
284  arbn_ip->eqn[5][W] = 0.5*scale;
285  VSET(arbn_ip->eqn[6], 0.57735, 0.57735, 0.57735);
286  arbn_ip->eqn[6][W] = 0.5*scale;
287  VSET(arbn_ip->eqn[7], -0.57735, -0.57735, -0.57735);
288  arbn_ip->eqn[7][W] = 0.5*scale;
289  VSET(view_center,
290  origin[X],
291  origin[Y],
292  origin[Z]);
293  for (i = 0; i < arbn_ip->neqn; i++) {
294  arbn_ip->eqn[i][W] +=
295  VDOT(view_center, arbn_ip->eqn[i]);
296  }
297  } else if (BU_STR_EQUAL(argv[bu_optind+1], "ars")) {
298  size_t curve;
299  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
300  internal.idb_type = ID_ARS;
301  internal.idb_meth = &OBJ[ID_ARS];
302  BU_ALLOC(internal.idb_ptr, struct rt_ars_internal);
303  ars_ip = (struct rt_ars_internal *)internal.idb_ptr;
304  ars_ip->magic = RT_ARS_INTERNAL_MAGIC;
305  ars_ip->ncurves = 3;
306  ars_ip->pts_per_curve = 3;
307  ars_ip->curves = (fastf_t **)bu_malloc((ars_ip->ncurves+1) * sizeof(fastf_t *), "ars curve ptrs");
308 
309  for (curve=0; curve < ars_ip->ncurves; curve++) {
310  ars_ip->curves[curve] = (fastf_t *)bu_calloc(
311  (ars_ip->pts_per_curve + 1) * 3,
312  sizeof(fastf_t), "ARS points");
313 
314  if (curve == 0) {
315  VSET(&(ars_ip->curves[0][0]),
316  origin[X],
317  origin[Y],
318  origin[Z]);
319  VMOVE(&(ars_ip->curves[curve][3]), &(ars_ip->curves[curve][0]));
320  VMOVE(&(ars_ip->curves[curve][6]), &(ars_ip->curves[curve][0]));
321  } else if (curve == (ars_ip->ncurves - 1)) {
322  VSET(&(ars_ip->curves[curve][0]),
323  origin[X],
324  origin[Y],
325  origin[Z]+curve*0.5*scale);
326  VMOVE(&(ars_ip->curves[curve][3]), &(ars_ip->curves[curve][0]));
327  VMOVE(&(ars_ip->curves[curve][6]), &(ars_ip->curves[curve][0]));
328 
329  } else {
330  fastf_t x, y, z;
331  x = origin[X]+curve*0.5*scale;
332  y = origin[Y]+curve*0.5*scale;
333  z = origin[Z]+curve*0.5*scale;
334 
335  VSET(&ars_ip->curves[curve][0],
336  origin[X],
337  origin[Y],
338  z);
339  VSET(&ars_ip->curves[curve][3],
340  x,
341  origin[Y],
342  z);
343  VSET(&ars_ip->curves[curve][6],
344  x, y, z);
345  }
346  }
347 
348  } else if (BU_STR_EQUAL(argv[bu_optind+1], "sph")) {
349  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
350  internal.idb_type = ID_ELL;
351  internal.idb_meth = &OBJ[ID_ELL];
352  BU_ALLOC(internal.idb_ptr, struct rt_ell_internal);
353  ell_ip = (struct rt_ell_internal *)internal.idb_ptr;
354  ell_ip->magic = RT_ELL_INTERNAL_MAGIC;
355  VSET(ell_ip->v, origin[X], origin[Y], origin[Z]);
356  VSET(ell_ip->a, 0.5*scale, 0.0, 0.0); /* A */
357  VSET(ell_ip->b, 0.0, 0.5*scale, 0.0); /* B */
358  VSET(ell_ip->c, 0.0, 0.0, 0.5*scale); /* C */
359  } else if ((BU_STR_EQUAL(argv[bu_optind+1], "grp")) ||
360  (BU_STR_EQUAL(argv[bu_optind+1], "grip"))) {
361  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
362  internal.idb_type = ID_GRIP;
363  internal.idb_meth = &OBJ[ID_GRIP];
364  BU_ALLOC(internal.idb_ptr, struct rt_grip_internal);
365  grp_ip = (struct rt_grip_internal *) internal.idb_ptr;
366  grp_ip->magic = RT_GRIP_INTERNAL_MAGIC;
367  VSET(grp_ip->center, origin[X], origin[Y],
368  origin[Z]);
369  VSET(grp_ip->normal, 1.0, 0.0, 0.0);
370  grp_ip->mag = 0.375*scale;
371  } else if (BU_STR_EQUAL(argv[bu_optind+1], "ell1")) {
372  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
373  internal.idb_type = ID_ELL;
374  internal.idb_meth = &OBJ[ID_ELL];
375  BU_ALLOC(internal.idb_ptr, struct rt_ell_internal);
376  ell_ip = (struct rt_ell_internal *)internal.idb_ptr;
377  ell_ip->magic = RT_ELL_INTERNAL_MAGIC;
378  VSET(ell_ip->v, origin[X], origin[Y], origin[Z]);
379  VSET(ell_ip->a, 0.5*scale, 0.0, 0.0); /* A */
380  VSET(ell_ip->b, 0.0, 0.25*scale, 0.0); /* B */
381  VSET(ell_ip->c, 0.0, 0.0, 0.25*scale); /* C */
382  } else if (BU_STR_EQUAL(argv[bu_optind+1], "ell")) {
383  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
384  internal.idb_type = ID_ELL;
385  internal.idb_meth = &OBJ[ID_ELL];
386  BU_ALLOC(internal.idb_ptr, struct rt_ell_internal);
387  ell_ip = (struct rt_ell_internal *)internal.idb_ptr;
388  ell_ip->magic = RT_ELL_INTERNAL_MAGIC;
389  VSET(ell_ip->v, origin[X], origin[Y], origin[Z]);
390  VSET(ell_ip->a, 0.5*scale, 0.0, 0.0); /* A */
391  VSET(ell_ip->b, 0.0, 0.25*scale, 0.0); /* B */
392  VSET(ell_ip->c, 0.0, 0.0, 0.125*scale); /* C */
393  } else if (BU_STR_EQUAL(argv[bu_optind+1], "tor")) {
394  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
395  internal.idb_type = ID_TOR;
396  internal.idb_meth = &OBJ[ID_TOR];
397  BU_ALLOC(internal.idb_ptr, struct rt_tor_internal);
398  tor_ip = (struct rt_tor_internal *)internal.idb_ptr;
399  tor_ip->magic = RT_TOR_INTERNAL_MAGIC;
400  VSET(tor_ip->v, origin[X], origin[Y], origin[Z]);
401  VSET(tor_ip->h, 1.0, 0.0, 0.0); /* unit normal */
402  tor_ip->r_h = 0.1*scale;
403  tor_ip->r_a = 0.4*scale;
404  tor_ip->r_b = tor_ip->r_a;
405  VSET(tor_ip->a, 0.0, 1, 0.0);
406  VSET(tor_ip->b, 0.0, 0.0, 1);
407  } else if (BU_STR_EQUAL(argv[bu_optind+1], "tgc")) {
408  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
409  internal.idb_type = ID_TGC;
410  internal.idb_meth = &OBJ[ID_TGC];
411  BU_ALLOC(internal.idb_ptr, struct rt_tgc_internal);
412  tgc_ip = (struct rt_tgc_internal *)internal.idb_ptr;
413  tgc_ip->magic = RT_TGC_INTERNAL_MAGIC;
414  VSET(tgc_ip->v, origin[X], origin[Y], origin[Z]-0.5*scale);
415  VSET(tgc_ip->h, 0.0, 0.0, scale);
416  VSET(tgc_ip->a, 0.25*scale, 0.0, 0.0);
417  VSET(tgc_ip->b, 0.0, 0.125*scale, 0.0);
418  VSET(tgc_ip->c, 0.125*scale, 0.0, 0.0);
419  VSET(tgc_ip->d, 0.0, 0.25*scale, 0.0);
420  } else if (BU_STR_EQUAL(argv[bu_optind+1], "tec")) {
421  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
422  internal.idb_type = ID_TGC;
423  internal.idb_meth = &OBJ[ID_TGC];
424  BU_ALLOC(internal.idb_ptr, struct rt_tgc_internal);
425  tgc_ip = (struct rt_tgc_internal *)internal.idb_ptr;
426  tgc_ip->magic = RT_TGC_INTERNAL_MAGIC;
427  VSET(tgc_ip->v, origin[X], origin[Y], origin[Z]-0.5*scale);
428  VSET(tgc_ip->h, 0.0, 0.0, scale);
429  VSET(tgc_ip->a, 0.25*scale, 0.0, 0.0);
430  VSET(tgc_ip->b, 0.0, 0.125*scale, 0.0);
431  VSET(tgc_ip->c, 0.125*scale, 0.0, 0.0);
432  VSET(tgc_ip->d, 0.0, (0.0625*scale), 0.0);
433  } else if (BU_STR_EQUAL(argv[bu_optind+1], "rec")) {
434  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
435  internal.idb_type = ID_TGC;
436  internal.idb_meth = &OBJ[ID_TGC];
437  BU_ALLOC(internal.idb_ptr, struct rt_tgc_internal);
438  tgc_ip = (struct rt_tgc_internal *)internal.idb_ptr;
439  tgc_ip->magic = RT_TGC_INTERNAL_MAGIC;
440  VSET(tgc_ip->v, origin[X], origin[Y], origin[Z]- 0.5*scale);
441  VSET(tgc_ip->h, 0.0, 0.0, scale);
442  VSET(tgc_ip->a, 0.25*scale, 0.0, 0.0);
443  VSET(tgc_ip->b, 0.0, 0.125*scale, 0.0);
444  VSET(tgc_ip->c, 0.25*scale, 0.0, 0.0);
445  VSET(tgc_ip->d, 0.0, 0.125*scale, 0.0);
446  } else if (BU_STR_EQUAL(argv[bu_optind+1], "trc")) {
447  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
448  internal.idb_type = ID_TGC;
449  internal.idb_meth = &OBJ[ID_TGC];
450  BU_ALLOC(internal.idb_ptr, struct rt_tgc_internal);
451  tgc_ip = (struct rt_tgc_internal *)internal.idb_ptr;
452  tgc_ip->magic = RT_TGC_INTERNAL_MAGIC;
453  VSET(tgc_ip->v, origin[X], origin[Y], origin[Z]-0.5*scale);
454  VSET(tgc_ip->h, 0.0, 0.0, scale);
455  VSET(tgc_ip->a, 0.25*scale, 0.0, 0.0);
456  VSET(tgc_ip->b, 0.0, 0.25*scale, 0.0);
457  VSET(tgc_ip->c, 0.125*scale, 0.0, 0.0);
458  VSET(tgc_ip->d, 0.0, 0.125*scale, 0.0);
459  } else if (BU_STR_EQUAL(argv[bu_optind+1], "rcc")) {
460  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
461  internal.idb_type = ID_TGC;
462  internal.idb_meth = &OBJ[ID_TGC];
463  BU_ALLOC(internal.idb_ptr, struct rt_tgc_internal);
464  tgc_ip = (struct rt_tgc_internal *)internal.idb_ptr;
465  tgc_ip->magic = RT_TGC_INTERNAL_MAGIC;
466  VSET(tgc_ip->v, origin[X], origin[Y], origin[Z]- 0.5*scale);
467  VSET(tgc_ip->h, 0.0, 0.0, scale);
468  VSET(tgc_ip->a, 0.25*scale, 0.0, 0.0);
469  VSET(tgc_ip->b, 0.0, 0.25*scale, 0.0);
470  VSET(tgc_ip->c, 0.25*scale, 0.0, 0.0);
471  VSET(tgc_ip->d, 0.0, 0.25*scale, 0.0);
472  } else if (BU_STR_EQUAL(argv[bu_optind+1], "half")) {
473  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
474  internal.idb_type = ID_HALF;
475  internal.idb_meth = &OBJ[ID_HALF];
476  BU_ALLOC(internal.idb_ptr, struct rt_half_internal);
477  half_ip = (struct rt_half_internal *)internal.idb_ptr;
478  half_ip->magic = RT_HALF_INTERNAL_MAGIC;
479  VSET(half_ip->eqn, 0.0, 0.0, 1.0);
480  half_ip->eqn[W] = (origin[Z]);
481  } else if (BU_STR_EQUAL(argv[bu_optind+1], "rpc")) {
482  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
483  internal.idb_type = ID_RPC;
484  internal.idb_meth = &OBJ[ID_RPC];
485  BU_ALLOC(internal.idb_ptr, struct rt_rpc_internal);
486  rpc_ip = (struct rt_rpc_internal *)internal.idb_ptr;
487  rpc_ip->rpc_magic = RT_RPC_INTERNAL_MAGIC;
488  VSET(rpc_ip->rpc_V, origin[X], origin[Y]-scale*0.25, origin[Z]-scale*0.5);
489  VSET(rpc_ip->rpc_H, 0.0, 0.0, scale);
490  VSET(rpc_ip->rpc_B, 0.0, (scale*0.5), 0.0);
491  rpc_ip->rpc_r = scale*0.25;
492  } else if (BU_STR_EQUAL(argv[bu_optind+1], "rhc")) {
493  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
494  internal.idb_type = ID_RHC;
495  internal.idb_meth = &OBJ[ID_RHC];
496  BU_ALLOC(internal.idb_ptr, struct rt_rhc_internal);
497  rhc_ip = (struct rt_rhc_internal *)internal.idb_ptr;
498  rhc_ip->rhc_magic = RT_RHC_INTERNAL_MAGIC;
499  VSET(rhc_ip->rhc_V, origin[X], origin[Y]-0.25*scale, origin[Z]-0.25*scale);
500  VSET(rhc_ip->rhc_H, 0.0, 0.0, 0.5*scale);
501  VSET(rhc_ip->rhc_B, 0.0, 0.5*scale, 0.0);
502  rhc_ip->rhc_r = scale*0.25;
503  rhc_ip->rhc_c = scale*0.10;
504  } else if (BU_STR_EQUAL(argv[bu_optind+1], "epa")) {
505  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
506  internal.idb_type = ID_EPA;
507  internal.idb_meth = &OBJ[ID_EPA];
508  BU_ALLOC(internal.idb_ptr, struct rt_epa_internal);
509  epa_ip = (struct rt_epa_internal *)internal.idb_ptr;
510  epa_ip->epa_magic = RT_EPA_INTERNAL_MAGIC;
511  VSET(epa_ip->epa_V, origin[X], origin[Y], origin[Z]-scale*0.5);
512  VSET(epa_ip->epa_H, 0.0, 0.0, scale);
513  VSET(epa_ip->epa_Au, 0.0, 1.0, 0.0);
514  epa_ip->epa_r1 = scale*0.5;
515  epa_ip->epa_r2 = scale*0.25;
516  } else if (BU_STR_EQUAL(argv[bu_optind+1], "ehy")) {
517  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
518  internal.idb_type = ID_EHY;
519  internal.idb_meth = &OBJ[ID_EHY];
520  BU_ALLOC(internal.idb_ptr, struct rt_ehy_internal);
521  ehy_ip = (struct rt_ehy_internal *)internal.idb_ptr;
522  ehy_ip->ehy_magic = RT_EHY_INTERNAL_MAGIC;
523  VSET(ehy_ip->ehy_V, origin[X], origin[Y], origin[Z]-scale*0.5);
524  VSET(ehy_ip->ehy_H, 0.0, 0.0, scale);
525  VSET(ehy_ip->ehy_Au, 0.0, 1.0, 0.0);
526  ehy_ip->ehy_r1 = scale*0.5;
527  ehy_ip->ehy_r2 = scale*0.25;
528  ehy_ip->ehy_c = ehy_ip->ehy_r2;
529  } else if (BU_STR_EQUAL(argv[bu_optind+1], "eto")) {
530  fastf_t mag;
531  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
532  internal.idb_type = ID_ETO;
533  internal.idb_meth = &OBJ[ID_ETO];
534  BU_ALLOC(internal.idb_ptr, struct rt_eto_internal);
535  eto_ip = (struct rt_eto_internal *)internal.idb_ptr;
536  eto_ip->eto_magic = RT_ETO_INTERNAL_MAGIC;
537  VSET(eto_ip->eto_V, origin[X], origin[Y], origin[Z]);
538  VSET(eto_ip->eto_N, 0.0, 0.0, 1.0);
539  VSET(eto_ip->eto_C, scale*0.1, 0.0, scale*0.1);
540  mag = MAGNITUDE(eto_ip->eto_C);
541  /* Close enough for now.*/
542  eto_ip->eto_r = scale*0.5 - mag*cos(M_PI_4);
543  eto_ip->eto_rd = scale*0.05;
544  } else if (BU_STR_EQUAL(argv[bu_optind+1], "hyp")) {
545  vect_t vertex, height, vectA;
546  VSET(vertex, origin[X], origin[Y], origin[Z] - scale*0.5);
547  VSET(height, 0.0, 0.0, scale);
548  VSET(vectA, 0.0, scale*0.5, 0.0);
549  return mk_hyp(gedp->ged_wdbp, argv[save_bu_optind], vertex, height, vectA, scale*0.25, 0.4);
550  } else if (BU_STR_EQUAL(argv[bu_optind+1], "part")) {
551  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
552  internal.idb_type = ID_PARTICLE;
553  internal.idb_meth = &OBJ[ID_PARTICLE];
554  BU_ALLOC(internal.idb_ptr, struct rt_part_internal);
555  part_ip = (struct rt_part_internal *)internal.idb_ptr;
556  part_ip->part_magic = RT_PART_INTERNAL_MAGIC;
557  VSET(part_ip->part_V, origin[X], origin[Y], origin[Z]-scale*0.25);
558  VSET(part_ip->part_H, 0.0, 0.0, 0.5*scale);
559  part_ip->part_vrad = scale*0.25;
560  part_ip->part_hrad = scale*0.125;
561  part_ip->part_type = RT_PARTICLE_TYPE_CONE;
562  } else if (BU_STR_EQUAL(argv[bu_optind+1], "nmg")) {
563  struct model *m;
564  struct nmgregion *r;
565  struct shell *s;
566 
567  m = nmg_mm();
568  r = nmg_mrsv(m);
569  s = BU_LIST_FIRST(shell, &r->s_hd);
570  nmg_vertex_g(s->vu_p->v_p, origin[X], origin[Y], origin[Z]);
571  (void)nmg_meonvu(s->vu_p);
572  (void)nmg_ml(s);
573  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
574  internal.idb_type = ID_NMG;
575  internal.idb_meth = &OBJ[ID_NMG];
576  internal.idb_ptr = (void *)m;
577  } else if (BU_STR_EQUAL(argv[bu_optind+1], "pipe")) {
578  struct wdb_pipept *ps;
579 
580  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
581  internal.idb_type = ID_PIPE;
582  internal.idb_meth = &OBJ[ID_PIPE];
583  BU_ALLOC(internal.idb_ptr, struct rt_pipe_internal);
584  pipe_ip = (struct rt_pipe_internal *)internal.idb_ptr;
585  pipe_ip->pipe_magic = RT_PIPE_INTERNAL_MAGIC;
586  BU_LIST_INIT(&pipe_ip->pipe_segs_head);
587  BU_ALLOC(ps, struct wdb_pipept);
588  ps->l.magic = WDB_PIPESEG_MAGIC;
589  VSET(ps->pp_coord, origin[X], origin[Y], origin[Z]-0.5*scale);
590  ps->pp_od = 0.25*scale;
591  ps->pp_id = 0.25*ps->pp_od;
592  ps->pp_bendradius = ps->pp_od;
593  BU_LIST_INSERT(&pipe_ip->pipe_segs_head, &ps->l);
594  BU_ALLOC(ps, struct wdb_pipept);
595  ps->l.magic = WDB_PIPESEG_MAGIC;
596  VSET(ps->pp_coord, origin[X], origin[Y], origin[Z]+0.5*scale);
597  ps->pp_od = 0.25*scale;
598  ps->pp_id = 0.25*ps->pp_od;
599  ps->pp_bendradius = ps->pp_od;
600  BU_LIST_INSERT(&pipe_ip->pipe_segs_head, &ps->l);
601  } else if (BU_STR_EQUAL(argv[bu_optind + 1], "pnts")) {
602  struct pnt *point;
603  struct pnt *headPoint;
604 
605  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
606  internal.idb_type = ID_PNTS;
607  internal.idb_meth = &OBJ[ID_PNTS];
608  internal.idb_ptr = (void *) bu_malloc(sizeof(struct rt_pnts_internal), "rt_pnts_internal");
609 
610  pnts_ip = (struct rt_pnts_internal *) internal.idb_ptr;
611  pnts_ip->magic = RT_PNTS_INTERNAL_MAGIC;
612  pnts_ip->count = 1;
613  pnts_ip->type = RT_PNT_TYPE_PNT;
614  pnts_ip->scale = 0;
615 
616  BU_ALLOC(pnts_ip->point, struct pnt);
617  headPoint = (struct pnt *)pnts_ip->point;
618  BU_LIST_INIT(&headPoint->l);
619  BU_ALLOC(point, struct pnt);
620  VSET(point->v, origin[X], origin[Y], origin[Z]);
621  BU_LIST_PUSH(&headPoint->l, &point->l);
622 
623  } else if (BU_STR_EQUAL(argv[bu_optind+1], "bot")) {
624  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
625  internal.idb_type = ID_BOT;
626  internal.idb_meth = &OBJ[ID_BOT];
627  BU_ALLOC(bot_ip, struct rt_bot_internal);
628  internal.idb_ptr = (void *)bot_ip;
629  bot_ip = (struct rt_bot_internal *)internal.idb_ptr;
630  bot_ip->magic = RT_BOT_INTERNAL_MAGIC;
631  bot_ip->mode = RT_BOT_SOLID;
632  bot_ip->orientation = RT_BOT_UNORIENTED;
633  bot_ip->num_vertices = 4;
634  bot_ip->num_faces = 4;
635  bot_ip->faces = (int *)bu_calloc(bot_ip->num_faces * 3, sizeof(int), "BOT faces");
636  bot_ip->vertices = (fastf_t *)bu_calloc(bot_ip->num_vertices * 3, sizeof(fastf_t), "BOT vertices");
637  bot_ip->thickness = (fastf_t *)NULL;
638  bot_ip->face_mode = (struct bu_bitv *)NULL;
639  VSET(&bot_ip->vertices[0], origin[X], origin[Y], origin[Z]);
640  VSET(&bot_ip->vertices[3], origin[X]-0.5*scale, origin[Y]+0.5*scale, origin[Z]-scale);
641  VSET(&bot_ip->vertices[6], origin[X]-0.5*scale, origin[Y]-0.5*scale, origin[Z]-scale);
642  VSET(&bot_ip->vertices[9], origin[X]+0.5*scale, origin[Y]+0.5*scale, origin[Z]-scale);
643  VSET(&bot_ip->faces[0], 0, 1, 3);
644  VSET(&bot_ip->faces[3], 0, 1, 2);
645  VSET(&bot_ip->faces[6], 0, 2, 3);
646  VSET(&bot_ip->faces[9], 1, 2, 3);
647  } else if (BU_STR_EQUAL(argv[bu_optind+1], "extrude")) {
648  char *av[8];
649  char center_str[512];
650  char scale_str[128];
651 
652  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
653  internal.idb_type = ID_EXTRUDE;
654  internal.idb_meth = &OBJ[ID_EXTRUDE];
655  BU_ALLOC(internal.idb_ptr, struct rt_extrude_internal);
656  extrude_ip = (struct rt_extrude_internal *)internal.idb_ptr;
657  extrude_ip->magic = RT_EXTRUDE_INTERNAL_MAGIC;
658  VSET(extrude_ip->V, origin[X], origin[Y], origin[Z]);
659  VSET(extrude_ip->h, 0.0, 0.0, scale);
660  VSET(extrude_ip->u_vec, 1.0, 0.0, 0.0);
661  VSET(extrude_ip->v_vec, 0.0, 1.0, 0.0);
662  extrude_ip->keypoint = 0;
663  av[0] = "make_name";
664  av[1] = "skt_";
665  ged_make_name(gedp, 2, (const char **)av);
666  extrude_ip->sketch_name = bu_strdup(bu_vls_addr(gedp->ged_result_str));
667  extrude_ip->skt = (struct rt_sketch_internal *)NULL;
668 
669  sprintf(center_str, "%f %f %f", V3ARGS(origin));
670  sprintf(scale_str, "%f", scale);
671  av[0] = "make";
672  av[1] = "-o";
673  av[2] = center_str;
674  av[3] = "-s";
675  av[4] = scale_str;
676  av[5] = extrude_ip->sketch_name;
677  av[6] = "sketch";
678  av[7] = (char *)0;
679  ged_make(gedp, 7, (const char **)av);
680  } else if (BU_STR_EQUAL(argv[bu_optind+1], "sketch")) {
681  const char *make_default = NULL;
682 
683  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
684  internal.idb_type = ID_SKETCH;
685  internal.idb_meth = &OBJ[ID_SKETCH];
686  BU_ALLOC(internal.idb_ptr, struct rt_sketch_internal);
687  sketch_ip = (struct rt_sketch_internal *)internal.idb_ptr;
688  sketch_ip->magic = RT_SKETCH_INTERNAL_MAGIC;
689  VSET(sketch_ip->u_vec, 1.0, 0.0, 0.0);
690  VSET(sketch_ip->v_vec, 0.0, 1.0, 0.0);
691  VSET(sketch_ip->V, origin[X], origin[Y], origin[Z]);
692 
693  make_default = getenv("LIBGED_MAKE_SKETCH");
694  if (make_default && bu_str_true(make_default)) {
695  struct carc_seg *csg;
696  struct line_seg *lsg;
697 
698  /* this creates a "default" sketch object -- useful for debugging purposes. */
699 
700  sketch_ip->vert_count = 7;
701  sketch_ip->verts = (point2d_t *)bu_calloc(sketch_ip->vert_count, sizeof(point2d_t), "sketch_ip->verts");
702  sketch_ip->verts[0][0] = 0.25*scale;
703  sketch_ip->verts[0][1] = 0.0;
704  sketch_ip->verts[1][0] = 0.5*scale;
705  sketch_ip->verts[1][1] = 0.0;
706  sketch_ip->verts[2][0] = 0.5*scale;
707  sketch_ip->verts[2][1] = 0.5*scale;
708  sketch_ip->verts[3][0] = 0.0;
709  sketch_ip->verts[3][1] = 0.5*scale;
710  sketch_ip->verts[4][0] = 0.0;
711  sketch_ip->verts[4][1] = 0.25*scale;
712  sketch_ip->verts[5][0] = 0.25*scale;
713  sketch_ip->verts[5][1] = 0.25*scale;
714  sketch_ip->verts[6][0] = 0.125*scale;
715  sketch_ip->verts[6][1] = 0.125*scale;
716  sketch_ip->curve.count = 6;
717  sketch_ip->curve.reverse = (int *)bu_calloc(sketch_ip->curve.count, sizeof(int), "sketch_ip->curve.reverse");
718  sketch_ip->curve.segment = (void **)bu_calloc(sketch_ip->curve.count, sizeof(void *), "sketch_ip->curve.segment");
719 
720  BU_ALLOC(csg, struct carc_seg);
721  sketch_ip->curve.segment[0] = (void *)csg;
722  csg->magic = CURVE_CARC_MAGIC;
723  csg->start = 4;
724  csg->end = 0;
725  csg->radius = 0.25*scale;
726  csg->center_is_left = 1;
727  csg->orientation = 0;
728 
729  BU_ALLOC(lsg, struct line_seg);
730  sketch_ip->curve.segment[1] = (void *)lsg;
731  lsg->magic = CURVE_LSEG_MAGIC;
732  lsg->start = 0;
733  lsg->end = 1;
734 
735  BU_ALLOC(lsg, struct line_seg);
736  sketch_ip->curve.segment[2] = (void *)lsg;
737  lsg->magic = CURVE_LSEG_MAGIC;
738  lsg->start = 1;
739  lsg->end = 2;
740 
741  BU_ALLOC(lsg, struct line_seg);
742  sketch_ip->curve.segment[3] = (void *)lsg;
743  lsg->magic = CURVE_LSEG_MAGIC;
744  lsg->start = 2;
745  lsg->end = 3;
746 
747  BU_ALLOC(lsg, struct line_seg);
748  sketch_ip->curve.segment[4] = (void *)lsg;
749  lsg->magic = CURVE_LSEG_MAGIC;
750  lsg->start = 3;
751  lsg->end = 4;
752 
753  BU_ALLOC(csg, struct carc_seg);
754  sketch_ip->curve.segment[5] = (void *)csg;
755  csg->magic = CURVE_CARC_MAGIC;
756  csg->start = 6;
757  csg->end = 5;
758  csg->radius = -1.0;
759  csg->center_is_left = 1;
760  csg->orientation = 0;
761 
762  } else {
763 
764  /* create an empty sketch */
765 
766  sketch_ip->vert_count = 0;
767  sketch_ip->verts = (point2d_t *)NULL;
768  sketch_ip->curve.count = 0;
769  sketch_ip->curve.reverse = (int *)NULL;
770  sketch_ip->curve.segment = (void **)NULL;
771  }
772  } else if (BU_STR_EQUAL(argv[bu_optind+1], "superell")) {
773 
774 
775  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
776  internal.idb_type = ID_SUPERELL;
777  internal.idb_meth = &OBJ[ID_SUPERELL];
778  BU_ALLOC(internal.idb_ptr, struct rt_superell_internal);
779  superell_ip = (struct rt_superell_internal *)internal.idb_ptr;
780  superell_ip->magic = RT_SUPERELL_INTERNAL_MAGIC;
781  VSET(superell_ip->v, origin[X], origin[Y], origin[Z]);
782  VSET(superell_ip->a, 0.5*scale, 0.0, 0.0); /* A */
783  VSET(superell_ip->b, 0.0, 0.25*scale, 0.0); /* B */
784  VSET(superell_ip->c, 0.0, 0.0, 0.125*scale); /* C */
785  superell_ip->n = 1.0;
786  superell_ip->e = 1.0;
787  fprintf(stdout, "superell being made with %f and %f\n", superell_ip->n, superell_ip->e);
788 
789  } else if (BU_STR_EQUAL(argv[bu_optind+1], "hf")) {
790  bu_vls_printf(gedp->ged_result_str, "make: the height field is deprecated and not supported by this command.\nUse the dsp primitive.\n");
791  return GED_ERROR;
792  } else if (BU_STR_EQUAL(argv[bu_optind+1], "pg") ||
793  BU_STR_EQUAL(argv[bu_optind+1], "poly")) {
794  bu_vls_printf(gedp->ged_result_str, "make: the polysolid is deprecated and not supported by this command.\nUse the bot primitive.");
795  return GED_ERROR;
796  } else if (BU_STR_EQUAL(argv[bu_optind+1], "cline") ||
797  BU_STR_EQUAL(argv[bu_optind+1], "dsp") ||
798  BU_STR_EQUAL(argv[bu_optind+1], "ebm") ||
799  BU_STR_EQUAL(argv[bu_optind+1], "nurb") ||
800  BU_STR_EQUAL(argv[bu_optind+1], "spline") ||
801  BU_STR_EQUAL(argv[bu_optind+1], "submodel") ||
802  BU_STR_EQUAL(argv[bu_optind+1], "vol")) {
803  bu_vls_printf(gedp->ged_result_str, "make: the %s primitive is not supported by this command", argv[bu_optind+1]);
804  return GED_ERROR;
805  } else if (BU_STR_EQUAL(argv[bu_optind+1], "metaball")) {
806  struct wdb_metaballpt *mbpt;
807  internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
808  internal.idb_type = ID_METABALL;
809  internal.idb_meth = &OBJ[ID_METABALL];
810  BU_ALLOC(internal.idb_ptr, struct rt_metaball_internal);
811  metaball_ip = (struct rt_metaball_internal *)internal.idb_ptr;
812  metaball_ip->magic = RT_METABALL_INTERNAL_MAGIC;
813  metaball_ip->threshold = 1.0;
814  metaball_ip->method = 1;
815  BU_LIST_INIT(&metaball_ip->metaball_ctrl_head);
816 
817  mbpt = (struct wdb_metaballpt *)malloc(sizeof(struct wdb_metaballpt));
818  mbpt->fldstr = 1.0;
819  mbpt->sweat = 1.0;
820  VSET(mbpt->coord, origin[X] - 1.0, origin[Y], origin[Z]);
821  BU_LIST_INSERT(&metaball_ip->metaball_ctrl_head, &mbpt->l);
822 
823  mbpt = (struct wdb_metaballpt *)malloc(sizeof(struct wdb_metaballpt));
824  mbpt->fldstr = 1.0;
825  mbpt->sweat = 1.0;
826  VSET(mbpt->coord, origin[X] + 1.0, origin[Y], origin[Z]);
827  BU_LIST_INSERT(&metaball_ip->metaball_ctrl_head, &mbpt->l);
828 
829  bu_log("metaball being made with %f threshold and two points using the %s rendering method\n",
830  metaball_ip->threshold, rt_metaball_lookup_type_name(metaball_ip->method));
831  } else {
832  bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
833  return GED_ERROR;
834  }
835 
836  /* no interrupts */
837  (void)signal(SIGINT, SIG_IGN);
838 
839  GED_DB_DIRADD(gedp, dp, argv[save_bu_optind], RT_DIR_PHONY_ADDR, 0, RT_DIR_SOLID, (void *)&internal.idb_type, GED_ERROR);
840  GED_DB_PUT_INTERNAL(gedp, dp, &internal, &rt_uniresource, GED_ERROR);
841 
842  return GED_OK;
843 }
844 
845 
846 /*
847  * Local Variables:
848  * tab-width: 8
849  * mode: C
850  * indent-tabs-mode: t
851  * c-file-style: "stroustrup"
852  * End:
853  * ex: shiftwidth=4 tabstop=8
854  */
const char * rt_metaball_lookup_type_name(const int id)
Definition: metaball.c:90
void usage(struct ged *gedp)
Definition: coil.c:315
#define GED_DB_DIRADD(_gedp, _dp, _name, _laddr, _len, _dirflags, _ptr, _flags)
Definition: ged.h:213
#define GED_OK
Definition: ged.h:55
#define RT_TGC_INTERNAL_MAGIC
Definition: magic.h:111
#define ID_ARS
ARS.
Definition: raytrace.h:463
void bu_log(const char *,...) _BU_ATTR_PRINTF12
Definition: log.c:176
#define BU_LIST_INSERT(old, new)
Definition: list.h:183
#define RT_BOT_INTERNAL_MAGIC
Definition: magic.h:85
#define ID_PIPE
Pipe (wire) solid.
Definition: raytrace.h:473
Definition: ged.h:338
#define ID_ARB8
Generalized ARB. V + 7 vectors.
Definition: raytrace.h:462
if lu s
Definition: nmg_mod.c:3860
#define ID_GRIP
Pseudo Solid Grip.
Definition: raytrace.h:480
#define VSET(a, b, c, d)
Definition: color.c:53
void bu_vls_trunc(struct bu_vls *vp, int len)
Definition: vls.c:198
#define ID_BOT
Bag o' triangles.
Definition: raytrace.h:488
#define GED_CHECK_ARGC_GT_0(_gedp, _argc, _flags)
Definition: ged.h:202
#define CURVE_CARC_MAGIC
Definition: magic.h:198
#define ID_PARTICLE
Particle system solid.
Definition: raytrace.h:474
struct rt_wdb * ged_wdbp
Definition: ged.h:340
char * bu_optarg
Definition: globals.c:91
Header file for the BRL-CAD common definitions.
int bu_optind
Definition: globals.c:89
int mk_hyp(struct rt_wdb *wdbp, const char *name, const point_t vert, const vect_t height_vector, const vect_t vectA, fastf_t magB, fastf_t base_neck_ratio)
Definition: wdb.c:284
#define ID_TOR
Toroid.
Definition: raytrace.h:459
int bu_getopt(int nargc, char *const nargv[], const char *ostr)
Definition: getopt.c:43
#define RT_EPA_INTERNAL_MAGIC
Definition: magic.h:92
#define GED_ERROR
Definition: ged.h:61
void * bu_malloc(size_t siz, const char *str)
Definition: malloc.c:314
#define GED_DB_PUT_INTERNAL(_gedp, _dp, _intern, _resource, _flags)
Definition: ged.h:243
#define ID_METABALL
Metaball.
Definition: raytrace.h:508
Definition: color.c:49
struct resource rt_uniresource
default. Defined in librt/globals.c
Definition: globals.c:41
#define GED_CHECK_DATABASE_OPEN(_gedp, _flags)
Definition: ged.h:114
#define ID_EHY
Elliptical Hyperboloid.
Definition: raytrace.h:478
int bu_optopt
Definition: globals.c:90
#define RT_ELL_INTERNAL_MAGIC
Definition: magic.h:91
#define BU_ALLOC(_ptr, _type)
Definition: malloc.h:223
void * bu_calloc(size_t nelem, size_t elsize, const char *str)
Definition: malloc.c:321
#define RT_EXTRUDE_INTERNAL_MAGIC
Definition: magic.h:94
#define RT_EHY_INTERNAL_MAGIC
Definition: magic.h:90
#define RT_DIR_SOLID
this name is a solid
Definition: raytrace.h:883
void nmg_vertex_g(register struct vertex *v, fastf_t x, fastf_t y, fastf_t z)
Definition: nmg_mk.c:1699
#define RT_TOR_INTERNAL_MAGIC
Definition: magic.h:112
#define RT_DB_INTERNAL_INIT(_p)
Definition: raytrace.h:199
#define LOOKUP_QUIET
Definition: raytrace.h:893
#define RT_GRIP_INTERNAL_MAGIC
Definition: magic.h:95
#define ID_NMG
n-Manifold Geometry solid
Definition: raytrace.h:469
#define V3ARGS(a)
Definition: color.c:56
#define RT_HALF_INTERNAL_MAGIC
Definition: magic.h:96
struct loopuse * nmg_ml(struct shell *s)
Definition: nmg_mk.c:927
#define RT_DIR_PHONY_ADDR
Special marker for d_addr field.
Definition: raytrace.h:879
Coord * point
Definition: chull3d.cpp:52
#define RT_RPC_INTERNAL_MAGIC
Definition: magic.h:107
#define GED_CHECK_EXISTS(_gedp, _name, _noisy, _flags)
Definition: ged.h:171
#define ID_HALF
Half-space.
Definition: raytrace.h:464
char * bu_vls_addr(const struct bu_vls *vp)
Definition: vls.c:111
struct bu_vls * ged_result_str
Definition: ged.h:357
struct edgeuse * nmg_meonvu(struct vertexuse *vu)
Definition: nmg_mk.c:800
struct nmgregion * nmg_mrsv(struct model *m)
Definition: nmg_mk.c:306
#define RT_ARBN_INTERNAL_MAGIC
Definition: magic.h:81
#define ID_RHC
Right Hyperbolic Cylinder.
Definition: raytrace.h:476
#define ID_ARBN
ARB with N faces.
Definition: raytrace.h:472
#define ID_EPA
Elliptical Paraboloid.
Definition: raytrace.h:477
#define BU_LIST_PUSH(hp, p)
Definition: list.h:246
struct model * nmg_mm(void)
Definition: nmg_mk.c:235
int ged_make(struct ged *gedp, int argc, const char *argv[])
Definition: make.c:41
#define BU_LIST_INIT(_hp)
Definition: list.h:148
#define RT_ETO_INTERNAL_MAGIC
Definition: magic.h:93
const struct rt_functab OBJ[]
Definition: table.c:159
#define WDB_PIPESEG_MAGIC
Definition: magic.h:214
#define ID_PNTS
Collection of Points.
Definition: raytrace.h:512
#define ID_SUPERELL
Superquadratic ellipsoid.
Definition: raytrace.h:507
void bu_vls_printf(struct bu_vls *vls, const char *fmt,...) _BU_ATTR_PRINTF23
Definition: vls.c:694
#define RT_SKETCH_INTERNAL_MAGIC
Definition: magic.h:108
#define GED_HELP
Definition: ged.h:62
Definition: color.c:51
#define idb_type
Definition: raytrace.h:198
#define ID_EXTRUDE
Solid of extrusion.
Definition: raytrace.h:485
int bu_str_true(const char *str)
Definition: booleanize.c:32
#define ID_RPC
Right Parabolic Cylinder.
Definition: raytrace.h:475
#define CURVE_LSEG_MAGIC
Definition: magic.h:199
Definition: bitv.h:105
int ged_make_name(struct ged *gedp, int argc, const char *argv[])
Definition: make_name.c:31
#define RT_PART_INTERNAL_MAGIC
Definition: magic.h:102
#define ID_TGC
Generalized Truncated General Cone.
Definition: raytrace.h:460
#define GED_CHECK_READ_ONLY(_gedp, _flags)
Definition: ged.h:181
#define ID_ETO
Elliptical Torus.
Definition: raytrace.h:479
double fastf_t
Definition: defines.h:300
#define RT_ARB_INTERNAL_MAGIC
Definition: magic.h:82
#define ID_ELL
Ellipsoid.
Definition: raytrace.h:461
#define ID_SKETCH
2D sketch
Definition: raytrace.h:484
#define RT_METABALL_INTERNAL_MAGIC
Definition: magic.h:100
#define RT_SUPERELL_INTERNAL_MAGIC
Definition: magic.h:110
#define RT_RHC_INTERNAL_MAGIC
Definition: magic.h:106
Definition: color.c:50
#define RT_ARS_INTERNAL_MAGIC
Definition: magic.h:83
#define BU_LIST_FIRST(structure, hp)
Definition: list.h:312
#define RT_PNTS_INTERNAL_MAGIC
Definition: magic.h:114
#define bu_strdup(s)
Definition: str.h:71
#define RT_PIPE_INTERNAL_MAGIC
Definition: magic.h:104
#define BU_STR_EQUAL(s1, s2)
Definition: str.h:126