Revision: 76117
http://sourceforge.net/p/brlcad/code/76117
Author: starseeker
Date: 2020-06-11 18:22:58 +0000 (Thu, 11 Jun 2020)
Log Message:
-----------
Run files through astyle, except for the bu_cmdtab
Modified Paths:
--------------
brlcad/branches/bioh/src/burst2/burst.cpp
brlcad/branches/bioh/src/burst2/burst.h
brlcad/branches/bioh/src/burst2/grid.cpp
brlcad/branches/bioh/src/burst2/paint.cpp
Modified: brlcad/branches/bioh/src/burst2/burst.cpp
===================================================================
--- brlcad/branches/bioh/src/burst2/burst.cpp 2020-06-11 18:15:48 UTC (rev
76116)
+++ brlcad/branches/bioh/src/burst2/burst.cpp 2020-06-11 18:22:58 UTC (rev
76117)
@@ -79,12 +79,12 @@
{
//struct burst_state *s = (struct burst_state *)bs;
if (argc == 2 && BU_STR_EQUAL(argv[1], HELPFLAG)) {
- printf("Usage: %s\n%s\n", us, ps);
- return 1;
+ printf("Usage: %s\n%s\n", us, ps);
+ return 1;
}
if (argc == 2 && BU_STR_EQUAL(argv[1], PURPOSEFLAG)) {
- printf("%s\n", ps);
- return 1;
+ printf("%s\n", ps);
+ return 1;
}
return 0;
}
@@ -210,7 +210,7 @@
const char *usage_string = "attack-direction azim_angle elev_angle";
const char *purpose_string = "specify azimuth and elevation of attack
relative to target";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
int ret = BRLCAD_OK;
@@ -245,7 +245,7 @@
const char *usage_string = "critical-comp-file file";
const char *purpose_string = "input critical component idents from file";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
int ret = BRLCAD_OK;
@@ -274,12 +274,12 @@
extern "C" int
-_burst_cmd_deflect_spall_cone (void *bs, int argc, const char **argv)
+_burst_cmd_deflect_spall_cone(void *bs, int argc, const char **argv)
{
const char *usage_string = "deflect-spall-cone flag";
const char *purpose_string = "deflect axis of spall cone half way towards
exit normal";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
struct burst_state *s = (struct burst_state *)bs;
@@ -295,7 +295,7 @@
int fval = bu_str_false(argv[1]);
if (!tval && !fval) {
- printf("Invalid boolean string: %s\n", argv[1]);
+ printf("Invalid boolean string: %s\n", argv[1]);
return BRLCAD_ERROR;
}
@@ -310,7 +310,7 @@
const char *usage_string = "dither-cells flag";
const char *purpose_string = "if yes, randomly offset shotline within grid
cell";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
struct burst_state *s = (struct burst_state *)bs;
@@ -326,7 +326,7 @@
int fval = bu_str_false(argv[1]);
if (!tval && !fval) {
- printf("Invalid boolean string: %s\n", argv[1]);
+ printf("Invalid boolean string: %s\n", argv[1]);
return BRLCAD_ERROR;
}
@@ -341,7 +341,7 @@
const char *usage_string = "enclose-target";
const char *purpose_string = "generate rectangular grid of shotlines for
full target envelope";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
struct burst_state *s = (struct burst_state *)bs;
@@ -355,7 +355,7 @@
const char *usage_string = "enclose-portion left right bottom top";
const char *purpose_string = "generate partial envelope by specifying grid
boundaries";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
int ret = BRLCAD_OK;
@@ -407,7 +407,7 @@
const char *usage_string = "error-file file";
const char *purpose_string = "divert all diagnostics to file";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
int ret = BRLCAD_OK;
@@ -435,7 +435,7 @@
* as they are generated. */
s->errfile = fopen(argv[1], "wb");
if (!s->errfile) {
- printf("failed to open error file: %s\n", argv[1]);
+ printf("failed to open error file: %s\n", argv[1]);
ret = BRLCAD_ERROR;
}
@@ -448,7 +448,7 @@
const char *usage_string = "execute";
const char *purpose_string = "initiate a run (no output produced without
this command)";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
struct burst_state *s = (struct burst_state *)bs;
@@ -456,7 +456,7 @@
if (!s) return BRLCAD_ERROR;
if (!bu_vls_strlen(&s->gedfile)) {
- printf("Execute failed: no target file has been specified\n");
+ printf("Execute failed: no target file has been specified\n");
return BRLCAD_ERROR;
}
@@ -472,7 +472,7 @@
const char *usage_string = "grid-file file";
const char *purpose_string = "save shotline locations (Y' Z') in file";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
int ret = BRLCAD_OK;
@@ -500,7 +500,7 @@
/* Try to open the file */
s->gridfp = fopen(argv[1], "wb");
if (!s->gridfp) {
- printf("failed to open grid file: %s\n", argv[1]);
+ printf("failed to open grid file: %s\n", argv[1]);
ret = BRLCAD_ERROR;
}
@@ -515,7 +515,7 @@
const char *usage_string = "ground-plane flag [Z +X -X +Y -Y]";
const char *purpose_string = "if yes, burst on ground";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
int ret = BRLCAD_OK;
@@ -533,7 +533,7 @@
int fval = bu_str_false(argv[1]);
if (!tval && !fval) {
- printf("Invalid boolean string: %s\n", argv[1]);
+ printf("Invalid boolean string: %s\n", argv[1]);
return BRLCAD_ERROR;
}
@@ -627,7 +627,7 @@
const char *usage_string = "burst-air-file file";
const char *purpose_string = "input burst air idents from file";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
int ret = BRLCAD_OK;
@@ -660,7 +660,7 @@
const char *usage_string = "histogram-file file";
const char *purpose_string = "write hit frequency histogram to file";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
int ret = BRLCAD_OK;
@@ -689,7 +689,7 @@
/* Try to open the file */
s->histfp = fopen(argv[1], "wb");
if (!s->histfp) {
- printf("failed to open histogram file: %s\n", argv[1]);
+ printf("failed to open histogram file: %s\n", argv[1]);
ret = BRLCAD_ERROR;
}
@@ -704,7 +704,7 @@
const char *usage_string = "image-file file";
const char *purpose_string = "generate frame buffer image on a specified
file or device";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
struct burst_state *s = (struct burst_state *)bs;
@@ -726,7 +726,7 @@
const char *usage_string = "input-2d-shot Y' Z'";
const char *purpose_string = "input single shotline location as grid
offsets";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
int ret = BRLCAD_OK;
@@ -765,7 +765,7 @@
const char *usage_string = "input-3d-shot X Y Z";
const char *purpose_string = "input single shotline location in target
coordinates";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
int ret = BRLCAD_OK;
@@ -811,7 +811,7 @@
const char *usage_string = "max-barriers count";
const char *purpose_string = "specify the maximum number of components to
report along spall ray";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
int ret = BRLCAD_OK;
@@ -839,7 +839,7 @@
const char *usage_string = "max-spall-rays count";
const char *purpose_string = "specify the desired number of spall rays
generated per burst point";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
int ret = BRLCAD_OK;
@@ -867,7 +867,7 @@
const char *usage_string = "plot-file file";
const char *purpose_string = "generate plot data in file";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
struct burst_state *s = (struct burst_state *)bs;
@@ -890,7 +890,7 @@
const char *usage_string = "quit";
const char *purpose_string = "quit the appliation";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
struct burst_state *s = (struct burst_state *)bs;
@@ -908,7 +908,7 @@
const char *usage_string = "read-2d-shot-file file";
const char *purpose_string = "read shot locations from file as grid
offsets (see input-2d-shot)";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
int ret = BRLCAD_OK;
@@ -936,7 +936,7 @@
s->shotfp = fopen(argv[1], "rb");
if (!s->shotfp) {
- printf("failed to open critical component file: %s\n", argv[1]);
+ printf("failed to open critical component file: %s\n", argv[1]);
ret = BRLCAD_ERROR;
}
@@ -953,7 +953,7 @@
const char *usage_string = "read-3d-shot-file file";
const char *purpose_string = "read shot locations from file in target
coordinates (see input-3d-shot)";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
int ret = BRLCAD_OK;
@@ -981,7 +981,7 @@
s->shotfp = fopen(argv[1], "rb");
if (!s->shotfp) {
- printf("failed to open critical component file: %s\n", argv[1]);
+ printf("failed to open critical component file: %s\n", argv[1]);
ret = BRLCAD_ERROR;
}
bu_vls_sprintf(&s->shotfile, "%s", argv[1]);
@@ -997,7 +997,7 @@
const char *usage_string = "burst-armor-file file";
const char *purpose_string = "input burst armor idents from file";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
int ret = BRLCAD_OK;
@@ -1020,7 +1020,7 @@
printf("Reading burst armor idents... done.\n");
bu_vls_sprintf(&s->armorfile, "%s", argv[1]);
-
+
return ret;
}
@@ -1030,7 +1030,7 @@
const char *usage_string = "read-burst-file file";
const char *purpose_string = "read burst point locations from file (see
burst-coordinates)";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
int ret = BRLCAD_OK;
@@ -1058,7 +1058,7 @@
s->burstfp = fopen(argv[1], "rb");
if (!s->burstfp) {
- printf("failed to open 3-D burst input file: %s\n", argv[1]);
+ printf("failed to open 3-D burst input file: %s\n", argv[1]);
ret = BRLCAD_ERROR;
}
@@ -1074,7 +1074,7 @@
const char *usage_string = "read-input-file file";
const char *purpose_string = "read key word commands from file";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
int ret = BRLCAD_OK;
@@ -1109,7 +1109,7 @@
const char *usage_string = "report-overlaps file";
const char *purpose_string = "if yes, log overlap diagnostics";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
struct burst_state *s = (struct burst_state *)bs;
@@ -1125,7 +1125,7 @@
int fval = bu_str_false(argv[1]);
if (!tval && !fval) {
- printf("Invalid boolean string: %s\n", argv[1]);
+ printf("Invalid boolean string: %s\n", argv[1]);
return BRLCAD_ERROR;
}
@@ -1140,7 +1140,7 @@
const char *usage_string = "shotline-burst flag";
const char *purpose_string = "if yes, generate burst points along
shotlines";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
struct burst_state *s = (struct burst_state *)bs;
@@ -1156,7 +1156,7 @@
int fval = bu_str_false(argv[1]);
if (!tval && !fval) {
- printf("Invalid boolean string: %s\n", argv[1]);
+ printf("Invalid boolean string: %s\n", argv[1]);
return BRLCAD_ERROR;
}
@@ -1176,7 +1176,7 @@
const char *usage_string = "shotline-file file";
const char *purpose_string = "output shot line data to file";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
int ret = BRLCAD_OK;
@@ -1205,7 +1205,7 @@
* as they are generated. */
s->shotlnfp = fopen(argv[1], "wb");
if (!s->shotlnfp) {
- printf("failed to open error file: %s\n", argv[1]);
+ printf("failed to open error file: %s\n", argv[1]);
ret = BRLCAD_ERROR;
}
@@ -1220,7 +1220,7 @@
const char *usage_string = "target-file file";
const char *purpose_string = "read BRL-CAD database from file";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
struct burst_state *s = (struct burst_state *)bs;
@@ -1242,7 +1242,7 @@
const char *usage_string = "target-objects object0 [object1 object2 ...]";
const char *purpose_string = "list objects from BRL-CAD database to
interrogate";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
struct burst_state *s = (struct burst_state *)bs;
@@ -1264,7 +1264,7 @@
const char *usage_string = "units name";
const char *purpose_string = "linear units (inches, feet, millimeters,
centimeters,meters)";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
struct burst_state *s = (struct burst_state *)bs;
@@ -1292,7 +1292,7 @@
const char *usage_string = "write-input-file file";
const char *purpose_string = "save script of commands in file";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
int ret = BRLCAD_OK;
@@ -1304,7 +1304,7 @@
* as they are generated. */
FILE *cmdfp = fopen(argv[1], "wb");
if (!cmdfp) {
- printf("failed to open cmd file for writing: %s\n", argv[1]);
+ printf("failed to open cmd file for writing: %s\n", argv[1]);
return BRLCAD_ERROR;
}
@@ -1321,7 +1321,7 @@
const char *usage_string = "burst-coordinates X Y Z";
const char *purpose_string = "input single burst point location in target
coordinates";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
int ret = BRLCAD_OK;
@@ -1366,7 +1366,7 @@
const char *usage_string = "burst-distance distance";
const char *purpose_string = "offset burst point along shotline";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
int ret = BRLCAD_OK;
@@ -1396,7 +1396,7 @@
const char *usage_string = "burst-file file";
const char *purpose_string = "output burst point library to file";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
int ret = BRLCAD_OK;
@@ -1425,7 +1425,7 @@
* as it is generated. */
s->outfp = fopen(argv[1], "wb");
if (!s->outfp) {
- printf("failed to open burst file: %s\n", argv[1]);
+ printf("failed to open burst file: %s\n", argv[1]);
ret = BRLCAD_ERROR;
}
bu_vls_sprintf(&s->outfile, "%s", argv[1]);
@@ -1439,7 +1439,7 @@
const char *usage_string = "cell-size distance";
const char *purpose_string = "specify shotline separation (equidistant
horizontal and vertical)";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
int ret = BRLCAD_OK;
@@ -1469,10 +1469,10 @@
const char *usage_string = "color-file file";
const char *purpose_string = "input ident to color mapping from file (for
graphics)";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
- int ret = BRLCAD_OK;
+ int ret = BRLCAD_OK;
struct burst_state *s = (struct burst_state *)bs;
if (!s || !argc || !argv) return BRLCAD_ERROR;
@@ -1485,7 +1485,7 @@
}
printf("Reading ident-to-color mappings... done.\n");
-
+
bu_vls_sprintf(&s->colorfile, "%s", argv[1]);
return ret;
@@ -1497,7 +1497,7 @@
const char *usage_string = "cone-half-angle angle";
const char *purpose_string = "specify limiting angle for spall ray
generation";
if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
- return BRLCAD_OK;
+ return BRLCAD_OK;
}
int ret = BRLCAD_OK;
@@ -1620,7 +1620,8 @@
burst_state_init(&s);
/* Done with program name */
- argv++; argc--;
+ argv++;
+ argc--;
/* Parse options, fail if anything goes wrong */
if ((argc = bu_opt_parse(&msg, argc, argv, d)) == -1) {
@@ -1643,7 +1644,7 @@
s.cmds = _burst_cmds;
/* If we have a batch file, process it. */
- if (argc ) {
+ if (argc) {
std::ifstream fs;
fs.open(argv[0]);
if (!fs.is_open()) {
Modified: brlcad/branches/bioh/src/burst2/burst.h
===================================================================
--- brlcad/branches/bioh/src/burst2/burst.h 2020-06-11 18:15:48 UTC (rev
76116)
+++ brlcad/branches/bioh/src/burst2/burst.h 2020-06-11 18:22:58 UTC (rev
76117)
@@ -60,14 +60,12 @@
#define FM_3DIM (1<<3) /* bit 3: ON = 3-D coords., OFF = 2-D coords */
#define FM_BURST (1<<4) /* bit 4: ON = discrete burst points, OFF = shots */
-struct ids
-{
+struct ids {
short i_lower;
short i_upper;
};
-struct colors
-{
+struct colors {
short c_lower;
short c_upper;
unsigned char c_rgb[3];
Modified: brlcad/branches/bioh/src/burst2/grid.cpp
===================================================================
--- brlcad/branches/bioh/src/burst2/grid.cpp 2020-06-11 18:15:48 UTC (rev
76116)
+++ brlcad/branches/bioh/src/burst2/grid.cpp 2020-06-11 18:22:58 UTC (rev
76117)
@@ -109,8 +109,7 @@
#define DEBUG_SHOT 1
typedef struct pt_queue Pt_Queue;
-struct pt_queue
-{
+struct pt_queue {
struct partition *q_part;
Pt_Queue *q_next;
};
@@ -122,8 +121,8 @@
Pt_Queue *newq;
bu_semaphore_acquire(BU_SEM_SYSCALL);
if ((newq = (Pt_Queue *) malloc(sizeof(Pt_Queue))) == PT_Q_NULL) {
- bu_semaphore_release(BU_SEM_SYSCALL);
- return 0;
+ bu_semaphore_release(BU_SEM_SYSCALL);
+ return 0;
}
bu_semaphore_release(BU_SEM_SYSCALL);
newq->q_next = *qpp;
@@ -137,7 +136,7 @@
qFree(Pt_Queue *qp)
{
if (qp == PT_Q_NULL)
- return;
+ return;
qFree(qp->q_next);
bu_semaphore_acquire(BU_SEM_SYSCALL);
free((char *) qp);
@@ -182,7 +181,7 @@
(int) colorp->c_rgb[0],
(int) colorp->c_rgb[1],
(int) colorp->c_rgb[2]
- );
+ );
}
break;
case C_MAIN :
@@ -198,9 +197,9 @@
}
} else {
pl_color(s->plotfp,
- (int) colorp->c_rgb[0],
- (int) colorp->c_rgb[1],
- (int) colorp->c_rgb[2]
+ (int) colorp->c_rgb[0],
+ (int) colorp->c_rgb[1],
+ (int) colorp->c_rgb[2]
);
}
break;
@@ -247,9 +246,9 @@
*/
void
prntRayHeader(struct burst_state *s,
- fastf_t *raydir /* burst ray direction vector */,
- fastf_t *shotdir /* shotline direction vector */,
- unsigned rayno /* ray number for this burst point */)
+ fastf_t *raydir /* burst ray direction vector */,
+ fastf_t *shotdir /* shotline direction vector */,
+ unsigned rayno /* ray number for this burst point */)
{
double cosxr; /* cosine of angle between X' and raydir */
double cosyr; /* cosine of angle between Y' and raydir */
@@ -256,23 +255,23 @@
fastf_t azim; /* ray azim in radians */
fastf_t sinelev; /* sine of ray elevation */
if (!bu_vls_strlen(&s->outfile))
- return;
+ return;
cosxr = -VDOT(shotdir, raydir); /* shotdir is reverse of X' */
cosyr = VDOT(s->gridhor, raydir);
if (NEAR_ZERO(cosyr, VDIVIDE_TOL) && NEAR_ZERO(cosxr, VDIVIDE_TOL))
- azim = 0.0;
+ azim = 0.0;
else
- azim = atan2(cosyr, cosxr);
+ azim = atan2(cosyr, cosxr);
sinelev = VDOT(s->gridver, raydir);
if (fprintf(s->outfp,
- "%c %8.3f %8.3f %6u\n",
- PB_RAY_HEADER,
- azim, /* ray azimuth angle WRT shotline (radians). */
- sinelev, /* sine of ray elevation angle WRT shotline. */
- rayno
- ) < 0
- ) {
- bu_exit(EXIT_FAILURE, "Write failed to file (%s)!\n",
bu_vls_cstr(&s->outfile));
+ "%c %8.3f %8.3f %6u\n",
+ PB_RAY_HEADER,
+ azim, /* ray azimuth angle WRT shotline (radians). */
+ sinelev, /* sine of ray elevation angle WRT shotline. */
+ rayno
+ ) < 0
+ ) {
+ bu_exit(EXIT_FAILURE, "Write failed to file (%s)!\n",
bu_vls_cstr(&s->outfile));
}
}
@@ -369,10 +368,10 @@
struct hit *ohitp;
for (cp = pp->pt_forw;
- cp != pt_headp && SameCmp(pp->pt_regionp, cp->pt_regionp);
- cp = cp->pt_forw
- )
- ;
+ cp != pt_headp && SameCmp(pp->pt_regionp, cp->pt_regionp);
+ cp = cp->pt_forw
+ )
+ ;
ohitp = cp->pt_back->pt_outhit;
ap->a_rbeam = ohitp->hit_dist - pp->pt_inhit->hit_dist;
return 1;
@@ -390,30 +389,30 @@
{
struct burst_state *s = (struct burst_state *)ap->a_uptr;
if (NEAR_EQUAL(cosobliquity, 1.0, COS_TOL)) {
- /* Trajectory was normal to surface, so no need
- to shoot another ray. */
- fastf_t thickness = pp->pt_outhit->hit_dist -
- pp->pt_inhit->hit_dist;
- return thickness;
+ /* Trajectory was normal to surface, so no need
+ to shoot another ray. */
+ fastf_t thickness = pp->pt_outhit->hit_dist -
+ pp->pt_inhit->hit_dist;
+ return thickness;
} else {
- /* need to shoot ray */
- struct application a_thick;
- struct hit *ihitp = pp->pt_inhit;
- struct region *regp = pp->pt_regionp;
- a_thick = *ap;
- a_thick.a_hit = f_Normal;
- a_thick.a_miss = f_Nerror;
- a_thick.a_level++;
- a_thick.a_user = regp->reg_regionid;
- a_thick.a_purpose = "normal thickness";
- VMOVE(a_thick.a_ray.r_pt, ihitp->hit_point);
- VSCALE(a_thick.a_ray.r_dir, normvec, -1.0);
- if (rt_shootray(&a_thick) == -1 && s->fatalerror) {
- /* Fatal error in application routine. */
- brst_log(s, "Fatal error: raytracing aborted.\n");
- return 0.0;
- }
- return a_thick.a_rbeam;
+ /* need to shoot ray */
+ struct application a_thick;
+ struct hit *ihitp = pp->pt_inhit;
+ struct region *regp = pp->pt_regionp;
+ a_thick = *ap;
+ a_thick.a_hit = f_Normal;
+ a_thick.a_miss = f_Nerror;
+ a_thick.a_level++;
+ a_thick.a_user = regp->reg_regionid;
+ a_thick.a_purpose = "normal thickness";
+ VMOVE(a_thick.a_ray.r_pt, ihitp->hit_point);
+ VSCALE(a_thick.a_ray.r_dir, normvec, -1.0);
+ if (rt_shootray(&a_thick) == -1 && s->fatalerror) {
+ /* Fatal error in application routine. */
+ brst_log(s, "Fatal error: raytracing aborted.\n");
+ return 0.0;
+ }
+ return a_thick.a_rbeam;
}
/*NOTREACHED*/
}
@@ -434,14 +433,14 @@
struct xray *rayp = &ap->a_ray;
/* Get entry/exit normals and fill in hit points */
getRtHitNorm(ihitp, pp->pt_inseg->seg_stp, rayp,
- (int) pp->pt_inflip, entrynorm);
+ (int) pp->pt_inflip, entrynorm);
if (! chkEntryNorm(s, pp, rayp, entrynorm,
- "spall ray component entry normal")) {
+ "spall ray component entry normal")) {
}
getRtHitNorm(ohitp, pp->pt_outseg->seg_stp, rayp,
- (int) pp->pt_outflip, exitnorm);
+ (int) pp->pt_outflip, exitnorm);
if (! chkExitNorm(s, pp, rayp, exitnorm,
- "spall ray component exit normal")) {
+ "spall ray component exit normal")) {
}
@@ -450,7 +449,7 @@
cosobliquity = -cosobliquity;
if (!bu_vls_strlen(&s->outfile))
- return;
+ return;
/* Now we must find normal thickness through component. */
@@ -457,19 +456,19 @@
normthickness = getNormThickness(ap, pp, cosobliquity, entrynorm);
bu_semaphore_acquire(BU_SEM_SYSCALL); /* lock */
if (fprintf(s->outfp,
- "%c % 10.3f % 9.3f % 9.3f %4d %5d % 6.3f\n",
- PB_REGION_HEADER,
- ihitp->hit_dist*s->unitconv, /* distance from burst pt. */
- (ohitp->hit_dist - ihitp->hit_dist)*s->unitconv, /* LOS */
- normthickness*s->unitconv, /* normal thickness */
- pp->pt_forw == pt_headp ?
- EXIT_AIR : pp->pt_forw->pt_regionp->reg_aircode,
- regp->reg_regionid,
- cosobliquity
- ) < 0
- ) {
- bu_semaphore_release(BU_SEM_SYSCALL); /* unlock */
- bu_exit(EXIT_FAILURE, "Write failed to file (%s)!\n",
bu_vls_cstr(&s->outfile));
+ "%c % 10.3f % 9.3f % 9.3f %4d %5d % 6.3f\n",
+ PB_REGION_HEADER,
+ ihitp->hit_dist*s->unitconv, /* distance from burst pt. */
+ (ohitp->hit_dist - ihitp->hit_dist)*s->unitconv, /* LOS */
+ normthickness*s->unitconv, /* normal thickness */
+ pp->pt_forw == pt_headp ?
+ EXIT_AIR : pp->pt_forw->pt_regionp->reg_aircode,
+ regp->reg_regionid,
+ cosobliquity
+ ) < 0
+ ) {
+ bu_semaphore_release(BU_SEM_SYSCALL); /* unlock */
+ bu_exit(EXIT_FAILURE, "Write failed to file (%s)!\n",
bu_vls_cstr(&s->outfile));
}
bu_semaphore_release(BU_SEM_SYSCALL); /* unlock */
}
@@ -481,9 +480,9 @@
fastf_t entrynorm[3], exitnorm[3];
struct burst_state *s = (struct burst_state *)ap->a_uptr;
if (!bu_vls_strlen(&s->outfile))
- return;
+ return;
if (qp == PT_Q_NULL)
- return;
+ return;
prntShieldComp(ap, pt_headp, qp->q_next);
prntRegionHdr(ap, pt_headp, qp->q_part, entrynorm, exitnorm);
}
@@ -492,16 +491,16 @@
plotPartition(struct burst_state *s, struct hit *ihitp, struct hit *ohitp)
{
if (s->plotfp == NULL)
- return;
+ return;
bu_semaphore_acquire(BU_SEM_SYSCALL);
pl_3line(s->plotfp,
- (int) ihitp->hit_point[X],
- (int) ihitp->hit_point[Y],
- (int) ihitp->hit_point[Z],
- (int) ohitp->hit_point[X],
- (int) ohitp->hit_point[Y],
- (int) ohitp->hit_point[Z]
- );
+ (int) ihitp->hit_point[X],
+ (int) ihitp->hit_point[Y],
+ (int) ihitp->hit_point[Z],
+ (int) ohitp->hit_point[X],
+ (int) ohitp->hit_point[Y],
+ (int) ohitp->hit_point[Z]
+ );
bu_semaphore_release(BU_SEM_SYSCALL);
return;
}
@@ -563,7 +562,7 @@
/* Find first barrier in front of the burst point. */
for (spp = pt_headp->pt_forw;
spp != pt_headp
- && spp->pt_outhit->hit_dist < 0.1;
+ && spp->pt_outhit->hit_dist < 0.1;
spp = spp->pt_forw
)
;
@@ -668,15 +667,15 @@
brst_log(s, "OVERLAP:\n");
brst_log(s, "reg=%s isol=%s, \n",
reg1->reg_name, pp->pt_inseg->seg_stp->st_name
- );
+ );
brst_log(s, "reg=%s osol=%s, \n",
reg2->reg_name, pp->pt_outseg->seg_stp->st_name
- );
+ );
brst_log(s, "depth %.2fmm at (%g, %g, %g) x%d y%d lvl%d purpose=%s\n",
depth,
pt[X], pt[Y], pt[Z],
ap->a_x, ap->a_y, ap->a_level, ap->a_purpose
- );
+ );
}
return rt_defoverlap(ap, pp, reg1, reg2, pheadp);
@@ -695,13 +694,13 @@
struct burst_state *s = (struct burst_state *)ap->a_uptr;
if (bu_vls_strlen(&s->outfile)) {
int ret = fprintf(s->outfp,
- "%c % 8.3f % 8.3f\n",
- PB_CELL_IDENT,
- ap->a_uvec[X]*s->unitconv,
- /* horizontal coordinate of shotline (Y') */
- ap->a_uvec[Y]*s->unitconv
- /* vertical coordinate of shotline (Z') */
- );
+ "%c % 8.3f % 8.3f\n",
+ PB_CELL_IDENT,
+ ap->a_uvec[X]*s->unitconv,
+ /* horizontal coordinate of shotline (Y') */
+ ap->a_uvec[Y]*s->unitconv
+ /* vertical coordinate of shotline (Z') */
+ );
if (ret < 0) {
bu_exit(EXIT_FAILURE, "Write failed to file (%s)!\n",
bu_vls_cstr(&s->outfile));
@@ -709,13 +708,13 @@
}
if (bu_vls_strlen(&s->shotlnfile)) {
int ret = fprintf(s->shotlnfp,
- "%c % 8.3f % 8.3f\n",
- PS_CELL_IDENT,
- ap->a_uvec[X]*s->unitconv,
- /* horizontal coordinate of shotline (Y') */
- ap->a_uvec[Y]*s->unitconv
- /* vertical coordinate of shotline (Z') */
- );
+ "%c % 8.3f % 8.3f\n",
+ PS_CELL_IDENT,
+ ap->a_uvec[X]*s->unitconv,
+ /* horizontal coordinate of shotline (Y') */
+ ap->a_uvec[Y]*s->unitconv
+ /* vertical coordinate of shotline (Z') */
+ );
if (ret < 0) {
bu_exit(EXIT_FAILURE, "Write failed to file (%s)!\n",
bu_vls_cstr(&s->shotlnfile));
}
@@ -731,43 +730,43 @@
*/
void
prntPhantom(
- struct burst_state *s,
- struct hit *hitp /* ptr. to phantom's intersection information */,
- int space /* space code behind phantom */)
+ struct burst_state *s,
+ struct hit *hitp /* ptr. to phantom's intersection information */,
+ int space /* space code behind phantom */)
{
if (bu_vls_strlen(&s->outfile)) {
int ret = fprintf(s->outfp,
- "%c % 8.2f % 8.2f %5d %2d % 7.3f % 7.3f % 7.3f %c\n",
- PB_RAY_INTERSECT,
- (s->standoff - hitp->hit_dist)*s->unitconv,
- /* X'-coordinate of intersection */
- 0.0, /* LOS thickness of component */
- PHANTOM_ARMOR, /* component code number */
- space, /* space code */
- 0.0, /* sine of fallback angle */
- 0.0, /* rotation angle (degrees) */
- 0.0, /* cosine of obliquity angle at entry */
- '0' /* no burst from phantom armor */
- );
- if (ret < 0) {
+ "%c % 8.2f % 8.2f %5d %2d % 7.3f % 7.3f % 7.3f %c\n",
+ PB_RAY_INTERSECT,
+ (s->standoff - hitp->hit_dist)*s->unitconv,
+ /* X'-coordinate of intersection */
+ 0.0, /* LOS thickness of component */
+ PHANTOM_ARMOR, /* component code number */
+ space, /* space code */
+ 0.0, /* sine of fallback angle */
+ 0.0, /* rotation angle (degrees) */
+ 0.0, /* cosine of obliquity angle at entry */
+ '0' /* no burst from phantom armor */
+ );
+ if (ret < 0) {
bu_exit(EXIT_FAILURE, "Write failed to file (%s)!\n",
bu_vls_cstr(&s->outfile));
}
}
if (bu_vls_strlen(&s->shotlnfile)) {
int ret = fprintf(s->shotlnfp,
- "%c % 8.2f % 7.3f % 7.3f %5d % 8.2f % 8.2f %2d % 7.2f
% 7.2f\n",
- PS_SHOT_INTERSECT,
- (s->standoff - hitp->hit_dist)*s->unitconv,
- /* X'-coordinate of intersection */
- 0.0, /* sine of fallback angle */
- 0.0, /* rotation angle in degrees */
- PHANTOM_ARMOR, /* component code number */
- 0.0, /* normal thickness of component */
- 0.0, /* LOS thickness of component */
- space, /* space code */
- 0.0, /* entry obliquity angle in degrees */
- 0.0 /* exit obliquity angle in degrees */
- );
+ "%c % 8.2f % 7.3f % 7.3f %5d % 8.2f % 8.2f %2d % 7.2f
% 7.2f\n",
+ PS_SHOT_INTERSECT,
+ (s->standoff - hitp->hit_dist)*s->unitconv,
+ /* X'-coordinate of intersection */
+ 0.0, /* sine of fallback angle */
+ 0.0, /* rotation angle in degrees */
+ PHANTOM_ARMOR, /* component code number */
+ 0.0, /* normal thickness of component */
+ 0.0, /* LOS thickness of component */
+ space, /* space code */
+ 0.0, /* entry obliquity angle in degrees */
+ 0.0 /* exit obliquity angle in degrees */
+ );
if (ret < 0) {
bu_exit(EXIT_FAILURE, "Write failed to file (%s)!\n",
bu_vls_cstr(&s->shotlnfile));
}
@@ -782,10 +781,10 @@
*/
void
prntSeg(struct application *ap,
- struct partition *cpp /* component partition */,
- int space, fastf_t entrynorm[3], fastf_t exitnorm[3],
- int burstflag /* Was a burst generated by this partition? */
- )
+ struct partition *cpp /* component partition */,
+ int space, fastf_t entrynorm[3], fastf_t exitnorm[3],
+ int burstflag /* Was a burst generated by this partition? */
+ )
{
struct burst_state *s = (struct burst_state *)ap->a_uptr;
fastf_t icosobliquity; /* cosine of obliquity at entry */
@@ -818,20 +817,20 @@
los = (cpp->pt_outhit->hit_dist-cpp->pt_inhit->hit_dist)*s->unitconv;
if (bu_vls_strlen(&s->outfile)
- && fprintf(s->outfp,
- "%c % 8.2f % 8.2f %5d %2d % 7.3f % 7.2f % 7.3f %c\n",
- PB_RAY_INTERSECT,
- (s->standoff - cpp->pt_inhit->hit_dist)*s->unitconv,
- /* X'-coordinate of intersection */
- los, /* LOS thickness of component */
- cpp->pt_regionp->reg_regionid,
- /* component code number */
- space, /* space code */
- sinfbangle, /* sine of fallback angle at exit */
- rotangle, /* rotation angle in degrees at exit */
- icosobliquity, /* cosine of obliquity angle at entry */
- burstflag ? '1' : '0' /* flag generation of burst */
- ) < 0
+ && fprintf(s->outfp,
+ "%c % 8.2f % 8.2f %5d %2d % 7.3f % 7.2f % 7.3f %c\n",
+ PB_RAY_INTERSECT,
+ (s->standoff - cpp->pt_inhit->hit_dist)*s->unitconv,
+ /* X'-coordinate of intersection */
+ los, /* LOS thickness of component */
+ cpp->pt_regionp->reg_regionid,
+ /* component code number */
+ space, /* space code */
+ sinfbangle, /* sine of fallback angle at exit */
+ rotangle, /* rotation angle in degrees at exit */
+ icosobliquity, /* cosine of obliquity angle at entry */
+ burstflag ? '1' : '0' /* flag generation of burst */
+ ) < 0
) {
bu_exit(EXIT_FAILURE, "Write failed to file (%s)!\n",
bu_vls_cstr(&s->outfile));
}
@@ -840,35 +839,35 @@
return;
entryangle = NEAR_EQUAL(icosobliquity, 1.0, COS_TOL) ? 0.0 :
acos(icosobliquity) * RAD2DEG;
if ((normthickness = getNormThickness(ap, cpp, icosobliquity, entrynorm))
<= 0.0 && s->fatalerror) {
- brst_log(s, "Couldn't compute normal thickness.\n");
- brst_log(s, "\tshotline coordinates <%g, %g>\n",
- ap->a_uvec[X]*s->unitconv,
- ap->a_uvec[Y]*s->unitconv
- );
- brst_log(s, "\tregion name '%s' solid name '%s'\n",
- cpp->pt_regionp->reg_name,
- cpp->pt_inseg->seg_stp->st_name);
- return;
+ brst_log(s, "Couldn't compute normal thickness.\n");
+ brst_log(s, "\tshotline coordinates <%g, %g>\n",
+ ap->a_uvec[X]*s->unitconv,
+ ap->a_uvec[Y]*s->unitconv
+ );
+ brst_log(s, "\tregion name '%s' solid name '%s'\n",
+ cpp->pt_regionp->reg_name,
+ cpp->pt_inseg->seg_stp->st_name);
+ return;
}
exitangle = NEAR_EQUAL(ocosobliquity, 1.0, COS_TOL) ? 0.0 :
acos(ocosobliquity) * RAD2DEG;
if (fprintf(s->shotlnfp,
- "%c % 8.2f % 7.3f % 7.2f %5d % 8.2f % 8.2f %2d % 7.2f %
7.2f\n",
- PS_SHOT_INTERSECT,
- (s->standoff - cpp->pt_inhit->hit_dist)*s->unitconv,
- /* X'-coordinate of intersection */
- sinfbangle, /* sine of fallback angle at exit */
- rotangle, /* rotation angle in degrees at exit */
- cpp->pt_regionp->reg_regionid,
- /* component code number */
- normthickness*s->unitconv,
- /* normal thickness of component */
- los, /* LOS thickness of component */
- space, /* space code */
- entryangle, /* entry obliquity angle in degrees */
- exitangle /* exit obliquity angle in degrees */
- ) < 0
- ) {
- bu_exit(EXIT_FAILURE, "Write failed to file (%s)!\n",
bu_vls_cstr(&s->shotlnfile));
+ "%c % 8.2f % 7.3f % 7.2f %5d % 8.2f % 8.2f %2d % 7.2f % 7.2f\n",
+ PS_SHOT_INTERSECT,
+ (s->standoff - cpp->pt_inhit->hit_dist)*s->unitconv,
+ /* X'-coordinate of intersection */
+ sinfbangle, /* sine of fallback angle at exit */
+ rotangle, /* rotation angle in degrees at exit */
+ cpp->pt_regionp->reg_regionid,
+ /* component code number */
+ normthickness*s->unitconv,
+ /* normal thickness of component */
+ los, /* LOS thickness of component */
+ space, /* space code */
+ entryangle, /* entry obliquity angle in degrees */
+ exitangle /* exit obliquity angle in degrees */
+ ) < 0
+ ) {
+ bu_exit(EXIT_FAILURE, "Write failed to file (%s)!\n",
bu_vls_cstr(&s->shotlnfile));
}
}
@@ -922,7 +921,7 @@
{
int endpoint[3];
if (s->plotfp == NULL)
- return;
+ return;
VJOIN1(endpoint, rayp->r_pt, s->cellsz, rayp->r_dir);
bu_semaphore_acquire(BU_SEM_SYSCALL);
@@ -940,7 +939,7 @@
{
int endpoint[3];
if (s->plotfp == NULL)
- return;
+ return;
VJOIN1(endpoint, rayp->r_pt, s->cellsz, rayp->r_dir);
bu_semaphore_acquire(BU_SEM_SYSCALL);
@@ -948,13 +947,13 @@
/* draw line */
pl_3line(s->plotfp,
- (int) rayp->r_pt[X],
- (int) rayp->r_pt[Y],
- (int) rayp->r_pt[Z],
- endpoint[X],
- endpoint[Y],
- endpoint[Z]
- );
+ (int) rayp->r_pt[X],
+ (int) rayp->r_pt[Y],
+ (int) rayp->r_pt[Z],
+ endpoint[X],
+ endpoint[Y],
+ endpoint[Z]
+ );
bu_semaphore_release(BU_SEM_SYSCALL);
return;
@@ -1191,11 +1190,11 @@
fastf_t exitnorm[3]; /* normal at exit */
/* Get entry normal. */
getRtHitNorm(pp->pt_inhit, pp->pt_inseg->seg_stp,
- &ap->a_ray, (int) pp->pt_inflip, entrynorm);
+ &ap->a_ray, (int) pp->pt_inflip, entrynorm);
(void) chkEntryNorm(s, pp, &ap->a_ray, entrynorm, "shotline
entry normal");
/* Get exit normal. */
getRtHitNorm(pp->pt_outhit, pp->pt_outseg->seg_stp,
- &ap->a_ray, (int) pp->pt_outflip, exitnorm);
+ &ap->a_ray, (int) pp->pt_outflip, exitnorm);
(void) chkExitNorm(s, pp, &ap->a_ray, exitnorm, "shotline exit
normal");
/* In the case of fragmenting munitions, a hit on any
@@ -1218,7 +1217,7 @@
if (np != pt_headp && Air(nregp)) {
/* Check for interior burst point. */
if (bp == PT_NULL && s->bdist <= 0.0 &&
findIdents(regp->reg_regionid, &s->armorids)
- && (!s->reqburstair ||
findIdents(nregp->reg_aircode, &s->airids))) {
+ && (!s->reqburstair ||
findIdents(nregp->reg_aircode, &s->airids))) {
bp = pp; /* interior burst */
VMOVE(burstnorm, exitnorm);
}
@@ -1279,15 +1278,14 @@
munition with contact-fuzed set-back device):
location is bdist prior to entry point. */
VJOIN1(burstpt, bp->pt_inhit->hit_point, -s->bdist,
ap->a_ray.r_dir);
- } else
- if (s->bdist < 0.0) {
- /* Interior burst point (i.e. case-fragment
- munition with delayed fuzing): location is
- the magnitude of bdist beyond the exit
- point. */
- VJOIN1(burstpt, bp->pt_outhit->hit_point, -s->bdist,
ap->a_ray.r_dir);
- } else /* Interior burst point: no fuzing offset. */
- VMOVE(burstpt, bp->pt_outhit->hit_point);
+ } else if (s->bdist < 0.0) {
+ /* Interior burst point (i.e. case-fragment
+ munition with delayed fuzing): location is
+ the magnitude of bdist beyond the exit
+ point. */
+ VJOIN1(burstpt, bp->pt_outhit->hit_point, -s->bdist,
ap->a_ray.r_dir);
+ } else /* Interior burst point: no fuzing offset. */
+ VMOVE(burstpt, bp->pt_outhit->hit_point);
/* Only generate burst rays if nspallrays is greater than zero. */
return (s->nspallrays < 1) ? 1 : burstPoint(ap, burstnorm, burstpt);
@@ -1306,9 +1304,9 @@
*/
void
prntBurstHdr(
- struct burst_state *s,
- fastf_t *bpt /* burst point in model coords */,
- fastf_t *shotdir /* shotline direction vector */)
+ struct burst_state *s,
+ fastf_t *bpt /* burst point in model coords */,
+ fastf_t *shotdir /* shotline direction vector */)
{
fastf_t vec[3];
/* Transform burst point (model coordinate system) into the shotline
@@ -1318,32 +1316,32 @@
vec[X] = -VDOT(shotdir, bpt); /* X' - shotdir is reverse of X' */
if (bu_vls_strlen(&s->outfile)
- && fprintf(s->outfp,
- "%c % 8.3f % 8.3f\n",
- PB_CELL_IDENT,
- vec[Y]*s->unitconv,
- /* horizontal coordinate of burst point (Y') */
- vec[Z]*s->unitconv
- /* vertical coordinate of burst point (Z') */
- ) < 0
- ) {
- bu_exit(EXIT_FAILURE, "Write failed to file (%s)!\n",
bu_vls_cstr(&s->outfile));
+ && fprintf(s->outfp,
+ "%c % 8.3f % 8.3f\n",
+ PB_CELL_IDENT,
+ vec[Y]*s->unitconv,
+ /* horizontal coordinate of burst point (Y') */
+ vec[Z]*s->unitconv
+ /* vertical coordinate of burst point (Z') */
+ ) < 0
+ ) {
+ bu_exit(EXIT_FAILURE, "Write failed to file (%s)!\n",
bu_vls_cstr(&s->outfile));
}
if (bu_vls_strlen(&s->outfile)
- && fprintf(s->outfp,
- "%c % 8.2f % 8.2f %5d %2d % 7.3f % 7.2f % 7.3f %c\n",
- PB_RAY_INTERSECT,
- vec[X]*s->unitconv, /* X' coordinate of burst point */
- 0.0, /* LOS thickness of component */
- 9999, /* dummy component code number */
- 9, /* dummy space code */
- 0.0, /* N/A */
- 0.0, /* N/A */
- 0.0, /* N/A */
- '1' /* burst was generated */
- ) < 0
- ) {
- bu_exit(EXIT_FAILURE, "Write failed to file (%s)!\n",
bu_vls_cstr(&s->outfile));
+ && fprintf(s->outfp,
+ "%c % 8.2f % 8.2f %5d %2d % 7.3f % 7.2f % 7.3f %c\n",
+ PB_RAY_INTERSECT,
+ vec[X]*s->unitconv, /* X' coordinate of burst point */
+ 0.0, /* LOS thickness of component */
+ 9999, /* dummy component code number */
+ 9, /* dummy space code */
+ 0.0, /* N/A */
+ 0.0, /* N/A */
+ 0.0, /* N/A */
+ '1' /* burst was generated */
+ ) < 0
+ ) {
+ bu_exit(EXIT_FAILURE, "Write failed to file (%s)!\n",
bu_vls_cstr(&s->outfile));
}
}
@@ -1379,7 +1377,7 @@
/* check for limits of ground plane */
if (hitpoint[X] <= s->grndfr && hitpoint[X] >= -s->grndbk
&& hitpoint[Y] <= s->grndlf && hitpoint[Y] >= -s->grndrt
- ) {
+ ) {
/* We have a hit. */
if (bu_vls_strlen(&s->fbfile))
paintCellFb(ap, s->pixghit, s->zoom == 1 ? s->pixblack :
s->pixbkgr);
@@ -1386,13 +1384,12 @@
if (s->bdist > 0.0) {
/* simulate standoff fuzing */
VJOIN1(hitpoint, hitpoint, -s->bdist, ap->a_ray.r_dir);
- } else
- if (s->bdist < 0.0) {
- /* interior burst not implemented in ground */
- brst_log(s, "User error: negative burst distance can not be
specified with ground plane bursting.\n");
- s->fatalerror = 1;
- return -1;
- }
+ } else if (s->bdist < 0.0) {
+ /* interior burst not implemented in ground */
+ brst_log(s, "User error: negative burst distance can not be
specified with ground plane bursting.\n");
+ s->fatalerror = 1;
+ return -1;
+ }
/* else bdist == 0.0, no adjustment necessary */
/* only burst if nspallrays greater than zero */
if (s->nspallrays > 0) {
@@ -1445,31 +1442,30 @@
vec[X] /= s->unitconv;
vec[Y] /= s->unitconv;
}
- } else
- if (TSTBIT(s->firemode, FM_3DIM)) {
- /* 3D coordinates */
- int items;
+ } else if (TSTBIT(s->firemode, FM_3DIM)) {
+ /* 3D coordinates */
+ int items;
- /* read 3D firing coordinates from input stream */
- items = fscanf(s->shotfp, "%lf %lf %lf", &scan[0], &scan[1],
&scan[2]);
- VMOVE(vec, scan); /* double to fastf_t */
- if (items != 3) {
- if (items != EOF) {
- brst_log(s, "Fatal error: %d firing coordinates read.\n",
items);
- s->fatalerror = 1;
- return 0;
- } else {
- return EOF;
- }
+ /* read 3D firing coordinates from input stream */
+ items = fscanf(s->shotfp, "%lf %lf %lf", &scan[0], &scan[1], &scan[2]);
+ VMOVE(vec, scan); /* double to fastf_t */
+ if (items != 3) {
+ if (items != EOF) {
+ brst_log(s, "Fatal error: %d firing coordinates read.\n",
items);
+ s->fatalerror = 1;
+ return 0;
} else {
- vec[X] /= s->unitconv;
- vec[Y] /= s->unitconv;
- vec[Z] /= s->unitconv;
+ return EOF;
}
} else {
- brst_log(s, "BUG: readShot called with bad firemode.\n");
- return 0;
+ vec[X] /= s->unitconv;
+ vec[Y] /= s->unitconv;
+ vec[Z] /= s->unitconv;
}
+ } else {
+ brst_log(s, "BUG: readShot called with bad firemode.\n");
+ return 0;
+ }
return 1;
}
@@ -1493,9 +1489,12 @@
if (TSTBIT(s->firemode, FM_SHOT)) {
if (TSTBIT(s->firemode, FM_FILE)) {
switch (readShot(s, vec)) {
- case EOF : return EOF;
- case 1 : break;
- case 0 : return 0;
+ case EOF :
+ return EOF;
+ case 1 :
+ break;
+ case 0 :
+ return 0;
}
} else /* Single shot specified. */
VMOVE(vec, s->fire);
@@ -1584,7 +1583,7 @@
plotGrid(struct burst_state *s, fastf_t *r_pt)
{
if (s->plotfp == NULL)
- return;
+ return;
pl_color(s->plotfp, R_GRID, G_GRID, B_GRID);
pl_3point(s->plotfp, (int) r_pt[X], (int) r_pt[Y], (int) r_pt[Z]);
return;
@@ -1633,10 +1632,10 @@
prntFiringCoords(struct burst_state *s, fastf_t *vec)
{
if (!bu_vls_strlen(&s->gridfile))
- return;
+ return;
assert(s->gridfp != (FILE *) NULL);
if (fprintf(s->gridfp, "%7.2f %7.2f\n", vec[X]*s->unitconv,
vec[Y]*s->unitconv) < 0) {
- bu_exit(EXIT_FAILURE, "Write failed to file (%s)!\n",
bu_vls_cstr(&s->gridfile));
+ bu_exit(EXIT_FAILURE, "Write failed to file (%s)!\n",
bu_vls_cstr(&s->gridfile));
}
}
@@ -1667,7 +1666,7 @@
for (; ! s->userinterrupt; view_pix(&a)) {
if (! TSTBIT(s->firemode, FM_SHOT) && currshot > lastshot)
break;
- if (! (status = getRayOrigin(s, &a)) || status == EOF)
+ if (!(status = getRayOrigin(s, &a)) || status == EOF)
break;
currshot++;
prntFiringCoords(s, a.a_uvec);
@@ -1719,7 +1718,7 @@
{
int x_1, y_1, z_1, x_2, y_2, z_2;
if (s->plotfp == NULL)
- return;
+ return;
x_1 = (int) s->rtip->mdl_min[X] - 1;
y_1 = (int) s->rtip->mdl_min[Y] - 1;
z_1 = (int) s->rtip->mdl_min[Z] - 1;
@@ -1742,34 +1741,34 @@
projarea = s->cellsz*s->unitconv;
projarea *= projarea;
if (bu_vls_strlen(&s->outfile)
- && fprintf(s->outfp,
- "%c % 9.4f % 8.4f % 5.2f % 10.2f %-6s % 9.6f\n",
- PB_ASPECT_INIT,
- s->viewazim*RAD2DEG, /* attack azimuth in degrees */
- s->viewelev*RAD2DEG, /* attack elevation in degrees */
- s->bdist*s->unitconv, /* BDIST */
- projarea, /* projected area associated with burst pt.
*/
+ && fprintf(s->outfp,
+ "%c % 9.4f % 8.4f % 5.2f % 10.2f %-6s % 9.6f\n",
+ PB_ASPECT_INIT,
+ s->viewazim*RAD2DEG, /* attack azimuth in degrees */
+ s->viewelev*RAD2DEG, /* attack elevation in degrees */
+ s->bdist*s->unitconv, /* BDIST */
+ projarea, /* projected area associated with burst pt. */
bu_units_string(s->units),
- s->raysolidangle
- ) < 0
- ) {
- bu_exit(EXIT_FAILURE, "Write failed to file (%s)!\n",
bu_vls_cstr(&s->outfile));
+ s->raysolidangle
+ ) < 0
+ ) {
+ bu_exit(EXIT_FAILURE, "Write failed to file (%s)!\n",
bu_vls_cstr(&s->outfile));
}
if (bu_vls_strlen(&s->shotlnfile)
- && fprintf(s->shotlnfp,
- "%c % 9.4f % 8.4f % 7.2f % 7.2f %7.2f %7.2f %7.2f
%-6s\n",
- PS_ASPECT_INIT,
- s->viewazim*RAD2DEG, /* attack azimuth in degrees */
- s->viewelev*RAD2DEG, /* attack elevation in degrees */
- s->cellsz*s->unitconv, /* shotline separation */
- s->modlrt*s->unitconv, /* maximum Y'-coordinate of
target */
- s->modllf*s->unitconv, /* minimum Y'-coordinate of
target */
- s->modlup*s->unitconv, /* maximum Z'-coordinate of
target */
- s->modldn*s->unitconv, /* minimum Z'-coordinate of
target */
+ && fprintf(s->shotlnfp,
+ "%c % 9.4f % 8.4f % 7.2f % 7.2f %7.2f %7.2f %7.2f
%-6s\n",
+ PS_ASPECT_INIT,
+ s->viewazim*RAD2DEG, /* attack azimuth in degrees */
+ s->viewelev*RAD2DEG, /* attack elevation in degrees */
+ s->cellsz*s->unitconv, /* shotline separation */
+ s->modlrt*s->unitconv, /* maximum Y'-coordinate of
target */
+ s->modllf*s->unitconv, /* minimum Y'-coordinate of
target */
+ s->modlup*s->unitconv, /* maximum Z'-coordinate of
target */
+ s->modldn*s->unitconv, /* minimum Z'-coordinate of
target */
bu_units_string(s->units)
- ) < 0
- ) {
- bu_exit(EXIT_FAILURE, "Write failed to file (%s)!\n",
bu_vls_cstr(&s->shotlnfile));
+ ) < 0
+ ) {
+ bu_exit(EXIT_FAILURE, "Write failed to file (%s)!\n",
bu_vls_cstr(&s->shotlnfile));
}
return;
}
@@ -1828,7 +1827,8 @@
/* SERIAL case -- one CPU does all the work */
if (! gridShot(s))
return;
-endvu: view_end(s);
+endvu:
+ view_end(s);
return;
}
@@ -1874,17 +1874,17 @@
des_V[2] = cos(elev);
if (!ZERO(roll)) {
- fastf_t tmp_V[3], tmp_H[3], prime_V[3];
- fastf_t sn_roll = sin(roll);
- fastf_t cs_roll = cos(roll);
+ fastf_t tmp_V[3], tmp_H[3], prime_V[3];
+ fastf_t sn_roll = sin(roll);
+ fastf_t cs_roll = cos(roll);
- VSCALE(tmp_V, des_V, cs_roll);
- VSCALE(tmp_H, des_H, sn_roll);
- VADD2(prime_V, tmp_V, tmp_H);
- VSCALE(tmp_V, des_V, -sn_roll);
- VSCALE(tmp_H, des_H, cs_roll);
- VADD2(des_H, tmp_V, tmp_H);
- VMOVE(des_V, prime_V);
+ VSCALE(tmp_V, des_V, cs_roll);
+ VSCALE(tmp_H, des_H, sn_roll);
+ VADD2(prime_V, tmp_V, tmp_H);
+ VSCALE(tmp_V, des_V, -sn_roll);
+ VSCALE(tmp_H, des_H, cs_roll);
+ VADD2(des_H, tmp_V, tmp_H);
+ VMOVE(des_V, prime_V);
}
return;
}
@@ -1918,9 +1918,8 @@
/* reposition file pointers if necessary */
if (TSTBIT(s->firemode, FM_SHOT) && TSTBIT(s->firemode, FM_FILE))
rewind(s->shotfp);
- else
- if (TSTBIT(s->firemode, FM_BURST) && TSTBIT(s->firemode, FM_FILE))
- rewind(s->burstfp);
+ else if (TSTBIT(s->firemode, FM_BURST) && TSTBIT(s->firemode, FM_FILE))
+ rewind(s->burstfp);
/* Compute distances from grid origin (model origin) to each
border of grid, and grid indices at borders of grid.
@@ -1943,79 +1942,79 @@
}
/* Calculate extent of grid. */
s->gridrt = FMAX(s->gridhor[X] * modelmax[X],
- s->gridhor[X] * modelmin[X]
- ) +
- FMAX(s->gridhor[Y] * modelmax[Y],
- s->gridhor[Y] * modelmin[Y]
- ) +
- FMAX(s->gridhor[Z] * modelmax[Z],
- s->gridhor[Z] * modelmin[Z]
- );
+ s->gridhor[X] * modelmin[X]
+ ) +
+ FMAX(s->gridhor[Y] * modelmax[Y],
+ s->gridhor[Y] * modelmin[Y]
+ ) +
+ FMAX(s->gridhor[Z] * modelmax[Z],
+ s->gridhor[Z] * modelmin[Z]
+ );
s->gridlf = FMIN(s->gridhor[X] * modelmax[X],
- s->gridhor[X] * modelmin[X]
- ) +
- FMIN(s->gridhor[Y] * modelmax[Y],
- s->gridhor[Y] * modelmin[Y]
- ) +
- FMIN(s->gridhor[Z] * modelmax[Z],
- s->gridhor[Z] * modelmin[Z]
- );
+ s->gridhor[X] * modelmin[X]
+ ) +
+ FMIN(s->gridhor[Y] * modelmax[Y],
+ s->gridhor[Y] * modelmin[Y]
+ ) +
+ FMIN(s->gridhor[Z] * modelmax[Z],
+ s->gridhor[Z] * modelmin[Z]
+ );
s->gridup = FMAX(s->gridver[X] * modelmax[X],
- s->gridver[X] * modelmin[X]
- ) +
- FMAX(s->gridver[Y] * modelmax[Y],
- s->gridver[Y] * modelmin[Y]
- ) +
- FMAX(s->gridver[Z] * modelmax[Z],
- s->gridver[Z] * modelmin[Z]
- );
+ s->gridver[X] * modelmin[X]
+ ) +
+ FMAX(s->gridver[Y] * modelmax[Y],
+ s->gridver[Y] * modelmin[Y]
+ ) +
+ FMAX(s->gridver[Z] * modelmax[Z],
+ s->gridver[Z] * modelmin[Z]
+ );
s->griddn = FMIN(s->gridver[X] * modelmax[X],
- s->gridver[X] * modelmin[X]
- ) +
- FMIN(s->gridver[Y] * modelmax[Y],
- s->gridver[Y] * modelmin[Y]
- ) +
- FMIN(s->gridver[Z] * modelmax[Z],
- s->gridver[Z] * modelmin[Z]
- );
+ s->gridver[X] * modelmin[X]
+ ) +
+ FMIN(s->gridver[Y] * modelmax[Y],
+ s->gridver[Y] * modelmin[Y]
+ ) +
+ FMIN(s->gridver[Z] * modelmax[Z],
+ s->gridver[Z] * modelmin[Z]
+ );
/* Calculate extent of model in plane of grid. */
if (s->groundburst) {
s->modlrt = FMAX(s->gridhor[X] * s->rtip->mdl_max[X],
- s->gridhor[X] * s->rtip->mdl_min[X]
- ) +
- FMAX(s->gridhor[Y] * s->rtip->mdl_max[Y],
- s->gridhor[Y] * s->rtip->mdl_min[Y]
- ) +
- FMAX(s->gridhor[Z] * s->rtip->mdl_max[Z],
- s->gridhor[Z] * s->rtip->mdl_min[Z]
- );
+ s->gridhor[X] * s->rtip->mdl_min[X]
+ ) +
+ FMAX(s->gridhor[Y] * s->rtip->mdl_max[Y],
+ s->gridhor[Y] * s->rtip->mdl_min[Y]
+ ) +
+ FMAX(s->gridhor[Z] * s->rtip->mdl_max[Z],
+ s->gridhor[Z] * s->rtip->mdl_min[Z]
+ );
s->modllf = FMIN(s->gridhor[X] * s->rtip->mdl_max[X],
- s->gridhor[X] * s->rtip->mdl_min[X]
- ) +
- FMIN(s->gridhor[Y] * s->rtip->mdl_max[Y],
- s->gridhor[Y] * s->rtip->mdl_min[Y]
- ) +
- FMIN(s->gridhor[Z] * s->rtip->mdl_max[Z],
- s->gridhor[Z] * s->rtip->mdl_min[Z]
- );
+ s->gridhor[X] * s->rtip->mdl_min[X]
+ ) +
+ FMIN(s->gridhor[Y] * s->rtip->mdl_max[Y],
+ s->gridhor[Y] * s->rtip->mdl_min[Y]
+ ) +
+ FMIN(s->gridhor[Z] * s->rtip->mdl_max[Z],
+ s->gridhor[Z] * s->rtip->mdl_min[Z]
+ );
s->modlup = FMAX(s->gridver[X] * s->rtip->mdl_max[X],
- s->gridver[X] * s->rtip->mdl_min[X]
- ) +
- FMAX(s->gridver[Y] * s->rtip->mdl_max[Y],
- s->gridver[Y] * s->rtip->mdl_min[Y]
- ) +
- FMAX(s->gridver[Z] * s->rtip->mdl_max[Z],
- s->gridver[Z] * s->rtip->mdl_min[Z]
- );
+ s->gridver[X] * s->rtip->mdl_min[X]
+ ) +
+ FMAX(s->gridver[Y] * s->rtip->mdl_max[Y],
+ s->gridver[Y] * s->rtip->mdl_min[Y]
+ ) +
+ FMAX(s->gridver[Z] * s->rtip->mdl_max[Z],
+ s->gridver[Z] * s->rtip->mdl_min[Z]
+ );
s->modldn = FMIN(s->gridver[X] * s->rtip->mdl_max[X],
- s->gridver[X] * s->rtip->mdl_min[X]
- ) +
- FMIN(s->gridver[Y] * s->rtip->mdl_max[Y],
- s->gridver[Y] * s->rtip->mdl_min[Y]
- ) +
- FMIN(s->gridver[Z] * s->rtip->mdl_max[Z],
- s->gridver[Z] * s->rtip->mdl_min[Z]
- );
+ s->gridver[X] * s->rtip->mdl_min[X]
+ ) +
+ FMIN(s->gridver[Y] * s->rtip->mdl_max[Y],
+ s->gridver[Y] * s->rtip->mdl_min[Y]
+ ) +
+ FMIN(s->gridver[Z] * s->rtip->mdl_max[Z],
+ s->gridver[Z] * s->rtip->mdl_min[Z]
+ );
} else {
s->modlrt = s->gridrt;
s->modllf = s->gridlf;
@@ -2038,14 +2037,14 @@
/* compute stand-off distance */
s->standoff = FMAX(viewdir[X] * s->rtip->mdl_max[X],
- viewdir[X] * s->rtip->mdl_min[X]
- ) +
- FMAX(viewdir[Y] * s->rtip->mdl_max[Y],
- viewdir[Y] * s->rtip->mdl_min[Y]
- ) +
- FMAX(viewdir[Z] * s->rtip->mdl_max[Z],
- viewdir[Z] * s->rtip->mdl_min[Z]
- );
+ viewdir[X] * s->rtip->mdl_min[X]
+ ) +
+ FMAX(viewdir[Y] * s->rtip->mdl_max[Y],
+ viewdir[Y] * s->rtip->mdl_min[Y]
+ ) +
+ FMAX(viewdir[Z] * s->rtip->mdl_max[Z],
+ viewdir[Z] * s->rtip->mdl_min[Z]
+ );
/* determine largest grid dimension for frame buffer display */
s->gridwidth = s->gridxfin - s->gridxorg + 1;
Modified: brlcad/branches/bioh/src/burst2/paint.cpp
===================================================================
--- brlcad/branches/bioh/src/burst2/paint.cpp 2020-06-11 18:15:48 UTC (rev
76116)
+++ brlcad/branches/bioh/src/burst2/paint.cpp 2020-06-11 18:22:58 UTC (rev
76117)
@@ -198,7 +198,7 @@
} else if (fb_clear(s->fbiop, s->pixblack) == -1
|| (fb_zoom(s->fbiop, 1, 1) == -1)
|| (fb_window(s->fbiop, s->devwid/2, s->devhgt/2) == -1)
- ) {
+ ) {
return 1;
}
return 0;
@@ -208,7 +208,7 @@
imageInit(struct burst_state *s)
{
int needopen = 0;
- static char lastfbfile[LNBUFSZ]={0}; /* last fbfile */
+ static char lastfbfile[LNBUFSZ]= {0}; /* last fbfile */
s->devwid = 512;
s->devhgt = 512;
if (!bu_vls_strlen(&s->fbfile))
@@ -226,9 +226,8 @@
/* Determine whether it is necessary to open fbfile. */
if (s->fbiop == FB_NULL || fb_getwidth(s->fbiop) != s->devwid)
needopen = 1; /* not currently open or size changed */
- else
- if (lastfbfile[0] != '\0' && !BU_STR_EQUAL(bu_vls_cstr(&s->fbfile),
lastfbfile))
- needopen = 1; /* name changed */
+ else if (lastfbfile[0] != '\0' && !BU_STR_EQUAL(bu_vls_cstr(&s->fbfile),
lastfbfile))
+ needopen = 1; /* name changed */
bu_strlcpy(lastfbfile, bu_vls_cstr(&s->fbfile), LNBUFSZ);
if (needopen) {
@@ -235,9 +234,8 @@
if (!openFbDevice(s, &s->fbfile))
return 0;
paintGridFb(s);
- } else
- if (!(s->firemode & FM_SHOT) || (s->firemode & FM_FILE))
- paintGridFb(s);
+ } else if (!(s->firemode & FM_SHOT) || (s->firemode & FM_FILE))
+ paintGridFb(s);
return 1;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits