BRL-CAD
edit_metaball.c
Go to the documentation of this file.
1 /* E D I T _ M E T A B A L L . 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/edit_metaball.c
21  *
22  * Functions -
23  *
24  *
25  */
26 
27 #include "common.h"
28 
29 #include <string.h>
30 
31 #include "bu/cmd.h"
32 #include "rtgeom.h"
33 #include "raytrace.h"
34 #include "wdb.h"
35 
36 #include "./ged_private.h"
37 
38 
39 #define GED_METABALL_SCALE(_d, _scale) \
40  if ((_scale) < 0.0) \
41  (_d) = -(_scale); \
42  else \
43  (_d) *= (_scale);
44 
45 
46 /*
47  * Returns the index for the metaball point matching mbpp.
48  */
49 int
50 _ged_get_metaball_i_pt(struct rt_metaball_internal *mbip, struct wdb_metaballpt *mbpp)
51 {
52  struct wdb_metaballpt *curr_mbpp;
53  int mbp_i = 0;
54 
55  for (BU_LIST_FOR(curr_mbpp, wdb_metaballpt, &mbip->metaball_ctrl_head)) {
56  if (curr_mbpp == mbpp)
57  return mbp_i;
58 
59  ++mbp_i;
60  }
61 
62  return -1;
63 }
64 
65 
66 /*
67  * Returns point mbp_i.
68  */
69 struct wdb_metaballpt *
70 _ged_get_metaball_pt_i(struct rt_metaball_internal *mbip, int mbp_i)
71 {
72  int i = 0;
73  struct wdb_metaballpt *curr_mbpp;
74 
75  for (BU_LIST_FOR(curr_mbpp, wdb_metaballpt, &mbip->metaball_ctrl_head)) {
76  if (i == mbp_i)
77  return curr_mbpp;
78 
79  ++i;
80  }
81 
82  return (struct wdb_metaballpt *)NULL;
83 }
84 
85 
86 int
87 _ged_set_metaball(struct ged *gedp, struct rt_metaball_internal *mbip, const char *attribute, fastf_t sf)
88 {
89  RT_METABALL_CK_MAGIC(mbip);
90 
91  switch (attribute[0]) {
92  case 'm':
93  case 'M':
94  if (sf <= METABALL_METABALL)
95  mbip->method = METABALL_METABALL;
96  else if (sf >= METABALL_BLOB)
97  mbip->method = METABALL_BLOB;
98  else
99  mbip->method = (int)sf;
100 
101  break;
102  case 't':
103  case 'T':
104  if (sf < 0)
105  mbip->threshold = -sf;
106  else
107  mbip->threshold = sf;
108 
109  break;
110  default:
111  bu_vls_printf(gedp->ged_result_str, "bad metaball attribute - %s", attribute);
112  return GED_ERROR;
113  }
114 
115  return GED_OK;
116 }
117 
118 
119 int
120 _ged_scale_metaball(struct ged *gedp, struct rt_metaball_internal *mbip, const char *attribute, fastf_t sf, int rflag)
121 {
122  int mbp_i;
123  struct wdb_metaballpt *mbpp;
124 
125  RT_METABALL_CK_MAGIC(mbip);
126 
127  if (!rflag && sf > 0)
128  sf = -sf;
129 
130  switch (attribute[0]) {
131  case 'f':
132  case 'F':
133  if (sscanf(attribute+1, "%d", &mbp_i) != 1)
134  mbp_i = 0;
135 
136  if ((mbpp = _ged_get_metaball_pt_i(mbip, mbp_i)) == (struct wdb_metaballpt *)NULL)
137  return GED_ERROR;
138 
139  BU_CKMAG(mbpp, WDB_METABALLPT_MAGIC, "wdb_metaballpt");
140  GED_METABALL_SCALE(mbpp->fldstr, sf);
141 
142  break;
143  case 's':
144  case 'S':
145  if (sscanf(attribute+1, "%d", &mbp_i) != 1)
146  mbp_i = 0;
147 
148  if ((mbpp = _ged_get_metaball_pt_i(mbip, mbp_i)) == (struct wdb_metaballpt *)NULL)
149  return GED_ERROR;
150 
151  BU_CKMAG(mbpp, WDB_METABALLPT_MAGIC, "wdb_metaballpt");
152  GED_METABALL_SCALE(mbpp->sweat, sf);
153 
154  break;
155  default:
156  bu_vls_printf(gedp->ged_result_str, "bad metaball attribute - %s", attribute);
157  return GED_ERROR;
158  }
159 
160  return GED_OK;
161 }
162 
163 
164 struct wdb_metaballpt *
165 find_metaballpt_nearest_pt(const struct bu_list *metaball_hd, const point_t model_pt, matp_t view2model)
166 {
167  struct wdb_metaballpt *mbpp;
168  struct wdb_metaballpt *nearest=(struct wdb_metaballpt *)NULL;
169  struct bn_tol tmp_tol;
170  fastf_t min_dist = MAX_FASTF;
171  vect_t dir, work;
172 
173  tmp_tol.magic = BN_TOL_MAGIC;
174  tmp_tol.dist = 0.0;
175  tmp_tol.dist_sq = tmp_tol.dist * tmp_tol.dist;
176  tmp_tol.perp = 0.0;
177  tmp_tol.para = 1.0 - tmp_tol.perp;
178 
179  /* get a direction vector in model space corresponding to z-direction in view */
180  VSET(work, 0.0, 0.0, 1.0);
181  MAT4X3VEC(dir, view2model, work);
182 
183  for (BU_LIST_FOR(mbpp, wdb_metaballpt, metaball_hd)) {
184  fastf_t dist;
185 
186  dist = bn_dist_line3_pt3(model_pt, dir, mbpp->coord);
187  if (dist < min_dist) {
188  min_dist = dist;
189  nearest = mbpp;
190  }
191  }
192 
193  return nearest;
194 }
195 
196 
197 int
198 ged_find_metaballpt_nearest_pt(struct ged *gedp, int argc, const char *argv[])
199 {
200  struct directory *dp;
201  static const char *usage = "metaball x y z";
202  struct rt_db_internal intern;
203  struct wdb_metaballpt *nearest;
204  point_t model_pt;
205  double scan[3];
206  mat_t mat;
207  int pt_i;
208  const char *last;
209 
211  GED_CHECK_VIEW(gedp, GED_ERROR);
212  GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
213 
214  /* initialize result */
215  bu_vls_trunc(gedp->ged_result_str, 0);
216 
217  /* must be wanting help */
218  if (argc == 1) {
219  bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
220  return GED_HELP;
221  }
222 
223  if (argc != 3 && argc != 5) {
224  bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
225  return GED_ERROR;
226  }
227 
228  if ((last = strrchr(argv[1], '/')) == NULL)
229  last = argv[1];
230  else
231  ++last;
232 
233  if (last[0] == '\0') {
234  bu_vls_printf(gedp->ged_result_str, "%s: illegal input - %s", argv[0], argv[1]);
235  return GED_ERROR;
236  }
237 
238  dp = db_lookup(gedp->ged_wdbp->dbip, last, LOOKUP_QUIET);
239  if (dp == RT_DIR_NULL) {
240  bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], argv[1]);
241  return GED_ERROR;
242  }
243 
244  if (argc == 3) {
245  if (sscanf(argv[2], "%lf %lf %lf", &scan[X], &scan[Y], &scan[Z]) != 3) {
246  bu_vls_printf(gedp->ged_result_str, "%s: bad point - %s", argv[0], argv[2]);
247  return GED_ERROR;
248  }
249  } else if (sscanf(argv[2], "%lf", &scan[X]) != 1 ||
250  sscanf(argv[3], "%lf", &scan[Y]) != 1 ||
251  sscanf(argv[4], "%lf", &scan[Z]) != 1) {
252  bu_vls_printf(gedp->ged_result_str, "%s: bad X, Y or Z", argv[0]);
253  return GED_ERROR;
254  }
255  /* convert from double to fastf_t */
256  VMOVE(model_pt, scan);
257 
258  if (wdb_import_from_path2(gedp->ged_result_str, &intern, argv[1], gedp->ged_wdbp, mat) == GED_ERROR)
259  return GED_ERROR;
260 
261  nearest = find_metaballpt_nearest_pt(&((struct rt_metaball_internal *)intern.idb_ptr)->metaball_ctrl_head,
262  model_pt, gedp->ged_gvp->gv_view2model);
263  pt_i = _ged_get_metaball_i_pt((struct rt_metaball_internal *)intern.idb_ptr, nearest);
264  rt_db_free_internal(&intern);
265 
266  if (pt_i < 0) {
267  bu_vls_printf(gedp->ged_result_str, "%s: failed to find point for %s", argv[0], argv[1]);
268  return GED_ERROR;
269  }
270 
271  bu_vls_printf(gedp->ged_result_str, "%d", pt_i);
272  return GED_OK;
273 }
274 
275 
276 struct wdb_metaballpt *
277 _ged_add_metaballpt(struct rt_metaball_internal *mbip, struct wdb_metaballpt *mbp, const point_t new_pt)
278 {
279  struct wdb_metaballpt *last;
280  struct wdb_metaballpt *newmbp;
281 
282  RT_METABALL_CK_MAGIC(mbip);
283 
284  if (mbp) {
285  BU_CKMAG(mbp, WDB_METABALLPT_MAGIC, "metaball point");
286  last = mbp;
287  } else {
288  /* add new point to end of metaball solid */
289  last = BU_LIST_LAST(wdb_metaballpt, &mbip->metaball_ctrl_head);
290 
291  if (last->l.magic == BU_LIST_HEAD_MAGIC) {
292  BU_GET(newmbp, struct wdb_metaballpt);
293  newmbp->l.magic = WDB_METABALLPT_MAGIC;
294  newmbp->fldstr = 1.0;
295  newmbp->sweat = 1.0;
296  VMOVE(newmbp->coord, new_pt);
297  BU_LIST_INSERT(&mbip->metaball_ctrl_head, &newmbp->l);
298  return newmbp;
299  }
300  }
301 
302  /* build new point */
303  BU_GET(newmbp, struct wdb_metaballpt);
304  newmbp->l.magic = WDB_METABALLPT_MAGIC;
305  newmbp->fldstr = 1.0;
306  newmbp->sweat = 1.0;
307  VMOVE(newmbp->coord, new_pt);
308 
309  if (mbp) {
310  /* append after current point */
311  BU_LIST_APPEND(&mbp->l, &newmbp->l);
312  } else {
313  /* add to end of metaball solid */
314  BU_LIST_INSERT(&mbip->metaball_ctrl_head, &newmbp->l);
315  }
316 
317  return newmbp;
318 }
319 
320 
321 int
322 ged_add_metaballpt(struct ged *gedp, int argc, const char *argv[])
323 {
324  struct directory *dp;
325  static const char *usage = "metaball pt";
326  struct rt_db_internal intern;
327  struct rt_metaball_internal *mbip;
328  mat_t mat;
329  point_t view_mb_pt;
330  point_t view_coord;
331  point_t mb_pt;
332  struct wdb_metaballpt *lastmbp;
333  double scan[3];
334  const char *last;
335 
337  GED_CHECK_VIEW(gedp, GED_ERROR);
338  GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
339 
340  /* initialize result */
341  bu_vls_trunc(gedp->ged_result_str, 0);
342 
343  /* must be wanting help */
344  if (argc == 1) {
345  bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
346  return GED_HELP;
347  }
348 
349  if (argc != 3) {
350  bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
351  return GED_ERROR;
352  }
353 
354  if ((last = strrchr(argv[1], '/')) == NULL)
355  last = argv[1];
356  else
357  ++last;
358 
359  if (last[0] == '\0') {
360  bu_vls_printf(gedp->ged_result_str, "%s: illegal input - %s", argv[0], argv[1]);
361  return GED_ERROR;
362  }
363 
364  dp = db_lookup(gedp->ged_wdbp->dbip, last, LOOKUP_QUIET);
365  if (dp == RT_DIR_NULL) {
366  bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], argv[1]);
367  return GED_ERROR;
368  }
369 
370  if (sscanf(argv[2], "%lf %lf %lf", &scan[X], &scan[Y], &scan[Z]) != 3) {
371  bu_vls_printf(gedp->ged_result_str, "%s: bad point - %s", argv[0], argv[2]);
372  return GED_ERROR;
373  }
374  /* convert from double to fastf_t */
375  VMOVE(view_mb_pt, scan);
376 
377  if (wdb_import_from_path2(gedp->ged_result_str, &intern, argv[1], gedp->ged_wdbp, mat) == GED_ERROR)
378  return GED_ERROR;
379 
380  if (intern.idb_major_type != DB5_MAJORTYPE_BRLCAD ||
381  intern.idb_minor_type != DB5_MINORTYPE_BRLCAD_METABALL) {
382  bu_vls_printf(gedp->ged_result_str, "Object not a METABALL");
383  rt_db_free_internal(&intern);
384 
385  return GED_ERROR;
386  }
387 
388  mbip = (struct rt_metaball_internal *)intern.idb_ptr;
389 
390  /* use the view z from the last metaball point */
391  lastmbp = BU_LIST_LAST(wdb_metaballpt, &mbip->metaball_ctrl_head);
392 
393  MAT4X3PNT(view_coord, gedp->ged_gvp->gv_model2view, lastmbp->coord);
394  view_mb_pt[Z] = view_coord[Z];
395  MAT4X3PNT(mb_pt, gedp->ged_gvp->gv_view2model, view_mb_pt);
396 
397  if (_ged_add_metaballpt(mbip, (struct wdb_metaballpt *)NULL, mb_pt) == (struct wdb_metaballpt *)NULL) {
398  rt_db_free_internal(&intern);
399  bu_vls_printf(gedp->ged_result_str, "%s: cannot move point there", argv[0]);
400  return GED_ERROR;
401  }
402 
403  {
404  mat_t invmat;
405  struct wdb_metaballpt *curr_mbp;
406  point_t curr_pt;
407 
408  bn_mat_inv(invmat, mat);
409  for (BU_LIST_FOR(curr_mbp, wdb_metaballpt, &mbip->metaball_ctrl_head)) {
410  MAT4X3PNT(curr_pt, invmat, curr_mbp->coord);
411  VMOVE(curr_mbp->coord, curr_pt);
412  }
413 
414  GED_DB_PUT_INTERNAL(gedp, dp, &intern, &rt_uniresource, GED_ERROR);
415  }
416 
417  rt_db_free_internal(&intern);
418  return GED_OK;
419 }
420 
421 
422 struct wdb_metaballpt *
423 _ged_delete_metaballpt(struct wdb_metaballpt *mbp)
424 {
425  struct wdb_metaballpt *next;
426  struct wdb_metaballpt *prev;
427  struct wdb_metaballpt *head;
428 
429  BU_CKMAG(mbp, WDB_METABALLPT_MAGIC, "metaball point");
430 
431  /* Find the head */
432  head = mbp;
433  while (head->l.magic != BU_LIST_HEAD_MAGIC)
434  head = BU_LIST_NEXT(wdb_metaballpt, &head->l);
435 
436  next = BU_LIST_NEXT(wdb_metaballpt, &mbp->l);
437  if (next->l.magic == BU_LIST_HEAD_MAGIC)
438  next = (struct wdb_metaballpt *)NULL;
439 
440  prev = BU_LIST_PREV(wdb_metaballpt, &mbp->l);
441  if (prev->l.magic == BU_LIST_HEAD_MAGIC)
442  prev = (struct wdb_metaballpt *)NULL;
443 
444  if (!prev && !next) {
445  return mbp;
446  }
447 
448  BU_LIST_DEQUEUE(&mbp->l);
449 
450  BU_PUT(mbp, struct wdb_metaballpt);
451 
452  if (prev)
453  return prev;
454  else
455  return next;
456 
457 }
458 
459 
460 int
461 ged_delete_metaballpt(struct ged *gedp, int argc, const char *argv[])
462 {
463  struct directory *dp;
464  static const char *usage = "metaball pt_i";
465  struct rt_db_internal intern;
466  struct wdb_metaballpt *mbp;
467  struct rt_metaball_internal *mbip;
468  int pt_i;
469  const char *last;
470 
472  GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
473 
474  /* initialize result */
475  bu_vls_trunc(gedp->ged_result_str, 0);
476 
477  /* must be wanting help */
478  if (argc == 1) {
479  bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
480  return GED_HELP;
481  }
482 
483  if (argc != 3) {
484  bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
485  return GED_ERROR;
486  }
487 
488  if ((last = strrchr(argv[1], '/')) == NULL)
489  last = argv[1];
490  else
491  ++last;
492 
493  if (last[0] == '\0') {
494  bu_vls_printf(gedp->ged_result_str, "%s: illegal input - %s", argv[0], argv[1]);
495  return GED_ERROR;
496  }
497 
498  dp = db_lookup(gedp->ged_wdbp->dbip, last, LOOKUP_QUIET);
499  if (dp == RT_DIR_NULL) {
500  bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], argv[1]);
501  return GED_ERROR;
502  }
503 
504  if (sscanf(argv[2], "%d", &pt_i) != 1) {
505  bu_vls_printf(gedp->ged_result_str, "%s: bad metaball point index - %s", argv[0], argv[3]);
506  return GED_ERROR;
507  }
508 
509  if (rt_db_get_internal(&intern, dp, gedp->ged_wdbp->dbip, (fastf_t *)NULL, &rt_uniresource) < 0) {
510  bu_vls_printf(gedp->ged_result_str, "%s: failed to get internal for %s", argv[0], argv[1]);
511  return GED_ERROR;
512  }
513 
514  if (intern.idb_major_type != DB5_MAJORTYPE_BRLCAD ||
515  intern.idb_minor_type != DB5_MINORTYPE_BRLCAD_METABALL) {
516  bu_vls_printf(gedp->ged_result_str, "%s is not a METABALL", argv[1]);
517  rt_db_free_internal(&intern);
518 
519  return GED_ERROR;
520  }
521 
522  mbip = (struct rt_metaball_internal *)intern.idb_ptr;
523  if ((mbp = _ged_get_metaball_pt_i(mbip, pt_i)) == (struct wdb_metaballpt *)NULL) {
524  rt_db_free_internal(&intern);
525  bu_vls_printf(gedp->ged_result_str, "%s: bad metaball point index - %s", argv[0], argv[2]);
526  return GED_ERROR;
527  }
528 
529  if (_ged_delete_metaballpt(mbp) == mbp) {
530  rt_db_free_internal(&intern);
531  bu_vls_printf(gedp->ged_result_str, "%s: cannot delete last metaball point %d", argv[0], pt_i);
532  return GED_ERROR;
533  }
534 
535  GED_DB_PUT_INTERNAL(gedp, dp, &intern, &rt_uniresource, GED_ERROR);
536 
537  rt_db_free_internal(&intern);
538  return GED_OK;
539 }
540 
541 
542 int
543 ged_move_metaballpt(struct ged *gedp, int argc, const char *argv[])
544 {
545  struct directory *dp;
546  static const char *usage = "[-r] metaball seg_i pt";
547  struct rt_db_internal intern;
548  struct wdb_metaballpt *mbp;
549  struct rt_metaball_internal *mbip;
550  mat_t mat;
551  point_t mb_pt;
552  double scan[3];
553  int seg_i;
554  int rflag = 0;
555  const char *last;
556 
558  GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
559 
560  /* initialize result */
561  bu_vls_trunc(gedp->ged_result_str, 0);
562 
563  /* must be wanting help */
564  if (argc == 1) {
565  bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
566  return GED_HELP;
567  }
568 
569  if (argc < 4 || 5 < argc) {
570  bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
571  return GED_ERROR;
572  }
573 
574  if (argc == 5) {
575  if (argv[1][0] != '-' || argv[1][1] != 'r' || argv[1][2] != '\0') {
576  bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
577  return GED_ERROR;
578  }
579 
580  rflag = 1;
581  --argc;
582  ++argv;
583  }
584 
585  if ((last = strrchr(argv[1], '/')) == NULL)
586  last = argv[1];
587  else
588  ++last;
589 
590  if (last[0] == '\0') {
591  bu_vls_printf(gedp->ged_result_str, "%s: illegal input - %s", argv[0], argv[1]);
592  return GED_ERROR;
593  }
594 
595  dp = db_lookup(gedp->ged_wdbp->dbip, last, LOOKUP_QUIET);
596  if (dp == RT_DIR_NULL) {
597  bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], argv[1]);
598  return GED_ERROR;
599  }
600 
601  if (sscanf(argv[2], "%d", &seg_i) != 1) {
602  bu_vls_printf(gedp->ged_result_str, "%s: bad metaball point index - %s", argv[0], argv[2]);
603  return GED_ERROR;
604  }
605 
606  if (sscanf(argv[3], "%lf %lf %lf", &scan[X], &scan[Y], &scan[Z]) != 3) {
607  bu_vls_printf(gedp->ged_result_str, "%s: bad point - %s", argv[0], argv[3]);
608  return GED_ERROR;
609  }
610  VSCALE(mb_pt, scan, gedp->ged_wdbp->dbip->dbi_local2base);
611 
612  if (wdb_import_from_path2(gedp->ged_result_str, &intern, argv[1], gedp->ged_wdbp, mat) == GED_ERROR)
613  return GED_ERROR;
614 
615  if (intern.idb_major_type != DB5_MAJORTYPE_BRLCAD ||
616  intern.idb_minor_type != DB5_MINORTYPE_BRLCAD_METABALL) {
617  bu_vls_printf(gedp->ged_result_str, "Object not a METABALL");
618  rt_db_free_internal(&intern);
619 
620  return GED_ERROR;
621  }
622 
623  mbip = (struct rt_metaball_internal *)intern.idb_ptr;
624  if ((mbp = _ged_get_metaball_pt_i(mbip, seg_i)) == (struct wdb_metaballpt *)NULL) {
625  rt_db_free_internal(&intern);
626  bu_vls_printf(gedp->ged_result_str, "%s: bad metaball point index - %s", argv[0], argv[2]);
627  return GED_ERROR;
628  }
629 
630  if (rflag) {
631  VADD2(mb_pt, mb_pt, mbp->coord);
632  }
633 
634  VMOVE(mbp->coord, mb_pt);
635 
636  {
637  mat_t invmat;
638  struct wdb_metaballpt *curr_mbp;
639  point_t curr_pt;
640 
641  bn_mat_inv(invmat, mat);
642  for (BU_LIST_FOR(curr_mbp, wdb_metaballpt, &mbip->metaball_ctrl_head)) {
643  MAT4X3PNT(curr_pt, invmat, curr_mbp->coord);
644  VMOVE(curr_mbp->coord, curr_pt);
645  }
646 
647  GED_DB_PUT_INTERNAL(gedp, dp, &intern, &rt_uniresource, GED_ERROR);
648  }
649 
650  rt_db_free_internal(&intern);
651  return GED_OK;
652 }
653 
654 
655 /*
656  * Local Variables:
657  * tab-width: 8
658  * mode: C
659  * indent-tabs-mode: t
660  * c-file-style: "stroustrup"
661  * End:
662  * ex: shiftwidth=4 tabstop=8
663  */
void usage(struct ged *gedp)
Definition: coil.c:315
#define GED_OK
Definition: ged.h:55
#define BU_LIST_FOR(p, structure, hp)
Definition: list.h:365
#define BU_LIST_INSERT(old, new)
Definition: list.h:183
int rt_db_get_internal(struct rt_db_internal *ip, const struct directory *dp, const struct db_i *dbip, const mat_t mat, struct resource *resp)
Definition: dir.c:76
Definition: list.h:118
#define BU_LIST_LAST(structure, hp)
Definition: list.h:306
#define BU_CKMAG(_ptr, _magic, _str)
Definition: magic.h:233
int ged_delete_metaballpt(struct ged *gedp, int argc, const char *argv[])
double dist
>= 0
Definition: tol.h:73
Definition: ged.h:338
struct db_i * dbip
Definition: raytrace.h:1266
#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 GED_CHECK_ARGC_GT_0(_gedp, _argc, _flags)
Definition: ged.h:202
double dist_sq
dist * dist
Definition: tol.h:74
struct directory * db_lookup(const struct db_i *, const char *name, int noisy)
Definition: db_lookup.c:153
int _ged_scale_metaball(struct ged *gedp, struct rt_metaball_internal *mbip, const char *attribute, fastf_t sf, int rflag)
#define BN_TOL_MAGIC
Definition: magic.h:74
struct rt_wdb * ged_wdbp
Definition: ged.h:340
Header file for the BRL-CAD common definitions.
struct wdb_metaballpt * _ged_delete_metaballpt(struct wdb_metaballpt *mbp)
int _ged_get_metaball_i_pt(struct rt_metaball_internal *mbip, struct wdb_metaballpt *mbpp)
Definition: edit_metaball.c:50
#define BU_LIST_APPEND(old, new)
Definition: list.h:197
#define WDB_METABALLPT_MAGIC
Definition: magic.h:213
#define MAX_FASTF
Definition: defines.h:340
#define GED_ERROR
Definition: ged.h:61
struct bview * ged_gvp
Definition: ged.h:361
struct wdb_metaballpt * _ged_get_metaball_pt_i(struct rt_metaball_internal *mbip, int mbp_i)
Definition: edit_metaball.c:70
#define GED_DB_PUT_INTERNAL(_gedp, _dp, _intern, _resource, _flags)
Definition: ged.h:243
if(share_geom)
Definition: nmg_mod.c:3829
mat_t gv_view2model
Definition: bview.h:224
int idb_major_type
Definition: raytrace.h:192
Definition: color.c:49
struct resource rt_uniresource
default. Defined in librt/globals.c
Definition: globals.c:41
#define GED_CHECK_VIEW(_gedp, _flags)
Definition: ged.h:140
#define GED_CHECK_DATABASE_OPEN(_gedp, _flags)
Definition: ged.h:114
#define LOOKUP_QUIET
Definition: raytrace.h:893
int ged_add_metaballpt(struct ged *gedp, int argc, const char *argv[])
double bn_dist_line3_pt3(const point_t pt, const vect_t dir, const point_t a)
void bn_mat_inv(mat_t output, const mat_t input)
#define GED_METABALL_SCALE(_d, _scale)
Definition: edit_metaball.c:39
#define BU_GET(_ptr, _type)
Definition: malloc.h:201
struct wdb_metaballpt * _ged_add_metaballpt(struct rt_metaball_internal *mbip, struct wdb_metaballpt *mbp, const point_t new_pt)
#define BU_PUT(_ptr, _type)
Definition: malloc.h:215
Support for uniform tolerances.
Definition: tol.h:71
struct bu_vls * ged_result_str
Definition: ged.h:357
double perp
nearly 0
Definition: tol.h:75
void * idb_ptr
Definition: raytrace.h:195
mat_t gv_model2view
Definition: bview.h:222
uint32_t magic
Definition: tol.h:72
void bu_vls_printf(struct bu_vls *vls, const char *fmt,...) _BU_ATTR_PRINTF23
Definition: vls.c:694
#define RT_DIR_NULL
Definition: raytrace.h:875
int ged_find_metaballpt_nearest_pt(struct ged *gedp, int argc, const char *argv[])
#define GED_HELP
Definition: ged.h:62
int idb_minor_type
ID_xxx.
Definition: raytrace.h:193
Definition: color.c:51
int ged_move_metaballpt(struct ged *gedp, int argc, const char *argv[])
int wdb_import_from_path2(struct bu_vls *logstr, struct rt_db_internal *ip, const char *path, struct rt_wdb *wdb, matp_t matp)
Definition: wdb.c:364
double dbi_local2base
local2mm
Definition: raytrace.h:807
int _ged_set_metaball(struct ged *gedp, struct rt_metaball_internal *mbip, const char *attribute, fastf_t sf)
Definition: edit_metaball.c:87
#define BU_LIST_DEQUEUE(cur)
Definition: list.h:209
#define BU_LIST_HEAD_MAGIC
Definition: magic.h:56
double fastf_t
Definition: defines.h:300
#define BU_LIST_NEXT(structure, hp)
Definition: list.h:316
double para
nearly 1
Definition: tol.h:76
#define BU_LIST_PREV(structure, hp)
Definition: list.h:310
void rt_db_free_internal(struct rt_db_internal *ip)
Definition: dir.c:216
Definition: color.c:50
struct wdb_metaballpt * find_metaballpt_nearest_pt(const struct bu_list *metaball_hd, const point_t model_pt, matp_t view2model)