|
| 1 | +/* T O R . C P P |
| 2 | + * BRL-CAD |
| 3 | + * |
| 4 | + * Copyright (c) 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 | +/** @file tor.cpp |
| 21 | + * |
| 22 | + * Test editing of TOR primitive parameters. |
| 23 | + */ |
| 24 | + |
| 25 | +#include "common.h" |
| 26 | + |
| 27 | +#include "vmath.h" |
| 28 | +#include "bu/app.h" |
| 29 | +#include "bu/avs.h" |
| 30 | +#include "bu/env.h" |
| 31 | +#include "bu/malloc.h" |
| 32 | +#include "bu/process.h" |
| 33 | +#include "bu/str.h" |
| 34 | +#include "raytrace.h" |
| 35 | + |
| 36 | +int |
| 37 | +main(int ac, char *av[]) |
| 38 | +{ |
| 39 | + const char *usage = "rt_edit_test_tor file.g testnum"; |
| 40 | + long test_num = 0; |
| 41 | + const char *objname = "tor.s" |
| 42 | + bu_setprogname(av[0]); |
| 43 | + ac--; av++; |
| 44 | + |
| 45 | + if (ac < 2) |
| 46 | + bu_exit(1, "%s", usage); |
| 47 | + |
| 48 | + struct db_i *dbip = db_open(argv[1], DB_OPEN_READWRITE); |
| 49 | + if (dbip == DBI_NULL) |
| 50 | + bu_exit(1, "ERROR: Unable to read from %s\n", argv[1]); |
| 51 | + |
| 52 | + if (db_dirbuild(dbip) < 0) |
| 53 | + bu_exit(1, "ERROR: Unable to read from %s\n", argv[1]); |
| 54 | + |
| 55 | + db_update_nref(dbip, &rt_uniresource); |
| 56 | + |
| 57 | + struct directory *dp = db_lookup(dbip, objname, LOOKUP_QUIET); |
| 58 | + if (dp == RT_DIR_NULL) |
| 59 | + bu_exit(1, "ERROR: Unable to look up object %s\n", objname); |
| 60 | + |
| 61 | + struct rt_db_internal intern; |
| 62 | + rt_db_get_internal(&intern, dp, dbip, NULL, &rt_uniresource); |
| 63 | + |
| 64 | + if (intern.idb_type != ID_TOR) |
| 65 | + bu_exit(1, "ERROR: %s - incorrect object type %d\n", objname, intern.idb_type); |
| 66 | + |
| 67 | + |
| 68 | + // Set up rt_solid_edit container |
| 69 | + |
| 70 | + |
| 71 | + // Get test number |
| 72 | + bu_sscanf(av[1], "%ld", &test_num); |
| 73 | + |
| 74 | + switch (test_num) { |
| 75 | + case 1: |
| 76 | + break; |
| 77 | + case 2: |
| 78 | + break; |
| 79 | + case 3: |
| 80 | + break; |
| 81 | + case 4: |
| 82 | + break; |
| 83 | + default: |
| 84 | + bu_exit(1, "ERROR: unknown test number %d\n", test_num); |
| 85 | + break; |
| 86 | + } |
| 87 | + |
| 88 | + return 0; |
| 89 | +} |
| 90 | + |
| 91 | +// Local Variables: |
| 92 | +// tab-width: 8 |
| 93 | +// mode: C++ |
| 94 | +// c-basic-offset: 4 |
| 95 | +// indent-tabs-mode: t |
| 96 | +// c-file-style: "stroustrup" |
| 97 | +// End: |
| 98 | +// ex: shiftwidth=4 tabstop=8 |
| 99 | + |
0 commit comments