Revision: 41054
          http://brlcad.svn.sourceforge.net/brlcad/?rev=41054&view=rev
Author:   brlcad
Date:     2010-10-18 18:55:22 +0000 (Mon, 18 Oct 2010)

Log Message:
-----------
clean things up for Windows.  remove all extern declarations of the bu_getopt 
globals.  remove all forward decls, for that matter, including a slew of 
unnecessary ones provided by anim.h; reordering accordingly.

Modified Paths:
--------------
    brlcad/trunk/src/anim/anim_cascade.c
    brlcad/trunk/src/anim/anim_hardtrack.c
    brlcad/trunk/src/anim/anim_keyread.c
    brlcad/trunk/src/anim/anim_lookat.c
    brlcad/trunk/src/anim/anim_orient.c
    brlcad/trunk/src/anim/anim_script.c
    brlcad/trunk/src/anim/anim_track.c
    brlcad/trunk/src/anim/anim_turn.c

Modified: brlcad/trunk/src/anim/anim_cascade.c
===================================================================
--- brlcad/trunk/src/anim/anim_cascade.c        2010-10-18 18:46:09 UTC (rev 
41053)
+++ brlcad/trunk/src/anim/anim_cascade.c        2010-10-18 18:55:22 UTC (rev 
41054)
@@ -43,41 +43,122 @@
 #include "common.h"
 
 #include <math.h>
-#include <stdio.h>
+#include "bio.h"
 
-#include "vmath.h"
 #include "bu.h"
 #include "bn.h"
 #include "anim.h"
+#include "vmath.h"
 
 
-#ifndef M_PI
-#define M_PI   3.14159265358979323846
-#endif
+#define OPT_STR "so:f:r:a:"
 
-#ifndef M_PI
-#define RTOD   180.000/M_PI
-#endif
-
 #define        CASCADE_A       0
 #define CASCADE_R      1
 #define CASCADE_F      2
 
-int get_args(int argc, char **argv);
 
-extern void    anim_dy_p_r2mat(fastf_t *, double, double, double);
-extern void    anim_tran(fastf_t *);
-extern int     anim_mat2ypr(fastf_t *, fastf_t *);
-
-extern int bu_optind;
-extern char *bu_optarg;
-
 vect_t fcenter, fypr, rcenter, rypr, acenter, aypr;
 int cmd_fcen, cmd_fypr, cmd_rcen, cmd_rypr, cmd_acen, cmd_aypr;
 int output_mode, read_time, print_time;
 
+
+int get_args(int argc, char **argv)
+{
+    int c, d;
+
+    output_mode = CASCADE_A;
+    cmd_fcen = cmd_fypr = cmd_rcen = cmd_rypr = cmd_acen = cmd_aypr = 0;
+    print_time = 1;
+    while ( (c=bu_getopt(argc, argv, OPT_STR)) != EOF) {
+       switch (c) {
+           case 'f':
+               d = *(bu_optarg);
+               if (d == 'c') {
+                   sscanf(argv[bu_optind], "%lf", fcenter+0);
+                   sscanf(argv[bu_optind+1], "%lf", fcenter+1);
+                   sscanf(argv[bu_optind+2], "%lf", fcenter+2);
+                   bu_optind += 3;
+                   cmd_fcen = 1;
+                   break;
+               } else if ( d =='y') {
+                   sscanf(argv[bu_optind], "%lf", fypr+0);
+                   sscanf(argv[bu_optind+1], "%lf", fypr+1);
+                   sscanf(argv[bu_optind+2], "%lf", fypr+2);
+                   bu_optind += 3;
+                   cmd_fypr = 1;
+                   break;
+               } else {
+                   fprintf(stderr, "anim_cascade: unknown option -f%c\n", d);
+               }
+               break;
+           case 'r':
+               d = *(bu_optarg);
+               if (d == 'c') {
+                   sscanf(argv[bu_optind], "%lf", rcenter+0);
+                   sscanf(argv[bu_optind+1], "%lf", rcenter+1);
+                   sscanf(argv[bu_optind+2], "%lf", rcenter+2);
+                   bu_optind += 3;
+                   cmd_rcen = 1;
+                   break;
+               } else if ( d =='y') {
+                   sscanf(argv[bu_optind], "%lf", rypr+0);
+                   sscanf(argv[bu_optind+1], "%lf", rypr+1);
+                   sscanf(argv[bu_optind+2], "%lf", rypr+2);
+                   bu_optind += 3;
+                   cmd_rypr = 1;
+                   break;
+               } else {
+                   fprintf(stderr, "anim_cascade: unknown option -r%c\n", d);
+               }
+               break;
+           case 'a':
+               d = *(bu_optarg);
+               if (d == 'c') {
+                   sscanf(argv[bu_optind], "%lf", acenter+0);
+                   sscanf(argv[bu_optind+1], "%lf", acenter+1);
+                   sscanf(argv[bu_optind+2], "%lf", acenter+2);
+                   bu_optind += 3;
+                   cmd_acen = 1;
+                   break;
+               } else if ( d =='y') {
+                   sscanf(argv[bu_optind], "%lf", aypr+0);
+                   sscanf(argv[bu_optind+1], "%lf", aypr+1);
+                   sscanf(argv[bu_optind+2], "%lf", aypr+2);
+                   bu_optind += 3;
+                   cmd_aypr = 1;
+                   break;
+               } else {
+                   fprintf(stderr, "anim_cascade: unknown option -a%c\n", d);
+               }
+               break;
+           case 'o':
+               d = *(bu_optarg);
+               if (d == 'r') {
+                   output_mode = CASCADE_R;
+               } else if (d == 'f') {
+                   output_mode = CASCADE_F;
+               } else if (d == 'a') {
+                   /* default */
+                   output_mode = CASCADE_A;
+               } else {
+                   fprintf(stderr, "anim_cascade: unknown option -i%c\n", d);
+               }
+               break;
+           case 's':
+               print_time = 0;
+               break;
+           default:
+               fprintf(stderr, "anim_cascade: unknown option: -%c\n", c);
+               return 0;
+       }
+    }
+    return 1;
+}
+
+
 int
-main (int argc, char **argv)
+main (int argc, char *argv[])
 {
     int val;
     fastf_t time, yaw1, pitch1, roll1, yaw2, pitch2, roll2;
@@ -205,101 +286,7 @@
     return 0;
 }
 
-#define OPT_STR "so:f:r:a:"
 
-int get_args(int argc, char **argv)
-{
-    int c, d;
-
-    output_mode = CASCADE_A;
-    cmd_fcen = cmd_fypr = cmd_rcen = cmd_rypr = cmd_acen = cmd_aypr = 0;
-    print_time = 1;
-    while ( (c=bu_getopt(argc, argv, OPT_STR)) != EOF) {
-       switch (c) {
-           case 'f':
-               d = *(bu_optarg);
-               if (d == 'c') {
-                   sscanf(argv[bu_optind], "%lf", fcenter+0);
-                   sscanf(argv[bu_optind+1], "%lf", fcenter+1);
-                   sscanf(argv[bu_optind+2], "%lf", fcenter+2);
-                   bu_optind += 3;
-                   cmd_fcen = 1;
-                   break;
-               } else if ( d =='y') {
-                   sscanf(argv[bu_optind], "%lf", fypr+0);
-                   sscanf(argv[bu_optind+1], "%lf", fypr+1);
-                   sscanf(argv[bu_optind+2], "%lf", fypr+2);
-                   bu_optind += 3;
-                   cmd_fypr = 1;
-                   break;
-               } else {
-                   fprintf(stderr, "anim_cascade: unknown option -f%c\n", d);
-               }
-               break;
-           case 'r':
-               d = *(bu_optarg);
-               if (d == 'c') {
-                   sscanf(argv[bu_optind], "%lf", rcenter+0);
-                   sscanf(argv[bu_optind+1], "%lf", rcenter+1);
-                   sscanf(argv[bu_optind+2], "%lf", rcenter+2);
-                   bu_optind += 3;
-                   cmd_rcen = 1;
-                   break;
-               } else if ( d =='y') {
-                   sscanf(argv[bu_optind], "%lf", rypr+0);
-                   sscanf(argv[bu_optind+1], "%lf", rypr+1);
-                   sscanf(argv[bu_optind+2], "%lf", rypr+2);
-                   bu_optind += 3;
-                   cmd_rypr = 1;
-                   break;
-               } else {
-                   fprintf(stderr, "anim_cascade: unknown option -r%c\n", d);
-               }
-               break;
-           case 'a':
-               d = *(bu_optarg);
-               if (d == 'c') {
-                   sscanf(argv[bu_optind], "%lf", acenter+0);
-                   sscanf(argv[bu_optind+1], "%lf", acenter+1);
-                   sscanf(argv[bu_optind+2], "%lf", acenter+2);
-                   bu_optind += 3;
-                   cmd_acen = 1;
-                   break;
-               } else if ( d =='y') {
-                   sscanf(argv[bu_optind], "%lf", aypr+0);
-                   sscanf(argv[bu_optind+1], "%lf", aypr+1);
-                   sscanf(argv[bu_optind+2], "%lf", aypr+2);
-                   bu_optind += 3;
-                   cmd_aypr = 1;
-                   break;
-               } else {
-                   fprintf(stderr, "anim_cascade: unknown option -a%c\n", d);
-               }
-               break;
-           case 'o':
-               d = *(bu_optarg);
-               if (d == 'r') {
-                   output_mode = CASCADE_R;
-               } else if (d == 'f') {
-                   output_mode = CASCADE_F;
-               } else if (d == 'a') {
-                   /* default */
-                   output_mode = CASCADE_A;
-               } else {
-                   fprintf(stderr, "anim_cascade: unknown option -i%c\n", d);
-               }
-               break;
-           case 's':
-               print_time = 0;
-               break;
-           default:
-               fprintf(stderr, "anim_cascade: unknown option: -%c\n", c);
-               return 0;
-       }
-    }
-    return 1;
-}
-
 /*
  * Local Variables:
  * mode: C

Modified: brlcad/trunk/src/anim/anim_hardtrack.c
===================================================================
--- brlcad/trunk/src/anim/anim_hardtrack.c      2010-10-18 18:46:09 UTC (rev 
41053)
+++ brlcad/trunk/src/anim/anim_hardtrack.c      2010-10-18 18:55:22 UTC (rev 
41054)
@@ -27,18 +27,19 @@
 
 #include "common.h"
 
-#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
-
 #include "bio.h"
+
 #include "vmath.h"
 #include "bu.h"
 #include "bn.h"
 #include "anim.h"
 
 
+#define OPT_STR "b:d:f:i:l:pr:w:sg:m:c"
+
 #define NW     num_wheels
 #define NEXT(i)        (i+1)%NW
 #define PREV(i)        (i+NW-1)%NW
@@ -46,6 +47,7 @@
 #define TRACK_ANIM     0
 #define TRACK_ARCED    1
 
+
 typedef double *pdouble;
 
 struct wheel {
@@ -79,9 +81,6 @@
     fastf_t            ang;    /* initial angle */
 };
 
-/* external variables */
-extern int bu_optind;
-extern char *bu_optarg;
 
 /* variables describing track geometry - used by main, trackprep, get_link */
 struct all *x;
@@ -108,13 +107,197 @@
 char wheel_cmd[10];            /* default is "lmul" */
 int get_circumf;       /* flag: just return circumference of track */
 
-int get_link(fastf_t *pos, fastf_t *angle_p, fastf_t dist);
 
+int get_link(fastf_t *pos, fastf_t *angle_p, fastf_t dist)
+{
+    int i;
+    vect_t temp;
+    while (dist >= tracklen) /*periodicize*/
+       dist -= tracklen;
+    while (dist < 0.0)
+       dist += tracklen;
+    for (i=0;i<NW;i++) {
+       if ( (dist  -= x[i].t.len) < 0 ) {
+           VSCALE(temp, (x[i].t.dir), dist);
+           VADD2(pos, x[i].t.pos1, temp);
+           *angle_p = atan2(x[i].t.dir[2], x[i].t.dir[0]);
+           return 2*i;
+       }
+       if ((dist -= x[i].w.rad*x[i].w.arc) < 0) {
+           *angle_p = dist/x[i].w.rad;
+           *angle_p = x[i].w.ang1 - *angle_p; /*from x-axis to link*/
+           pos[0] = x[i].w.pos[0] + x[i].w.rad*cos(*angle_p);
+           pos[1] = x[i].w.pos[1];
+           pos[2] = x[i].w.pos[2] + x[i].w.rad*sin(*angle_p);
+           *angle_p -= M_PI_2; /*angle of clockwise tangent to circle*/
+           return 2*i+1;
+       }
+    }
+    return -1;
+}
+
+
+int get_args(int argc, char **argv)
+{
+    fastf_t yaw, pch, rll;
+    void anim_dx_y_z2mat(fastf_t *, double, double, double), 
anim_dz_y_x2mat(fastf_t *, double, double, double);
+    int c, i;
+    axes = cent = links_placed = print_wheel = print_link = 0;
+    get_circumf = 0;
+    print_mode = TRACK_ANIM;
+    bu_strlcpy(link_cmd, "rarc", sizeof(link_cmd));
+    bu_strlcpy(wheel_cmd, "lmul", sizeof(wheel_cmd));
+    while ( (c=bu_getopt(argc, argv, OPT_STR)) != EOF) {
+       i=0;
+       switch (c) {
+           case 'b':
+               bu_optind -= 1;
+               sscanf(argv[bu_optind+(i++)], "%lf", &yaw );
+               sscanf(argv[bu_optind+(i++)], "%lf", &pch );
+               sscanf(argv[bu_optind+(i++)], "%lf", &rll );
+               bu_optind += 3;
+               anim_dx_y_z2mat(m_axes, rll, -pch, yaw);
+               anim_dz_y_x2mat(m_rev_axes, -rll, pch, -yaw);
+               axes = 1;
+               break;
+           case 'd':
+               bu_optind -= 1;
+               sscanf(argv[bu_optind+(i++)], "%lf", centroid);
+               sscanf(argv[bu_optind+(i++)], "%lf", centroid+1);
+               sscanf(argv[bu_optind+(i++)], "%lf", centroid+2);
+               bu_optind += 3;
+               VREVERSE(rcentroid, centroid);
+               cent = 1;
+               break;
+           case 'f':
+               sscanf(bu_optarg, "%d", &first_frame);
+               break;
+           case 'i':
+               sscanf(bu_optarg, "%lf", &init_dist);
+               break;
+           case 'p':
+               links_placed = 1;
+               break;
+           case 'r':
+               sscanf(bu_optarg, "%lf", &radius);
+               break;
+           case 'w':
+               wheel_nindex = bu_optind - 1;
+               /*sscanf(bu_optarg, "%s", wheel_name);*/
+               print_wheel = 1;
+               break;
+           case 'l':
+               sscanf(bu_optarg, "%d", &num_links);
+               link_nindex = bu_optind;
+               bu_optind += 1;
+               print_link = 1;
+               break;
+           case 's':
+               steer = 1;
+               break;
+           case 'g':
+               sscanf(bu_optarg, "%d", &arced_frame);
+               print_mode = TRACK_ARCED;
+               break;
+           case 'm':
+               switch (*bu_optarg) {
+                   case 'l':
+                       bu_strlcpy(link_cmd, argv[bu_optind], sizeof(link_cmd));
+                       break;
+                   case 'w':
+                       bu_strlcpy(wheel_cmd, argv[bu_optind], 
sizeof(wheel_cmd));
+                       break;
+                   default:
+                       fprintf(stderr, "Unknown option: -m%c\n", *bu_optarg);
+                       return 0;
+               }
+               bu_optind += 1;
+               break;
+           case 'c':
+               get_circumf = 1;
+               break;
+           default:
+               fprintf(stderr, "Unknown option: -%c\n", c);
+               return 0;
+       }
+    }
+    return 1;
+}
+
+
+int track_prep(void)/*run once at the beginning to establish important track 
info*/
+{
+    int i;
+    fastf_t phi, costheta, link_angle, arc_angle;
+    vect_t difference, link_cent;
+
+    /* first loop - get inter axle slopes and start/end angles */
+    for (i=0;i<NW;i++) {
+       /*calculate current slope vector*/
+       VSUB2(x[i].s.dir, x[i].w.pos, x[PREV(i)].w.pos);
+       x[i].s.len = MAGNITUDE(x[i].s.dir);
+       /*calculate end angle of previous wheel - atan2(y, x)*/
+       phi = atan2(x[i].s.dir[2], x[i].s.dir[0]);/*absolute angle of slope*/
+       costheta = (x[PREV(i)].w.rad - x[i].w.rad)/x[i].s.len;/*cosine of 
special angle*/
+       x[PREV(i)].w.ang1 = phi +  acos(costheta);
+       while (x[PREV(i)].w.ang1 < 0.0)
+           x[PREV(i)].w.ang1 += 2.0*M_PI;
+       x[i].w.ang0 = x[PREV(i)].w.ang1;
+    }
+
+    /* second loop - handle concavities */
+    for (i=0;i<NW;i++) {
+       arc_angle = x[i].w.ang0 - x[i].w.ang1;
+       while (arc_angle < 0.0)
+           arc_angle += 2.0*M_PI;
+       if (arc_angle > M_PI) {
+           /* concave */
+           x[i].w.ang0 = 0.5*(x[i].w.ang0 + x[i].w.ang1);
+           x[i].w.ang1 = x[i].w.ang0;
+           x[i].w.arc = 0.0;
+       }
+       else {
+           /* convex - angles are already correct */
+           x[i].w.arc = arc_angle;
+       }
+    }
+
+    /* third loop - calculate geometry of track segments */
+    tracklen = 0.0;
+    for (i=0;i<NW;i++) {
+       /*calculate endpoints of track segment*/
+       x[i].t.pos1[0] = x[i].w.pos[0] + x[i].w.rad*cos(x[i].w.ang0);
+       x[i].t.pos1[1] = x[i].w.pos[1];
+       x[i].t.pos1[2] = x[i].w.pos[2] + x[i].w.rad*sin(x[i].w.ang0);
+       x[i].t.pos0[0] = x[PREV(i)].w.pos[0] + 
x[PREV(i)].w.rad*cos(x[PREV(i)].w.ang1);
+       x[i].t.pos0[1] = x[PREV(i)].w.pos[1];
+       x[i].t.pos0[2] = x[PREV(i)].w.pos[2] + 
x[PREV(i)].w.rad*sin(x[PREV(i)].w.ang1);
+       /*calculate length and direction*/
+       VSUB2(difference, x[i].t.pos1, x[i].t.pos0);
+       x[i].t.len = MAGNITUDE(difference);
+       VSCALE((x[i].t.dir), difference, (1.0/x[i].t.len));
+
+       /*calculate arclength and total track length*/
+       tracklen += x[i].t.len;
+       tracklen += x[i].w.arc*x[i].w.rad;
+    }
+
+    /* for a track with links already placed, get initial positions*/
+    r = (struct rlink *) bu_calloc(num_links, sizeof(struct rlink), "struct 
rlink");
+    if (links_placed)
+       for (i=0;i<num_links;i++) {
+           get_link(link_cent, &link_angle, init_dist + tracklen*i/num_links);
+           VREVERSE(r[i].pos, link_cent);
+           r[i].ang = -link_angle;
+       }
+    return 0;
+}
+
+
 int
-main(int argc, char **argv)
+main(int argc, char *argv[])
 {
-    void anim_dir2mat(fastf_t *, const fastf_t *, const fastf_t *), 
anim_y_p_r2mat(fastf_t *, double, double, double), anim_add_trans(fastf_t *, 
const fastf_t *, const fastf_t *), anim_mat_print(FILE *, const fastf_t *, int);
-    int get_args(int argc, char **argv), track_prep(void), val, frame, go, i, 
count;
+    int val, frame, go, i, count;
     fastf_t y_rot, distance, yaw, pitch, roll;
     vect_t p1, p2, p3, dir, dir2, wheel_now, wheel_prev;
     vect_t zero, position, vdelta, temp, to_track, to_front;
@@ -316,210 +499,6 @@
 }
 
 
-int track_prep(void)/*run once at the beginning to establish important track 
info*/
-{
-    int i;
-    fastf_t phi, costheta, link_angle, arc_angle;
-    vect_t difference, link_cent;
-
-    /* first loop - get inter axle slopes and start/end angles */
-    for (i=0;i<NW;i++) {
-       /*calculate current slope vector*/
-       VSUB2(x[i].s.dir, x[i].w.pos, x[PREV(i)].w.pos);
-       x[i].s.len = MAGNITUDE(x[i].s.dir);
-       /*calculate end angle of previous wheel - atan2(y, x)*/
-       phi = atan2(x[i].s.dir[2], x[i].s.dir[0]);/*absolute angle of slope*/
-       costheta = (x[PREV(i)].w.rad - x[i].w.rad)/x[i].s.len;/*cosine of 
special angle*/
-       x[PREV(i)].w.ang1 = phi +  acos(costheta);
-       while (x[PREV(i)].w.ang1 < 0.0)
-           x[PREV(i)].w.ang1 += 2.0*M_PI;
-       x[i].w.ang0 = x[PREV(i)].w.ang1;
-    }
-
-    /* second loop - handle concavities */
-    for (i=0;i<NW;i++) {
-       arc_angle = x[i].w.ang0 - x[i].w.ang1;
-       while (arc_angle < 0.0)
-           arc_angle += 2.0*M_PI;
-       if (arc_angle > M_PI) {
-           /* concave */
-           x[i].w.ang0 = 0.5*(x[i].w.ang0 + x[i].w.ang1);
-           x[i].w.ang1 = x[i].w.ang0;
-           x[i].w.arc = 0.0;
-       }
-       else {
-           /* convex - angles are already correct */
-           x[i].w.arc = arc_angle;
-       }
-    }
-
-    /* third loop - calculate geometry of track segments */
-    tracklen = 0.0;
-    for (i=0;i<NW;i++) {
-       /*calculate endpoints of track segment*/
-       x[i].t.pos1[0] = x[i].w.pos[0] + x[i].w.rad*cos(x[i].w.ang0);
-       x[i].t.pos1[1] = x[i].w.pos[1];
-       x[i].t.pos1[2] = x[i].w.pos[2] + x[i].w.rad*sin(x[i].w.ang0);
-       x[i].t.pos0[0] = x[PREV(i)].w.pos[0] + 
x[PREV(i)].w.rad*cos(x[PREV(i)].w.ang1);
-       x[i].t.pos0[1] = x[PREV(i)].w.pos[1];
-       x[i].t.pos0[2] = x[PREV(i)].w.pos[2] + 
x[PREV(i)].w.rad*sin(x[PREV(i)].w.ang1);
-       /*calculate length and direction*/
-       VSUB2(difference, x[i].t.pos1, x[i].t.pos0);
-       x[i].t.len = MAGNITUDE(difference);
-       VSCALE((x[i].t.dir), difference, (1.0/x[i].t.len));
-
-       /*calculate arclength and total track length*/
-       tracklen += x[i].t.len;
-       tracklen += x[i].w.arc*x[i].w.rad;
-    }
-
-    /* for a track with links already placed, get initial positions*/
-    r = (struct rlink *) bu_calloc(num_links, sizeof(struct rlink), "struct 
rlink");
-    if (links_placed)
-       for (i=0;i<num_links;i++) {
-           get_link(link_cent, &link_angle, init_dist + tracklen*i/num_links);
-           VREVERSE(r[i].pos, link_cent);
-           r[i].ang = -link_angle;
-       }
-    return 0;
-}
-
-
-int get_link(fastf_t *pos, fastf_t *angle_p, fastf_t dist)
-{
-    int i;
-    vect_t temp;
-    while (dist >= tracklen) /*periodicize*/
-       dist -= tracklen;
-    while (dist < 0.0)
-       dist += tracklen;
-    for (i=0;i<NW;i++) {
-       if ( (dist  -= x[i].t.len) < 0 ) {
-           VSCALE(temp, (x[i].t.dir), dist);
-           VADD2(pos, x[i].t.pos1, temp);
-           *angle_p = atan2(x[i].t.dir[2], x[i].t.dir[0]);
-           return 2*i;
-       }
-       if ((dist -= x[i].w.rad*x[i].w.arc) < 0) {
-           *angle_p = dist/x[i].w.rad;
-           *angle_p = x[i].w.ang1 - *angle_p; /*from x-axis to link*/
-           pos[0] = x[i].w.pos[0] + x[i].w.rad*cos(*angle_p);
-           pos[1] = x[i].w.pos[1];
-           pos[2] = x[i].w.pos[2] + x[i].w.rad*sin(*angle_p);
-           *angle_p -= M_PI_2; /*angle of clockwise tangent to circle*/
-           return 2*i+1;
-       }
-    }
-    return -1;
-}
-
-#define OPT_STR "b:d:f:i:l:pr:w:sg:m:c"
-int get_args(int argc, char **argv)
-{
-    fastf_t yaw, pch, rll;
-    void anim_dx_y_z2mat(fastf_t *, double, double, double), 
anim_dz_y_x2mat(fastf_t *, double, double, double);
-    int c, i;
-    axes = cent = links_placed = print_wheel = print_link = 0;
-    get_circumf = 0;
-    print_mode = TRACK_ANIM;
-    bu_strlcpy(link_cmd, "rarc", sizeof(link_cmd));
-    bu_strlcpy(wheel_cmd, "lmul", sizeof(wheel_cmd));
-    while ( (c=bu_getopt(argc, argv, OPT_STR)) != EOF) {
-       i=0;
-       switch (c) {
-           case 'b':
-               bu_optind -= 1;
-               sscanf(argv[bu_optind+(i++)], "%lf", &yaw );
-               sscanf(argv[bu_optind+(i++)], "%lf", &pch );
-               sscanf(argv[bu_optind+(i++)], "%lf", &rll );
-               bu_optind += 3;
-               anim_dx_y_z2mat(m_axes, rll, -pch, yaw);
-               anim_dz_y_x2mat(m_rev_axes, -rll, pch, -yaw);
-               axes = 1;
-               break;
-           case 'd':
-               bu_optind -= 1;
-               sscanf(argv[bu_optind+(i++)], "%lf", centroid);
-               sscanf(argv[bu_optind+(i++)], "%lf", centroid+1);
-               sscanf(argv[bu_optind+(i++)], "%lf", centroid+2);
-               bu_optind += 3;
-               VREVERSE(rcentroid, centroid);
-               cent = 1;
-               break;
-           case 'f':
-               sscanf(bu_optarg, "%d", &first_frame);
-               break;
-           case 'i':
-               sscanf(bu_optarg, "%lf", &init_dist);
-               break;
-           case 'p':
-               links_placed = 1;
-               break;
-           case 'r':
-               sscanf(bu_optarg, "%lf", &radius);
-               break;
-           case 'w':
-               wheel_nindex = bu_optind - 1;
-               /*sscanf(bu_optarg, "%s", wheel_name);*/
-               print_wheel = 1;
-               break;
-           case 'l':
-               sscanf(bu_optarg, "%d", &num_links);
-               link_nindex = bu_optind;
-               bu_optind += 1;
-               print_link = 1;
-               break;
-           case 's':
-               steer = 1;
-               break;
-           case 'g':
-               sscanf(bu_optarg, "%d", &arced_frame);
-               print_mode = TRACK_ARCED;
-               break;
-           case 'm':
-               switch (*bu_optarg) {
-                   case 'l':
-                       bu_strlcpy(link_cmd, argv[bu_optind], sizeof(link_cmd));
-                       break;
-                   case 'w':
-                       bu_strlcpy(wheel_cmd, argv[bu_optind], 
sizeof(wheel_cmd));
-                       break;
-                   default:
-                       fprintf(stderr, "Unknown option: -m%c\n", *bu_optarg);
-                       return 0;
-               }
-               bu_optind += 1;
-               break;
-           case 'c':
-               get_circumf = 1;
-               break;
-           default:
-               fprintf(stderr, "Unknown option: -%c\n", c);
-               return 0;
-       }
-    }
-    return 1;
-}
-
-void show_info(int which)/* for debugging - -1:track 0:both 1:link*/
-
-{
-    int i;
-    if (which <=0) {
-       fprintf(stderr, "track length: %f\n", tracklen);
-       fprintf(stderr, "link length: %f\n", tracklen/num_links);
-       for (i=0;i<NW;i++) {
-           fprintf(stderr, "wheel %d: %f %f %f %f %f %f\n", i, x[i].w.pos[0], 
x[i].w.pos[1], x[i].w.pos[2], x[i].w.rad, x[i].w.ang1, x[i].w.arc);
-           fprintf(stderr, "track %d: %f %f %f %f %f %f %f\n", i, 
x[i].t.pos1[0], x[i].t.pos1[1], x[i].t.pos1[2], x[i].t.dir[0], x[i].t.dir[1], 
x[i].t.dir[2], x[i].t.len);
-           fprintf(stderr, "slope %d: %f %f %f %f\n", i, x[i].s.dir[0], 
x[i].s.dir[1], x[i].s.dir[2], x[i].s.len);
-       }
-    }
-    /* if (which >= 0) {
-       fprintf(stderr, "%d %f %f %f %f\n", count, position[0], position[1], 
position[2], y_rot);
-       }*/
-}
-
-
 /*
  * Local Variables:
  * mode: C

Modified: brlcad/trunk/src/anim/anim_keyread.c
===================================================================
--- brlcad/trunk/src/anim/anim_keyread.c        2010-10-18 18:46:09 UTC (rev 
41053)
+++ brlcad/trunk/src/anim/anim_keyread.c        2010-10-18 18:55:22 UTC (rev 
41054)
@@ -41,13 +41,13 @@
 #include <stdio.h>
 #include <math.h>
 
-#include "vmath.h"
 #include "bu.h"
+#include "bn.h"
+#include "vmath.h"
+#include "anim.h"
 
 
-#ifndef M_PI
-#define M_PI   3.14159265358979323846
-#endif
+#define OPT_STR "yzqr"
 
 #define YPR            0
 #define XYZ            1
@@ -60,26 +60,49 @@
 #define ERROR1         1
 #define ERROR2         2
 
-#define DTOR    M_PI/180.0
-#define RTOD    180.0/M_PI
 
 int mode;
 int units;
 
-extern int bu_optind;
-extern char *bu_optarg;
 
-int get_args(int argc, char **argv);
-extern void anim_v_unpermute(fastf_t *);
+int get_args(int argc, char **argv)
+{
 
+    int c;
+
+    mode = QUATERNION; /* default */
+    units = DEGREES;
+
+    while ( (c=bu_getopt(argc, argv, OPT_STR)) != EOF) {
+       switch (c) {
+           case 'y':
+               mode = YPR;
+               break;
+           case 'z':
+               mode = XYZ;
+               break;
+           case 'q':
+               mode = QUATERNION;
+               break;
+           case 'r':
+               units = RADIANS;
+               break;
+           default:
+               fprintf(stderr, "Unknown option: -%c\n", c);
+               return 0;
+       }
+    }
+    return 1;
+}
+
+
 int
-main(int argc, char **argv)
+main(int argc, char *argv[])
 {
     int c;
     fastf_t time, viewsize;
 
     fastf_t eyept[3], viewrot[16], angle[3], quat[4];
-    int anim_mat2ypr(fastf_t *, fastf_t *), anim_mat2zyx(const fastf_t *, 
fastf_t *), anim_mat2quat(fastf_t *, const fastf_t *);
 
     if (!get_args(argc, argv))
        fprintf(stderr, "anim_keyread: get_args error");
@@ -131,39 +154,6 @@
 }
 
 
-#define OPT_STR "yzqr"
-
-int get_args(int argc, char **argv)
-{
-
-    int c;
-
-    mode = QUATERNION; /* default */
-    units = DEGREES;
-
-    while ( (c=bu_getopt(argc, argv, OPT_STR)) != EOF) {
-       switch (c) {
-           case 'y':
-               mode = YPR;
-               break;
-           case 'z':
-               mode = XYZ;
-               break;
-           case 'q':
-               mode = QUATERNION;
-               break;
-           case 'r':
-               units = RADIANS;
-               break;
-           default:
-               fprintf(stderr, "Unknown option: -%c\n", c);
-               return 0;
-       }
-    }
-    return 1;
-}
-
-
 /*
  * Local Variables:
  * mode: C

Modified: brlcad/trunk/src/anim/anim_lookat.c
===================================================================
--- brlcad/trunk/src/anim/anim_lookat.c 2010-10-18 18:46:09 UTC (rev 41053)
+++ brlcad/trunk/src/anim/anim_lookat.c 2010-10-18 18:55:22 UTC (rev 41054)
@@ -29,41 +29,55 @@
 
 #include "common.h"
 
-#include <stdio.h>
 #include <math.h>
+#include "bio.h"
 
-#include "vmath.h"
-#include "anim.h"
 #include "bu.h"
+#include "bn.h"
+#include "anim.h"
+#include "vmath.h"
 
 
-#ifndef M_PI
-#define M_PI   3.14159265358979323846
-#endif
-#ifndef RTOD
-#define RTOD   (180/M_PI)
-#endif
+#define OPT_STR "f:yqv"
 
-
 #define LOOKAT_SCRIPT  0
 #define        LOOKAT_YPR      1
 #define LOOKAT_QUAT    2
 
 
-extern int bu_optind;
-extern char *bu_optarg;
-
 int frame = 0;
 int print_mode = LOOKAT_SCRIPT;
 int print_viewsize = 0;
 
-int get_args(int argc, char **argv);
-extern void anim_dirn2mat(fastf_t *, const fastf_t *, const fastf_t *);
-extern int anim_mat2ypr(fastf_t *, fastf_t *);
-extern int anim_mat2quat(fastf_t *, const fastf_t *);
 
+int get_args(int argc, char **argv)
+{
+    int c;
+    while ( (c=bu_getopt(argc, argv, OPT_STR)) != EOF) {
+       switch (c) {
+           case 'f':
+               sscanf(bu_optarg, "%d", &frame);
+               break;
+           case 'y':
+               print_mode = LOOKAT_YPR;
+               break;
+           case 'q':
+               print_mode = LOOKAT_QUAT;
+               break;
+           case 'v':
+               print_viewsize = 1;
+               break;
+           default:
+               fprintf(stderr, "Unknown option: -%c\n", c);
+               return 0;
+       }
+    }
+    return 1;
+}
+
+
 int
-main(int argc, char **argv)
+main(int argc, char *argv[])
 {
     fastf_t time, vsize=0.0;
     vect_t eye, look, dir, angles, norm, temp;
@@ -132,34 +146,6 @@
     return 0;
 }
 
-#define OPT_STR "f:yqv"
-
-int get_args(int argc, char **argv)
-{
-    int c;
-    while ( (c=bu_getopt(argc, argv, OPT_STR)) != EOF) {
-       switch (c) {
-           case 'f':
-               sscanf(bu_optarg, "%d", &frame);
-               break;
-           case 'y':
-               print_mode = LOOKAT_YPR;
-               break;
-           case 'q':
-               print_mode = LOOKAT_QUAT;
-               break;
-           case 'v':
-               print_viewsize = 1;
-               break;
-           default:
-               fprintf(stderr, "Unknown option: -%c\n", c);
-               return 0;
-       }
-    }
-    return 1;
-}
-
-
 /*
  * Local Variables:
  * mode: C

Modified: brlcad/trunk/src/anim/anim_orient.c
===================================================================
--- brlcad/trunk/src/anim/anim_orient.c 2010-10-18 18:46:09 UTC (rev 41053)
+++ brlcad/trunk/src/anim/anim_orient.c 2010-10-18 18:55:22 UTC (rev 41054)
@@ -37,17 +37,15 @@
 #include "common.h"
 
 #include <stdlib.h>
-#include <stdio.h>
 #include <math.h>
-
 #include "bio.h"
+
+#include "bu.h"
+#include "bn.h"
+#include "anim.h"
 #include "vmath.h"
 
 
-#ifndef M_PI
-#define M_PI   3.14159265358979323846
-#endif
-
 #define YPR            0
 #define XYZ            1
 #define AET            2
@@ -61,30 +59,116 @@
 #define ANIM_ERROR1          1
 #define ANIM_ERROR2          2
 
-#define DTOR    M_PI/180.0
-#define RTOD    180.0/M_PI
 
-int            parse_args(int argc, char **argv);
-extern void    anim_y_p_r2mat(fastf_t *, double, double, double);
-extern void    anim_tran(fastf_t *);
-extern void    anim_v_unpermute(fastf_t *);
-extern void    anim_dirn2mat(fastf_t *, const fastf_t *, const fastf_t *);
-extern void    anim_v_permute(fastf_t *);
-
-extern int bu_optind;
-extern char *bu_optarg;
-
 int upright;
 int input_mode, output_mode, length, input_units, output_units;
 int input_perm, output_perm, input_inv, output_inv;
 
+
+int parse_args(int argc, char **argv)
+{
+    int c;
+    char *cp;
+
+    /* defaults */
+    upright = 0;
+    input_mode = QUAT;
+    output_mode = QUAT;
+    input_units = DEGREES;
+    output_units = DEGREES;
+    input_perm = 0;
+    output_perm = 0;
+    input_inv = 0;
+    output_inv = 0;
+    length = 4;
+
+    if (argc > 2) {
+       /*read output mode */
+       cp = argv[2];
+       while ( (c=*cp++) ) {
+           switch (c) {
+               case 'q':
+                   output_mode = QUAT;
+                   break;
+               case 'y':
+                   output_mode = YPR;
+                   break;
+               case 'a':
+                   output_mode = AET;
+                   break;
+               case 'z':
+                   output_mode = XYZ;
+                   break;
+               case 'm':
+                   output_mode = MAT;
+                   break;
+               case 'i':
+                   output_inv = 1;
+                   break;
+               case 'r':
+                   output_units = RADIANS;
+                   break;
+               case 'v':
+                   output_perm = 1;
+                   break;
+               case 'u':
+                   upright = 1;
+                   break;
+               default:
+                   fprintf(stderr, "anim_orient: unknown output option: %c\n", 
c);
+                   return 0;
+           }
+       }
+    }
+    if (argc > 1) {
+       /*read input mode */
+       cp = argv[1];
+       while ( (c=*cp++) ) {
+           switch (c) {
+               case 'q':
+                   input_mode = QUAT;
+                   length = 4;
+                   break;
+               case 'y':
+                   input_mode = YPR;
+                   length = 3;
+                   break;
+               case 'a':
+                   input_mode = AET;
+                   length = 3;
+                   break;
+               case 'z':
+                   input_mode = XYZ;
+                   length = 3;
+                   break;
+               case 'm':
+                   input_mode = MAT;
+                   length = 16;
+                   break;
+               case 'i':
+                   input_inv = 1;
+                   break;
+               case 'r':
+                   input_units = RADIANS;
+                   break;
+               case 'v':
+                   input_perm = 1;
+                   break;
+               default:
+                   fprintf(stderr, "anim_orient: unknown input option: %c\n", 
c);
+                   return 0;
+           }
+       }
+    }
+    return 1;
+}
+
+
 int
-main(int argc, char **argv)
+main(int argc, char *argv[])
 {
     int num_read;
-    fastf_t    temp[3], temp2[3], angle[3], quat[4], matrix[16];
-    void anim_zyx2mat(fastf_t *, const fastf_t *), anim_ypr2mat(fastf_t *, 
const fastf_t *), anim_quat2mat(fastf_t *, const fastf_t *), 
anim_mat_print(FILE *, const fastf_t *, int);
-    int anim_mat2ypr(fastf_t *, fastf_t *), anim_mat2zyx(const fastf_t *, 
fastf_t *), anim_mat2quat(fastf_t *, const fastf_t *);
+    fastf_t temp[3], temp2[3], angle[3], quat[4], matrix[16];
 
     if (!parse_args(argc, argv)) {
        fprintf(stderr, "Get_args error.\n");
@@ -197,104 +281,7 @@
     return 0;
 }
 
-int parse_args(int argc, char **argv)
-{
-    int c;
-    char *cp;
 
-    /* defaults */
-    upright = 0;
-    input_mode = QUAT;
-    output_mode = QUAT;
-    input_units = DEGREES;
-    output_units = DEGREES;
-    input_perm = 0;
-    output_perm = 0;
-    input_inv = 0;
-    output_inv = 0;
-    length = 4;
-
-    if (argc > 2) {
-       /*read output mode */
-       cp = argv[2];
-       while ( (c=*cp++) ) {
-           switch (c) {
-               case 'q':
-                   output_mode = QUAT;
-                   break;
-               case 'y':
-                   output_mode = YPR;
-                   break;
-               case 'a':
-                   output_mode = AET;
-                   break;
-               case 'z':
-                   output_mode = XYZ;
-                   break;
-               case 'm':
-                   output_mode = MAT;
-                   break;
-               case 'i':
-                   output_inv = 1;
-                   break;
-               case 'r':
-                   output_units = RADIANS;
-                   break;
-               case 'v':
-                   output_perm = 1;
-                   break;
-               case 'u':
-                   upright = 1;
-                   break;
-               default:
-                   fprintf(stderr, "anim_orient: unknown output option: %c\n", 
c);
-                   return 0;
-           }
-       }
-    }
-    if (argc > 1) {
-       /*read input mode */
-       cp = argv[1];
-       while ( (c=*cp++) ) {
-           switch (c) {
-               case 'q':
-                   input_mode = QUAT;
-                   length = 4;
-                   break;
-               case 'y':
-                   input_mode = YPR;
-                   length = 3;
-                   break;
-               case 'a':
-                   input_mode = AET;
-                   length = 3;
-                   break;
-               case 'z':
-                   input_mode = XYZ;
-                   length = 3;
-                   break;
-               case 'm':
-                   input_mode = MAT;
-                   length = 16;
-                   break;
-               case 'i':
-                   input_inv = 1;
-                   break;
-               case 'r':
-                   input_units = RADIANS;
-                   break;
-               case 'v':
-                   input_perm = 1;
-                   break;
-               default:
-                   fprintf(stderr, "anim_orient: unknown input option: %c\n", 
c);
-                   return 0;
-           }
-       }
-    }
-    return 1;
-}
-
 /*
  * Local Variables:
  * mode: C

Modified: brlcad/trunk/src/anim/anim_script.c
===================================================================
--- brlcad/trunk/src/anim/anim_script.c 2010-10-18 18:46:09 UTC (rev 41053)
+++ brlcad/trunk/src/anim/anim_script.c 2010-10-18 18:55:22 UTC (rev 41054)
@@ -31,8 +31,8 @@
 #include "common.h"
 
 #include <math.h>
-#include <stdio.h>
 #include <string.h>
+#include <bio.h>
 
 #include "vmath.h"
 #include "bu.h"
@@ -40,19 +40,9 @@
 #include "anim.h"
 
 
-#ifndef M_PI
-#define M_PI   3.14159265358979323846
-#endif
+#define OPT_STR        "a:b:c:d:f:m:pqrstv:"
 
-int            get_args(int argc, char **argv);
-extern int     anim_steer_mat(fastf_t *, fastf_t *, int);
-extern void    anim_quat2mat(fastf_t *, const fastf_t *);
-extern void    anim_v_unpermute(fastf_t *);
-extern void    anim_mat_print(FILE *, const fastf_t *, int);
 
-extern int bu_optind;
-extern char *bu_optarg;
-
 /* info from command line args */
 int relative_a, relative_c, axes, translate, quaternion, rotate;/*flags*/
 int steer, view, readview, permute; /* flags*/
@@ -62,10 +52,104 @@
 mat_t m_axes, m_rev_axes; /* rotational analogue of centroid */
 char mat_cmd[10];   /* default is lmul */
 
+
+int get_args(int argc, char **argv)
+{
+
+    int c, i, yes;
+    double yaw, pch, rll;
+    void anim_dx_y_z2mat(fastf_t *, double, double, double), 
anim_dz_y_x2mat(fastf_t *, double, double, double);
+    rotate = translate = 1; /* defaults */
+    quaternion = permute = 0;
+    bu_strlcpy(mat_cmd, "lmul", sizeof(mat_cmd));
+    while ( (c=bu_getopt(argc, argv, OPT_STR)) != EOF) {
+       i=0;
+       switch (c) {
+           case 'a':
+               bu_optind -= 1;
+               sscanf(argv[bu_optind+(i++)], "%lf", &yaw );
+               sscanf(argv[bu_optind+(i++)], "%lf", &pch );
+               sscanf(argv[bu_optind+(i++)], "%lf", &rll );
+               bu_optind += 3;
+               anim_dx_y_z2mat(m_axes, rll, -pch, yaw);
+               anim_dz_y_x2mat(m_rev_axes, -rll, pch, -yaw);
+               axes = 1;
+               relative_a = 1;
+               break;
+           case 'b':
+               bu_optind -= 1;
+               sscanf(argv[bu_optind+(i++)], "%lf", &yaw );
+               sscanf(argv[bu_optind+(i++)], "%lf", &pch );
+               sscanf(argv[bu_optind+(i++)], "%lf", &rll );
+               bu_optind += 3;
+               anim_dx_y_z2mat(m_axes, rll, -pch, yaw);
+               anim_dz_y_x2mat(m_rev_axes, -rll, pch, -yaw);
+               axes = 1;
+               relative_a = 0;
+               break;
+           case 'c':
+               bu_optind -= 1;
+               sscanf(argv[bu_optind+(i++)], "%lf", centroid);
+               sscanf(argv[bu_optind+(i++)], "%lf", centroid+1);
+               sscanf(argv[bu_optind+(i++)], "%lf", centroid+2);
+               bu_optind += 3;
+               VREVERSE(rcentroid, centroid);
+               relative_c = 1;
+               break;
+           case 'd':
+               bu_optind -= 1;
+               sscanf(argv[bu_optind+(i++)], "%lf", centroid);
+               sscanf(argv[bu_optind+(i++)], "%lf", centroid+1);
+               sscanf(argv[bu_optind+(i++)], "%lf", centroid+2);
+               bu_optind += 3;
+               VREVERSE(rcentroid, centroid);
+               relative_c = 0;
+               break;
+           case 'f':
+               sscanf(bu_optarg, "%d", &first_frame);
+               break;
+           case 'm':
+               bu_strlcpy(mat_cmd, bu_optarg, sizeof(mat_cmd));
+               break;
+           case 'p':
+               permute = 1;
+               break;
+           case 'q':
+               quaternion = 1;
+               break;
+           case 'r':
+               rotate = 1;
+               translate = 0;
+               break;
+           case 's':
+               steer = 1;
+               relative_a = 0;
+               rotate = 0;
+               translate = 1;
+               break;
+           case 't':
+               translate = 1;
+               rotate = 0;
+               break;
+           case 'v':
+               yes = sscanf(bu_optarg, "%lf", &viewsize);
+               if (!yes) viewsize = 0.0;
+               if (viewsize < 0.0)
+                   readview = 1;
+               view = 1;
+               break;
+           default:
+               fprintf(stderr, "Unknown option: -%c\n", c);
+               return 0;
+       }
+    }
+    return 1;
+}
+
+
 int
-main(int argc, char **argv)
+main(int argc, char *argv[])
 {
-    void anim_dx_y_z2mat(fastf_t *, double, double, double), 
anim_add_trans(fastf_t *, const fastf_t *, const fastf_t *);
     fastf_t yaw, pitch, roll;
     vect_t point, zero;
     quat_t quat;
@@ -174,102 +258,7 @@
     return 0;
 }
 
-#define OPT_STR        "a:b:c:d:f:m:pqrstv:"
 
-int get_args(int argc, char **argv)
-{
-
-    int c, i, yes;
-    double yaw, pch, rll;
-    void anim_dx_y_z2mat(fastf_t *, double, double, double), 
anim_dz_y_x2mat(fastf_t *, double, double, double);
-    rotate = translate = 1; /* defaults */
-    quaternion = permute = 0;
-    bu_strlcpy(mat_cmd, "lmul", sizeof(mat_cmd));
-    while ( (c=bu_getopt(argc, argv, OPT_STR)) != EOF) {
-       i=0;
-       switch (c) {
-           case 'a':
-               bu_optind -= 1;
-               sscanf(argv[bu_optind+(i++)], "%lf", &yaw );
-               sscanf(argv[bu_optind+(i++)], "%lf", &pch );
-               sscanf(argv[bu_optind+(i++)], "%lf", &rll );
-               bu_optind += 3;
-               anim_dx_y_z2mat(m_axes, rll, -pch, yaw);
-               anim_dz_y_x2mat(m_rev_axes, -rll, pch, -yaw);
-               axes = 1;
-               relative_a = 1;
-               break;
-           case 'b':
-               bu_optind -= 1;
-               sscanf(argv[bu_optind+(i++)], "%lf", &yaw );
-               sscanf(argv[bu_optind+(i++)], "%lf", &pch );
-               sscanf(argv[bu_optind+(i++)], "%lf", &rll );
-               bu_optind += 3;
-               anim_dx_y_z2mat(m_axes, rll, -pch, yaw);
-               anim_dz_y_x2mat(m_rev_axes, -rll, pch, -yaw);
-               axes = 1;
-               relative_a = 0;
-               break;
-           case 'c':
-               bu_optind -= 1;
-               sscanf(argv[bu_optind+(i++)], "%lf", centroid);
-               sscanf(argv[bu_optind+(i++)], "%lf", centroid+1);
-               sscanf(argv[bu_optind+(i++)], "%lf", centroid+2);
-               bu_optind += 3;
-               VREVERSE(rcentroid, centroid);
-               relative_c = 1;
-               break;
-           case 'd':
-               bu_optind -= 1;
-               sscanf(argv[bu_optind+(i++)], "%lf", centroid);
-               sscanf(argv[bu_optind+(i++)], "%lf", centroid+1);
-               sscanf(argv[bu_optind+(i++)], "%lf", centroid+2);
-               bu_optind += 3;
-               VREVERSE(rcentroid, centroid);
-               relative_c = 0;
-               break;
-           case 'f':
-               sscanf(bu_optarg, "%d", &first_frame);
-               break;
-           case 'm':
-               bu_strlcpy(mat_cmd, bu_optarg, sizeof(mat_cmd));
-               break;
-           case 'p':
-               permute = 1;
-               break;
-           case 'q':
-               quaternion = 1;
-               break;
-           case 'r':
-               rotate = 1;
-               translate = 0;
-               break;
-           case 's':
-               steer = 1;
-               relative_a = 0;
-               rotate = 0;
-               translate = 1;
-               break;
-           case 't':
-               translate = 1;
-               rotate = 0;
-               break;
-           case 'v':
-               yes = sscanf(bu_optarg, "%lf", &viewsize);
-               if (!yes) viewsize = 0.0;
-               if (viewsize < 0.0)
-                   readview = 1;
-               view = 1;
-               break;
-           default:
-               fprintf(stderr, "Unknown option: -%c\n", c);
-               return 0;
-       }
-    }
-    return 1;
-}
-
-
 /*
  * Local Variables:
  * mode: C

Modified: brlcad/trunk/src/anim/anim_track.c
===================================================================
--- brlcad/trunk/src/anim/anim_track.c  2010-10-18 18:46:09 UTC (rev 41053)
+++ brlcad/trunk/src/anim/anim_track.c  2010-10-18 18:55:22 UTC (rev 41054)
@@ -28,14 +28,17 @@
 #include "common.h"
 
 #include <math.h>
-#include <stdio.h>
 #include <string.h>
+#include "bio.h"
 
-#include "vmath.h"
-#include "raytrace.h"
+#include "bu.h"
+#include "bn.h"
 #include "anim.h"
+#include "vmath.h"
 
 
+#define OPT_STR "sycuvb:d:f:i:r:p:w:g:m:l:a"
+
 #define GIVEN          0
 #define CALCULATED     1
 #define STEERED                2
@@ -51,6 +54,8 @@
 #define NW     num_wheels
 #define NEXT(i)        (i+1)%NW
 #define PREV(i)        (i+NW-1)%NW
+
+
 typedef double *pdouble;
 
 struct wheel {
@@ -79,9 +84,6 @@
     struct slope       s;      /* vector between this axle and the previous 
axle */
 };
 
-/* external variables */
-extern int bu_optind;
-extern char *bu_optarg;
 
 /* variables describing track geometry - used by main, trackprep, get_link*/
 struct all *x;
@@ -112,257 +114,12 @@
 int len_mode;          /* mode for track_len */
 int anti_strobe;       /* flag: take measures against strobing effect */
 
-int
-main(int argc, char **argv)
-{
-    void anim_y_p_r2mat(fastf_t *, double, double, double), 
anim_add_trans(fastf_t *, const fastf_t *, const fastf_t *), 
anim_mat_print(FILE *, const fastf_t *, int);
-    int get_args(int argc, char **argv), get_link(fastf_t *pos, fastf_t 
*angle_p, fastf_t dist), track_prep(void), val, frame, i, count;
-    int go;
-    fastf_t y_rot, distance, yaw, pch, roll;
-    vect_t cent_pos, wheel_now, wheel_prev;
-    vect_t zero, position, vdelta, temp, to_track, to_front;
-    mat_t wmat, mat_x;
-    FILE *stream;
-    struct wheel *wh;
-    int last_steer, last_frame;
-    int rndtabi=0;
-    fastf_t halfpadlen, delta, prev_dist;
 
-    VSETALL(zero, 0.0);
-    VSETALL(to_track, 0.0);
-    VSETALL(centroid, 0.0);
-    VSETALL(rcentroid, 0.0);
-    y_rot = 0.0;
-    num_wheels = 0;
-    last_steer = last_frame = 0;
-    MAT_IDN(mat_x);
-    MAT_IDN(wmat);
-    MAT_IDN(m_axes);
-    MAT_IDN(m_rev_axes);
-
-    if (!get_args(argc, argv))
-       fprintf(stderr, "Anim_track: Argument error.\n");
-
-    if (axes || cent ) {
-       /* vehicle has own reference frame */
-       anim_add_trans(m_axes, centroid, zero);
-       anim_add_trans(m_rev_axes, zero, rcentroid);
-    }
-
-    /* get track information from specified file */
-
-    if (!(stream = fopen(*(argv+bu_optind), "rb"))) {
-       fprintf(stderr, "Track: Could not open file %s.\n", *(argv+bu_optind));
-       return 0;
-    }
-    num_wheels = -1;
-    if (one_radius) {
-       while (!feof(stream)) {
-           fscanf(stream, "%*f %*f %*f");
-           num_wheels++;
-       }
-    } else {
-       while (!feof(stream)) {
-           fscanf(stream, "%*f %*f %*f %*f");
-           num_wheels++;
-       }
-    }
-    rewind(stream);
-
-
-    /*allocate memory for track information*/
-    /* x: contains track geometry for the current frame */
-    x = (struct all *) bu_calloc(num_wheels, sizeof(struct all), "x all");
-    /* wh: contains geometry of wheels in mged database */
-    wh = (struct wheel *) bu_calloc(num_wheels, sizeof(struct wheel), "wh 
wheel");
-
-    /*read original wheel positions*/
-    for (i=0;i<NW;i++) {
-       fscanf(stream, "%lf %lf %lf", temp, temp+1, temp+2);
-       if (one_radius)
-           x[i].w.rad = radius;
-       else
-           fscanf(stream, "%lf", & x[i].w.rad);
-       MAT4X3PNT(x[i].w.pos, m_rev_axes, temp);
-       if (i==0)
-           track_y = x[0].w.pos[1];
-       else
-           x[i].w.pos[1] = track_y;
-
-
-       wh[i].pos[0] = x[i].w.pos[0];
-       wh[i].pos[1] = x[i].w.pos[1];
-       wh[i].pos[2] = x[i].w.pos[2];
-       wh[i].rad = x[i].w.rad;
-    }
-    (void) fclose(stream);
-
-    /* initialize to_track */
-    VSET(to_track, 0.0, track_y, 0.0);
-    VSET(to_front, 1.0, 0.0, 0.0);
-
-    if (get_circumf&& (!read_wheels)) {
-       track_prep();
-       printf("%.10g\n", tracklen);
-       return 0;
-    }
-
-
-    if (dist_mode==STEERED) {
-       /* prime the pumps */
-       scanf("%*f");/*time*/
-       val = scanf("%lf %lf %lf", cent_pos, cent_pos+1, cent_pos + 2);
-       if (val < 3)
-           return 0;
-       go = anim_steer_mat(mat_x, cent_pos, 0);
-       last_steer = 0;
-    } else {
-       go = 1;
-    }
-
-    if (anti_strobe) {
-       BN_RANDSEED(rndtabi, 0);
-    }
-
-    /* main loop */
-    prev_dist = distance = 0.0;
-    frame = first_frame;
-    for (; ; frame++) {
-       if (dist_mode==GIVEN) {
-           scanf("%*f");/*time*/
-           val = scanf("%lf", &distance);
-           if (val < 1) {
-               break;
-           }
-       }
-       else if (dist_mode==CALCULATED) {
-           scanf("%*f");/*time*/
-           scanf("%lf %lf %lf", cent_pos, cent_pos+1, cent_pos+2);
-           val = scanf("%lf %lf %lf", &yaw, &pch, &roll);
-           if (val < 3)
-               break;
-           anim_dy_p_r2mat(mat_x, yaw, pch, roll);
-           anim_dy_p_r2mat(mat_x, yaw, pch, roll);
-           anim_add_trans(mat_x, cent_pos, rcentroid);
-       }
-
-       if (read_wheels) {
-           /* read in all wheel positions */
-           for (i=0;i<NW;i++) {
-               val=scanf("%lf %lf", x[i].w.pos, x[i].w.pos + 2);
-               if (val < 2) {
-                   break;
-               }
-           }
-       }
-
-       if (dist_mode==STEERED) {
-           scanf("%*f");/*time*/
-           val = scanf("%lf %lf %lf", cent_pos, cent_pos+1, cent_pos + 2);
-           if (val < 3) {
-               if (last_steer)
-                   break;
-               else
-                   last_steer = 1;
-           }
-           go = anim_steer_mat(mat_x, cent_pos, last_steer);
-           anim_add_trans(mat_x, cent_pos, rcentroid);
-       }
-
-       /* call track_prep to calculate geometry of track */
-       if ((frame==first_frame)||read_wheels) {
-           if ((track_prep())==-1) {
-               fprintf(stderr, "Track: error in frame %d: track too short.\n", 
frame);
-               break;
-           }
-           if (get_circumf) {
-               printf("%d\t%.10g\n", frame, tracklen);
-           }
-       }
-
-
-       if ((dist_mode==CALCULATED)||(dist_mode==STEERED)) {
-           /*determine distance traveled*/
-           VMOVE(wheel_prev, wheel_now);
-           MAT4X3PNT(wheel_now, mat_x, to_track);
-           if (frame > first_frame) {
-               /* increment distance by distance moved*/
-               VSUB2(vdelta, wheel_now, wheel_prev);
-               MAT3X3VEC(temp, mat_x, to_front);/*new front of vehicle*/
-               distance += VDOT(temp, vdelta);/*portion of vdelta in line with 
track*/
-           }
-       }
-
-       if (anti_strobe) {
-           halfpadlen = 0.5 * tracklen/(fastf_t) num_links;
-           delta = distance - prev_dist;
-           prev_dist = distance;
-           if ((delta >= halfpadlen)||(delta <= -halfpadlen)) {
-               distance += BN_RANDOM(rndtabi) * 2.0* halfpadlen;
-           }
-       }
-
-       if (go && (!get_circumf)) {
-           if (print_mode==PRINT_ANIM) {
-               printf("start %d;\nclean;\n", frame);
-           } else if (print_mode==PRINT_ARCED) {
-               if (frame != arced_frame) continue;
-               last_frame = 1;
-           }
-           if (print_link) {
-               for (count=0;count<num_links;count++) {
-                   (void) get_link(position, &y_rot, 
distance+tracklen*count/num_links+init_dist);
-                   anim_y_p_r2mat(wmat, 0.0, y_rot, 0.0);
-                   anim_add_trans(wmat, position, zero);
-                   if (axes || cent) {
-                       /* link moved to vehicle coords */
-                       MAT_MOVE(mat_x, wmat);
-                       bn_mat_mul(wmat, m_axes, mat_x);
-                   }
-                   if (print_mode==PRINT_ANIM) {
-                       printf("anim %s%d matrix %s\n", *(argv+link_nindex), 
count, link_cmd);
-                       anim_mat_printf(stdout, wmat, "%.10g ", "\n", ";\n");
-                   } else if (print_mode==PRINT_ARCED) {
-                       printf("arced %s%d matrix %s ", *(argv+link_nindex), 
count, link_cmd);
-                       anim_mat_printf(stdout, wmat, "%.10g ", "", "\n");
-                   }
-               }
-           }
-           if (print_wheel) {
-               for (count = 0;count<num_wheels;count++) {
-                   anim_y_p_r2mat(wmat, 0.0, -distance/wh[count].rad, 0.0);
-                   VREVERSE(temp, wh[count].pos);
-                   anim_add_trans(wmat, x[count].w.pos, temp);
-                   if (axes || cent) {
-                       bn_mat_mul(mat_x, wmat, m_rev_axes);
-                       bn_mat_mul(wmat, m_axes, mat_x);
-                   }
-                   if (print_mode==PRINT_ANIM) {
-                       printf("anim %s%d matrix %s\n", *(argv+wheel_nindex), 
count, wheel_cmd);
-                       anim_mat_printf(stdout, wmat, "%.10g ", "\n", ";\n");
-                   } else if (print_mode==PRINT_ARCED) {
-                       printf("arced %s%d matrix %s ", *(argv+wheel_nindex), 
count, wheel_cmd);
-                       anim_mat_printf(stdout, wmat, "%.10g ", "", "\n");
-                   }
-               }
-           }
-           if (print_mode==PRINT_ANIM)
-               printf("end;\n");
-       }
-       if (last_frame) break;
-    }
-    bu_free(x, "x all");
-    bu_free(wh, "wh wheel");
-    return 0;
-}
-
-#define OPT_STR "sycuvb:d:f:i:r:p:w:g:m:l:a"
-
 int get_args(int argc, char **argv)
 {
     int c, i;
     fastf_t yaw, pch, rll;
-    void anim_dx_y_z2mat(fastf_t *, double, double, double), 
anim_dz_y_x2mat(fastf_t *, double, double, double);
+
     /* defaults*/
     wheel_nindex = link_nindex = 0;
     axes = cent = print_wheel = print_link = 0;
@@ -491,6 +248,7 @@
     return 1;
 }
 
+
 /* TRACK_PREP - Calculate the geometry of the track. Wheel positions and
  * radii should already exist in the x[i] structs. Track_prep fills in the
  * rest of the x[i] structs and also calculates values for curve_a, curve_b,
@@ -498,7 +256,8 @@
  * return values: 0 = GOOD
  *              -1 = BAD. Track too short to fit around wheels
  */
-int track_prep(void)
+int
+track_prep(void)
 {
     int i;
     fastf_t phi, costheta, arc_angle;
@@ -606,11 +365,13 @@
     return 0; /*good*/
 }
 
+
 /* GET_LINK - Find the position and angle of a link which is a given
  * distance around the track, measured from the point where the caternary
  * section meets wheel.0.
  */
-int get_link(fastf_t *pos, fastf_t *angle_p, fastf_t dist)
+int
+get_link(fastf_t *pos, fastf_t *angle_p, fastf_t dist)
 {
     int i;
     vect_t temp;
@@ -660,27 +421,249 @@
     return -1;
 }
 
-void show_info(int which)/* for debugging - -1:track 0:both 1:link*/
 
+int
+main(int argc, char *argv[])
 {
-    int i;
-    if (which <=0) {
-       fprintf(stderr, "track length: %f\n", tracklen);
-       fprintf(stderr, "link length: %f\n", tracklen/num_links);
-       for (i=0;i<NW;i++) {
-           fprintf(stderr, "wheel %d: \n", i);
-           fprintf(stderr, " pos\t%f\t%f\t%f\t\n", x[i].w.pos[X], 
x[i].w.pos[Y], x[i].w.pos[Z]);
-           fprintf(stderr, " rad\t%f\tang0\t%f\tang1\t%f\tarc\t%f\n", 
x[i].w.rad, x[i].w.ang0, x[i].w.ang1, x[i].w.arc);
+    int val, frame, i, count;
+    int go;
+    fastf_t y_rot, distance, yaw, pch, roll;
+    vect_t cent_pos, wheel_now, wheel_prev;
+    vect_t zero, position, vdelta, temp, to_track, to_front;
+    mat_t wmat, mat_x;
+    FILE *stream;
+    struct wheel *wh;
+    int last_steer, last_frame;
+    int rndtabi=0;
+    fastf_t halfpadlen, delta, prev_dist;
 
-           fprintf(stderr, "track %d: \n", i);
-           fprintf(stderr, " pos0\t%f\t%f\tpos1\t%f\t%f\n", x[i].t.pos0[X], 
x[i].t.pos0[Z], x[i].t.pos1[X], x[i].t.pos1[Z]);
-           fprintf(stderr, " dir\t%f\t%f\t%f\tlen\t%f\n", x[i].t.dir[X], 
x[i].t.dir[Y], x[i].t.dir[Z], x[i].t.len);
-           fprintf(stderr, "slope %d: %f %f %f %f\n", i, x[i].s.dir[0], 
x[i].s.dir[1], x[i].s.dir[2], x[i].s.len);
+    VSETALL(zero, 0.0);
+    VSETALL(to_track, 0.0);
+    VSETALL(centroid, 0.0);
+    VSETALL(rcentroid, 0.0);
+    y_rot = 0.0;
+    num_wheels = 0;
+    last_steer = last_frame = 0;
+    MAT_IDN(mat_x);
+    MAT_IDN(wmat);
+    MAT_IDN(m_axes);
+    MAT_IDN(m_rev_axes);
+
+    if (!get_args(argc, argv))
+       fprintf(stderr, "Anim_track: Argument error.\n");
+
+    if (axes || cent ) {
+       /* vehicle has own reference frame */
+       anim_add_trans(m_axes, centroid, zero);
+       anim_add_trans(m_rev_axes, zero, rcentroid);
+    }
+
+    /* get track information from specified file */
+
+    if (!(stream = fopen(*(argv+bu_optind), "rb"))) {
+       fprintf(stderr, "Track: Could not open file %s.\n", *(argv+bu_optind));
+       return 0;
+    }
+    num_wheels = -1;
+    if (one_radius) {
+       while (!feof(stream)) {
+           fscanf(stream, "%*f %*f %*f");
+           num_wheels++;
        }
+    } else {
+       while (!feof(stream)) {
+           fscanf(stream, "%*f %*f %*f %*f");
+           num_wheels++;
+       }
     }
-    /* if (which >= 0) {
-       fprintf(stderr, "%d %f %f %f %f\n", count, position[0], position[1], 
position[2], y_rot);
-       }*/
+    rewind(stream);
+
+
+    /*allocate memory for track information*/
+    /* x: contains track geometry for the current frame */
+    x = (struct all *) bu_calloc(num_wheels, sizeof(struct all), "x all");
+    /* wh: contains geometry of wheels in mged database */
+    wh = (struct wheel *) bu_calloc(num_wheels, sizeof(struct wheel), "wh 
wheel");
+
+    /*read original wheel positions*/
+    for (i=0;i<NW;i++) {
+       fscanf(stream, "%lf %lf %lf", temp, temp+1, temp+2);
+       if (one_radius)
+           x[i].w.rad = radius;
+       else
+           fscanf(stream, "%lf", & x[i].w.rad);
+       MAT4X3PNT(x[i].w.pos, m_rev_axes, temp);
+       if (i==0)
+           track_y = x[0].w.pos[1];
+       else
+           x[i].w.pos[1] = track_y;
+
+
+       wh[i].pos[0] = x[i].w.pos[0];
+       wh[i].pos[1] = x[i].w.pos[1];
+       wh[i].pos[2] = x[i].w.pos[2];
+       wh[i].rad = x[i].w.rad;
+    }
+    (void) fclose(stream);
+
+    /* initialize to_track */
+    VSET(to_track, 0.0, track_y, 0.0);
+    VSET(to_front, 1.0, 0.0, 0.0);
+
+    if (get_circumf&& (!read_wheels)) {
+       track_prep();
+       printf("%.10g\n", tracklen);
+       return 0;
+    }
+
+
+    if (dist_mode==STEERED) {
+       /* prime the pumps */
+       scanf("%*f");/*time*/
+       val = scanf("%lf %lf %lf", cent_pos, cent_pos+1, cent_pos + 2);
+       if (val < 3)
+           return 0;
+       go = anim_steer_mat(mat_x, cent_pos, 0);
+       last_steer = 0;
+    } else {
+       go = 1;
+    }
+
+    if (anti_strobe) {
+       BN_RANDSEED(rndtabi, 0);
+    }
+
+    /* main loop */
+    prev_dist = distance = 0.0;
+    frame = first_frame;
+    for (; ; frame++) {
+       if (dist_mode==GIVEN) {
+           scanf("%*f");/*time*/
+           val = scanf("%lf", &distance);
+           if (val < 1) {
+               break;
+           }
+       }
+       else if (dist_mode==CALCULATED) {
+           scanf("%*f");/*time*/
+           scanf("%lf %lf %lf", cent_pos, cent_pos+1, cent_pos+2);
+           val = scanf("%lf %lf %lf", &yaw, &pch, &roll);
+           if (val < 3)
+               break;
+           anim_dy_p_r2mat(mat_x, yaw, pch, roll);
+           anim_dy_p_r2mat(mat_x, yaw, pch, roll);
+           anim_add_trans(mat_x, cent_pos, rcentroid);
+       }
+
+       if (read_wheels) {
+           /* read in all wheel positions */
+           for (i=0;i<NW;i++) {
+               val=scanf("%lf %lf", x[i].w.pos, x[i].w.pos + 2);
+               if (val < 2) {
+                   break;
+               }
+           }
+       }
+
+       if (dist_mode==STEERED) {
+           scanf("%*f");/*time*/
+           val = scanf("%lf %lf %lf", cent_pos, cent_pos+1, cent_pos + 2);
+           if (val < 3) {
+               if (last_steer)
+                   break;
+               else
+                   last_steer = 1;
+           }
+           go = anim_steer_mat(mat_x, cent_pos, last_steer);
+           anim_add_trans(mat_x, cent_pos, rcentroid);
+       }
+
+       /* call track_prep to calculate geometry of track */
+       if ((frame==first_frame)||read_wheels) {
+           if ((track_prep())==-1) {
+               fprintf(stderr, "Track: error in frame %d: track too short.\n", 
frame);
+               break;
+           }
+           if (get_circumf) {
+               printf("%d\t%.10g\n", frame, tracklen);
+           }
+       }
+
+
+       if ((dist_mode==CALCULATED)||(dist_mode==STEERED)) {
+           /*determine distance traveled*/
+           VMOVE(wheel_prev, wheel_now);
+           MAT4X3PNT(wheel_now, mat_x, to_track);
+           if (frame > first_frame) {
+               /* increment distance by distance moved*/
+               VSUB2(vdelta, wheel_now, wheel_prev);
+               MAT3X3VEC(temp, mat_x, to_front);/*new front of vehicle*/
+               distance += VDOT(temp, vdelta);/*portion of vdelta in line with 
track*/
+           }
+       }
+
+       if (anti_strobe) {
+           halfpadlen = 0.5 * tracklen/(fastf_t) num_links;
+           delta = distance - prev_dist;
+           prev_dist = distance;
+           if ((delta >= halfpadlen)||(delta <= -halfpadlen)) {
+               distance += BN_RANDOM(rndtabi) * 2.0* halfpadlen;
+           }
+       }
+
+       if (go && (!get_circumf)) {
+           if (print_mode==PRINT_ANIM) {
+               printf("start %d;\nclean;\n", frame);
+           } else if (print_mode==PRINT_ARCED) {
+               if (frame != arced_frame) continue;
+               last_frame = 1;
+           }
+           if (print_link) {
+               for (count=0;count<num_links;count++) {
+                   (void) get_link(position, &y_rot, 
distance+tracklen*count/num_links+init_dist);
+                   anim_y_p_r2mat(wmat, 0.0, y_rot, 0.0);
+                   anim_add_trans(wmat, position, zero);
+                   if (axes || cent) {
+                       /* link moved to vehicle coords */
+                       MAT_MOVE(mat_x, wmat);
+                       bn_mat_mul(wmat, m_axes, mat_x);
+                   }
+                   if (print_mode==PRINT_ANIM) {
+                       printf("anim %s%d matrix %s\n", *(argv+link_nindex), 
count, link_cmd);
+                       anim_mat_printf(stdout, wmat, "%.10g ", "\n", ";\n");
+                   } else if (print_mode==PRINT_ARCED) {
+                       printf("arced %s%d matrix %s ", *(argv+link_nindex), 
count, link_cmd);
+                       anim_mat_printf(stdout, wmat, "%.10g ", "", "\n");
+                   }
+               }
+           }
+           if (print_wheel) {
+               for (count = 0;count<num_wheels;count++) {
+                   anim_y_p_r2mat(wmat, 0.0, -distance/wh[count].rad, 0.0);
+                   VREVERSE(temp, wh[count].pos);
+                   anim_add_trans(wmat, x[count].w.pos, temp);
+                   if (axes || cent) {
+                       bn_mat_mul(mat_x, wmat, m_rev_axes);
+                       bn_mat_mul(wmat, m_axes, mat_x);
+                   }
+                   if (print_mode==PRINT_ANIM) {
+                       printf("anim %s%d matrix %s\n", *(argv+wheel_nindex), 
count, wheel_cmd);
+                       anim_mat_printf(stdout, wmat, "%.10g ", "\n", ";\n");
+                   } else if (print_mode==PRINT_ARCED) {
+                       printf("arced %s%d matrix %s ", *(argv+wheel_nindex), 
count, wheel_cmd);
+                       anim_mat_printf(stdout, wmat, "%.10g ", "", "\n");
+                   }
+               }
+           }
+           if (print_mode==PRINT_ANIM)
+               printf("end;\n");
+       }
+       if (last_frame) break;
+    }
+    bu_free(x, "x all");
+    bu_free(wh, "wh wheel");
+
+    return 0;
 }
 
 

Modified: brlcad/trunk/src/anim/anim_turn.c
===================================================================
--- brlcad/trunk/src/anim/anim_turn.c   2010-10-18 18:46:09 UTC (rev 41053)
+++ brlcad/trunk/src/anim/anim_turn.c   2010-10-18 18:55:22 UTC (rev 41054)
@@ -32,38 +32,64 @@
 #include "common.h"
 
 #include <math.h>
-#include <stdio.h>
+#include "bio.h"
 
-#include "vmath.h"
 #include "bu.h"
+#include "bn.h"
 #include "anim.h"
+#include "vmath.h"
 
 
-#ifndef M_PI
-#define M_PI   3.14159265358979323846
-#endif
+#define OPT_STR "r:l:a:f:p:"
 
-int            get_args(int argc, char **argv);
-extern void    anim_y_p_r2mat(fastf_t *, double, double, double);
-extern void    anim_add_trans(fastf_t *, const fastf_t *, const fastf_t *);
 
-extern int bu_optind;
-extern char *bu_optarg;
-
 int print_int = 1;
 int angle_set = 0;
 int turn_wheels = 0;
 fastf_t length, angle, radius;
 fastf_t factor = 1.0;
 
+
+int get_args(int argc, char **argv)
+{
+    int c;
+    while ( (c=bu_getopt(argc, argv, OPT_STR)) != EOF) {
+       switch (c) {
+           case 'l':
+               sscanf(bu_optarg, "%lf", &length);
+               break;
+           case 'a':
+               sscanf(bu_optarg, "%lf", &angle);
+               angle *= DTOR; /* degrees to radians */
+               angle_set = 1;
+               break;
+           case 'r':
+               sscanf(bu_optarg, "%lf", &radius);
+               turn_wheels = 1;
+               break;
+           case 'f':
+               turn_wheels = 1;
+               sscanf(bu_optarg, "%lf", &factor);
+               break;
+           case 'p':
+               sscanf(bu_optarg, "%d", &print_int);
+               break;
+           default:
+               fprintf(stderr, "Unknown option: -%c\n", c);
+               return 0;
+       }
+    }
+    return 1;
+}
+
+
 int
-main(int argc, char **argv)
+main(int argc, char *argv[])
 {
     int count;
     fastf_t val, time, roll_ang, yaw, sign;
     vect_t v, point, front, back, zero, temp1, temp2;
     mat_t m_from_world, m_to_world;
-    double bn_atan2(double, double);
 
     /* initialize variables */
     VSETALL(zero, 0.0);
@@ -156,41 +182,7 @@
     return 0;
 }
 
-#define OPT_STR "r:l:a:f:p:"
 
-int get_args(int argc, char **argv)
-{
-    int c;
-    while ( (c=bu_getopt(argc, argv, OPT_STR)) != EOF) {
-       switch (c) {
-           case 'l':
-               sscanf(bu_optarg, "%lf", &length);
-               break;
-           case 'a':
-               sscanf(bu_optarg, "%lf", &angle);
-               angle *= DTOR; /* degrees to radians */
-               angle_set = 1;
-               break;
-           case 'r':
-               sscanf(bu_optarg, "%lf", &radius);
-               turn_wheels = 1;
-               break;
-           case 'f':
-               turn_wheels = 1;
-               sscanf(bu_optarg, "%lf", &factor);
-               break;
-           case 'p':
-               sscanf(bu_optarg, "%d", &print_int);
-               break;
-           default:
-               fprintf(stderr, "Unknown option: -%c\n", c);
-               return 0;
-       }
-    }
-    return 1;
-}
-
-
 /*
  * Local Variables:
  * mode: C


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to