Revision: 47220
          http://brlcad.svn.sourceforge.net/brlcad/?rev=47220&view=rev
Author:   abhi2011
Date:     2011-10-13 11:03:51 +0000 (Thu, 13 Oct 2011)
Log Message:
-----------
Corrected some indentations in the code

Modified Paths:
--------------
    brlcad/trunk/src/libged/simulate/simrt.c
    brlcad/trunk/src/libged/simulate/simrt.h
    brlcad/trunk/src/libged/simulate/simulate.c
    brlcad/trunk/src/libged/simulate/simutils.c
    brlcad/trunk/src/libged/simulate/simutils.h

Modified: brlcad/trunk/src/libged/simulate/simrt.c
===================================================================
--- brlcad/trunk/src/libged/simulate/simrt.c    2011-10-13 04:44:10 UTC (rev 
47219)
+++ brlcad/trunk/src/libged/simulate/simrt.c    2011-10-13 11:03:51 UTC (rev 
47220)
@@ -43,26 +43,26 @@
 
     bu_log("print_rayshot_results: -------\n");
 
-       bu_log("X bounds xr_min_x_x:%f, xr_min_x_y:%f, xr_min_x_z:%f \n",
-                  rt_result.xr_min_x_x,
-                  rt_result.xr_min_x_y,
-                  rt_result.xr_min_x_z);
-       bu_log("X bounds xr_max_x_x:%f, xr_max_x_y:%f, xr_max_x_z:%f \n",
-                          rt_result.xr_max_x_x,
-                          rt_result.xr_max_x_y,
-                          rt_result.xr_max_x_z);
-       bu_log("Y bounds xr_min_y:%f, xr_min_y_z:%f\n",
-                          rt_result.xr_min_y,
-                          rt_result.xr_min_y_z);
-       bu_log("Y bounds xr_max_y:%f, xr_max_y_z:%f\n",
-                                  rt_result.xr_max_y,
-                                  rt_result.xr_max_y_z);
-       bu_log("Z bounds xr_min_z:%f, xr_min_z_y:%f\n",
-                                  rt_result.xr_min_z,
-                                  rt_result.xr_min_z_y);
-       bu_log("Z bounds xr_max_z:%f, xr_max_z_y:%f\n",
-                                          rt_result.xr_max_z,
-                                          rt_result.xr_max_z_y);
+    bu_log("X bounds xr_min_x_x:%f, xr_min_x_y:%f, xr_min_x_z:%f \n",
+          rt_result.xr_min_x_x,
+          rt_result.xr_min_x_y,
+          rt_result.xr_min_x_z);
+    bu_log("X bounds xr_max_x_x:%f, xr_max_x_y:%f, xr_max_x_z:%f \n",
+          rt_result.xr_max_x_x,
+          rt_result.xr_max_x_y,
+          rt_result.xr_max_x_z);
+    bu_log("Y bounds xr_min_y:%f, xr_min_y_z:%f\n",
+          rt_result.xr_min_y,
+          rt_result.xr_min_y_z);
+    bu_log("Y bounds xr_max_y:%f, xr_max_y_z:%f\n",
+          rt_result.xr_max_y,
+          rt_result.xr_max_y_z);
+    bu_log("Z bounds xr_min_z:%f, xr_min_z_y:%f\n",
+          rt_result.xr_min_z,
+          rt_result.xr_min_z_y);
+    bu_log("Z bounds xr_max_z:%f, xr_max_z_y:%f\n",
+          rt_result.xr_max_z,
+          rt_result.xr_max_z_y);
 
 
 }
@@ -71,66 +71,66 @@
 int
 cleanup_lists(void)
 {
-       struct overlap *ovp, *ovp_free;
-       struct hit_reg *hrp, *hrp_free;
+    struct overlap *ovp, *ovp_free;
+    struct hit_reg *hrp, *hrp_free;
 
-       /* Free all nodes of overlap circularly linked list */
-       if (overlap_list.forw != &overlap_list) {
-               ovp = overlap_list.forw;
-               while (ovp != &overlap_list) {
-                       ovp_free = ovp;
-                       ovp = ovp->forw;
-                       bu_free(ovp_free, "cleanup_lists:free overlap_list");
+    /* Free all nodes of overlap circularly linked list */
+    if (overlap_list.forw != &overlap_list) {
+       ovp = overlap_list.forw;
+       while (ovp != &overlap_list) {
+           ovp_free = ovp;
+           ovp = ovp->forw;
+           bu_free(ovp_free, "cleanup_lists:free overlap_list");
 
-               }
        }
+    }
 
-       /* Free all nodes of hit region circularly linked list */
-       if (hit_list.forw != &hit_list) {
-               hrp = hit_list.forw;
-               while (hrp != &hit_list) {
-                       hrp_free = hrp;
-                       hrp = hrp->forw;
-                       bu_free(hrp_free, "cleanup_lists:hit_list");
-               }
+    /* Free all nodes of hit region circularly linked list */
+    if (hit_list.forw != &hit_list) {
+       hrp = hit_list.forw;
+       while (hrp != &hit_list) {
+           hrp_free = hrp;
+           hrp = hrp->forw;
+           bu_free(hrp_free, "cleanup_lists:hit_list");
        }
+    }
 
-       overlap_list.forw = overlap_list.backw = &overlap_list;
-       hit_list.forw = hit_list.backw = &hit_list;
+    overlap_list.forw = overlap_list.backw = &overlap_list;
+    hit_list.forw = hit_list.backw = &hit_list;
 
-       overlap_list.index = 0;
-       hit_list.index = 0;
+    overlap_list.index = 0;
+    hit_list.index = 0;
 
-       return GED_OK;
+    return GED_OK;
 }
 
 
 int
 get_overlap(struct rigid_body *rbA, struct rigid_body *rbB, vect_t 
overlap_min, vect_t overlap_max)
 {
-       bu_log("Calculating overlap between BB of %s(%f, %f, %f):(%f,%f,%f) \
+    bu_log("Calculating overlap between BB of %s(%f, %f, %f):(%f,%f,%f) \
                        and %s(%f, %f, %f):(%f,%f,%f)",
-                       rbA->rb_namep,
-                       V3ARGS(rbA->btbb_min), V3ARGS(rbA->btbb_max),
-                       rbB->rb_namep,
-                       V3ARGS(rbB->btbb_min), V3ARGS(rbB->btbb_max)
-                 );
+          rbA->rb_namep,
+          V3ARGS(rbA->btbb_min), V3ARGS(rbA->btbb_max),
+          rbB->rb_namep,
+          V3ARGS(rbB->btbb_min), V3ARGS(rbB->btbb_max)
+          );
 
-       VMOVE(overlap_max, rbA->btbb_max);
-       VMIN(overlap_max, rbB->btbb_max);
+    VMOVE(overlap_max, rbA->btbb_max);
+    VMIN(overlap_max, rbB->btbb_max);
 
-       VMOVE(overlap_min, rbA->btbb_min);
-       VMAX(overlap_min, rbB->btbb_min);
+    VMOVE(overlap_min, rbA->btbb_min);
+    VMAX(overlap_min, rbB->btbb_min);
 
-       bu_log("Overlap volume between %s & %s is (%f, %f, %f):(%f,%f,%f)",
-                       rbA->rb_namep,
-                       rbB->rb_namep,
-                       V3ARGS(overlap_min),
-                       V3ARGS(overlap_max)
-                       );
+    bu_log("Overlap volume between %s & %s is (%f, %f, %f):(%f,%f,%f)",
+          rbA->rb_namep,
+          rbB->rb_namep,
+          V3ARGS(overlap_min),
+          V3ARGS(overlap_max)
+          );
 
 
-       return GED_OK;
+    return GED_OK;
 }
 
 
@@ -138,141 +138,141 @@
 if_hit(struct application *ap, struct partition *part_headp, struct seg 
*UNUSED(segs))
 {
 
-       struct hit_reg *new_hit_regp;
+    struct hit_reg *new_hit_regp;
 
-       /* iterating over partitions, this will keep track of the current
-        * partition we're working on.
-        */
-       struct partition *pp;
+    /* iterating over partitions, this will keep track of the current
+     * partition we're working on.
+     */
+    struct partition *pp;
 
-       /* will serve as a pointer for the entry and exit hitpoints */
-       struct hit *hitp;
+    /* will serve as a pointer for the entry and exit hitpoints */
+    struct hit *hitp;
 
-       /* will serve as a pointer to the solid primitive we hit */
-       struct soltab *stp;
+    /* will serve as a pointer to the solid primitive we hit */
+    struct soltab *stp;
 
-       /* will contain surface curvature information at the entry */
-       struct curvature cur;
+    /* will contain surface curvature information at the entry */
+    struct curvature cur;
 
-       /* will contain our hit point coordinate */
-       point_t in_pt, out_pt;
+    /* will contain our hit point coordinate */
+    point_t in_pt, out_pt;
 
-       /* will contain normal vector where ray enters geometry */
-       vect_t inormal;
+    /* will contain normal vector where ray enters geometry */
+    vect_t inormal;
 
-       /* will contain normal vector where ray exits geometry */
-       vect_t onormal;
+    /* will contain normal vector where ray exits geometry */
+    vect_t onormal;
 
-       /* iterate over each partition until we get back to the head.
-        * each partition corresponds to a specific homogeneous region of
-        * material.
-        */
-       for (pp=part_headp->pt_forw; pp != part_headp; pp = pp->pt_forw) {
+    /* iterate over each partition until we get back to the head.
+     * each partition corresponds to a specific homogeneous region of
+     * material.
+     */
+    for (pp=part_headp->pt_forw; pp != part_headp; pp = pp->pt_forw) {
 
-               new_hit_regp = (struct hit_reg *) bu_malloc(sizeof(struct 
hit_reg), "new_hit_regp");
-               if(new_hit_regp){
+       new_hit_regp = (struct hit_reg *) bu_malloc(sizeof(struct hit_reg), 
"new_hit_regp");
+       if(new_hit_regp){
 
-                       /* print the name of the region we hit as well as the 
name of
-                        * the primitives encountered on entry and exit.
-                        */
-               /*      bu_log("\n--- Hit region %s (in %s, out %s)\n",
-                                  pp->pt_regionp->reg_name,
-                                  pp->pt_inseg->seg_stp->st_name,
-                                  pp->pt_outseg->seg_stp->st_name );*/
+           /* print the name of the region we hit as well as the name of
+            * the primitives encountered on entry and exit.
+            */
+           /*  bu_log("\n--- Hit region %s (in %s, out %s)\n",
+               pp->pt_regionp->reg_name,
+               pp->pt_inseg->seg_stp->st_name,
+               pp->pt_outseg->seg_stp->st_name );*/
 
-                       /* Insert solid data into list node */
-                       if(pp->pt_regionp->reg_name[0] == '/')
-                               new_hit_regp->reg_name = 
(pp->pt_regionp->reg_name) + 1;
-                       else
-                               new_hit_regp->reg_name = 
pp->pt_regionp->reg_name;
-                       new_hit_regp->in_stp   = pp->pt_inseg->seg_stp;
-                       new_hit_regp->out_stp  = pp->pt_outseg->seg_stp;
+           /* Insert solid data into list node */
+           if(pp->pt_regionp->reg_name[0] == '/')
+               new_hit_regp->reg_name = (pp->pt_regionp->reg_name) + 1;
+           else
+               new_hit_regp->reg_name = pp->pt_regionp->reg_name;
+           new_hit_regp->in_stp   = pp->pt_inseg->seg_stp;
+           new_hit_regp->out_stp  = pp->pt_outseg->seg_stp;
 
-                       /* entry hit point, so we type less */
-                       hitp = pp->pt_inhit;
+           /* entry hit point, so we type less */
+           hitp = pp->pt_inhit;
 
-                       /* construct the actual (entry) hit-point from the ray 
and the
-                        * distance to the intersection point (i.e., the 't' 
value).
-                        */
-                       VJOIN1(in_pt, ap->a_ray.r_pt, hitp->hit_dist, 
ap->a_ray.r_dir);
+           /* construct the actual (entry) hit-point from the ray and the
+            * distance to the intersection point (i.e., the 't' value).
+            */
+           VJOIN1(in_pt, ap->a_ray.r_pt, hitp->hit_dist, ap->a_ray.r_dir);
 
-                       /* primitive we encountered on entry */
-                       stp = pp->pt_inseg->seg_stp;
+           /* primitive we encountered on entry */
+           stp = pp->pt_inseg->seg_stp;
 
-                       /* compute the normal vector at the entry point, 
flipping the
-                        * normal if necessary.
-                        */
-                       RT_HIT_NORMAL(inormal, hitp, stp, &(ap->a_ray), 
pp->pt_inflip);
+           /* compute the normal vector at the entry point, flipping the
+            * normal if necessary.
+            */
+           RT_HIT_NORMAL(inormal, hitp, stp, &(ap->a_ray), pp->pt_inflip);
 
-                       /* print the entry hit point info */
-               /*      rt_pr_hit("  In", hitp);
-                       VPRINT(   "  Ipoint", in_pt);
-                       VPRINT(   "  Inormal", inormal);*/
+           /* print the entry hit point info */
+           /*  rt_pr_hit("  In", hitp);
+               VPRINT(   "  Ipoint", in_pt);
+               VPRINT(   "  Inormal", inormal);*/
 
 
-                       if (pp->pt_overlap_reg) {
-                               struct region *pp_reg;
-                               int j = -1;
+           if (pp->pt_overlap_reg) {
+               struct region *pp_reg;
+               int j = -1;
 
-                               bu_log("    Claiming regions:\n");
-                               while ((pp_reg = pp->pt_overlap_reg[++j]))
-                                       bu_log("        %s\n", 
pp_reg->reg_name);
-                       }
+               bu_log("    Claiming regions:\n");
+               while ((pp_reg = pp->pt_overlap_reg[++j]))
+                   bu_log("        %s\n", pp_reg->reg_name);
+           }
 
-                       /* This next macro fills in the curvature information 
which
-                        * consists of a principle direction vector, and the 
inverse
-                        * radii of curvature along that direction and 
perpendicular
-                        * to it.  Positive curvature bends toward the outward
-                        * pointing normal.
-                        */
-                       RT_CURVATURE(&cur, hitp, pp->pt_inflip, stp);
+           /* This next macro fills in the curvature information which
+            * consists of a principle direction vector, and the inverse
+            * radii of curvature along that direction and perpendicular
+            * to it.  Positive curvature bends toward the outward
+            * pointing normal.
+            */
+           RT_CURVATURE(&cur, hitp, pp->pt_inflip, stp);
 
-                       /* print the entry curvature information */
-               /*      VPRINT("PDir", cur.crv_pdir);
-                       bu_log(" c1=%g\n", cur.crv_c1);
-                       bu_log(" c2=%g\n", cur.crv_c2);*/
+           /* print the entry curvature information */
+           /*  VPRINT("PDir", cur.crv_pdir);
+               bu_log(" c1=%g\n", cur.crv_c1);
+               bu_log(" c2=%g\n", cur.crv_c2);*/
 
-                       /* Insert the data about the input point into the list 
*/
-                       VMOVE(new_hit_regp->in_point, in_pt);
-                       VMOVE(new_hit_regp->in_normal, inormal);
-                       new_hit_regp->in_dist = hitp->hit_dist;
-                       new_hit_regp->cur = cur;
+           /* Insert the data about the input point into the list */
+           VMOVE(new_hit_regp->in_point, in_pt);
+           VMOVE(new_hit_regp->in_normal, inormal);
+           new_hit_regp->in_dist = hitp->hit_dist;
+           new_hit_regp->cur = cur;
 
-                       /* exit point, so we type less */
-                       hitp = pp->pt_outhit;
+           /* exit point, so we type less */
+           hitp = pp->pt_outhit;
 
-                       /* construct the actual (exit) hit-point from the ray 
and the
-                        * distance to the intersection point (i.e., the 't' 
value).
-                        */
-                       VJOIN1(out_pt, ap->a_ray.r_pt, hitp->hit_dist, 
ap->a_ray.r_dir);
+           /* construct the actual (exit) hit-point from the ray and the
+            * distance to the intersection point (i.e., the 't' value).
+            */
+           VJOIN1(out_pt, ap->a_ray.r_pt, hitp->hit_dist, ap->a_ray.r_dir);
 
-                       /* primitive we exited from */
-                       stp = pp->pt_outseg->seg_stp;
+           /* primitive we exited from */
+           stp = pp->pt_outseg->seg_stp;
 
-                       /* compute the normal vector at the exit point, 
flipping the
-                        * normal if necessary.
-                        */
-                       RT_HIT_NORMAL(onormal, hitp, stp, &(ap->a_ray), 
pp->pt_outflip);
+           /* compute the normal vector at the exit point, flipping the
+            * normal if necessary.
+            */
+           RT_HIT_NORMAL(onormal, hitp, stp, &(ap->a_ray), pp->pt_outflip);
 
-                       /* print the exit hit point info */
-               /*      rt_pr_hit("  Out", hitp);
-                       VPRINT(   "  Opoint", out_pt);
-                       VPRINT(   "  Onormal", onormal);*/
+           /* print the exit hit point info */
+           /*  rt_pr_hit("  Out", hitp);
+               VPRINT(   "  Opoint", out_pt);
+               VPRINT(   "  Onormal", onormal);*/
 
-                       /* Insert the data about the input point into the list 
*/
-                       VMOVE(new_hit_regp->out_point, out_pt);
-                       VMOVE(new_hit_regp->out_normal, onormal);
-                       new_hit_regp->out_dist = hitp->hit_dist;
+           /* Insert the data about the input point into the list */
+           VMOVE(new_hit_regp->out_point, out_pt);
+           VMOVE(new_hit_regp->out_normal, onormal);
+           new_hit_regp->out_dist = hitp->hit_dist;
 
-                       /* Insert the new hit region into the list of hit 
regions */
-                       new_hit_regp->forw = hit_list.forw;
-                       new_hit_regp->backw = &hit_list;
-                       new_hit_regp->forw->backw = new_hit_regp;
-                       hit_list.forw = new_hit_regp;
-                       new_hit_regp->index = (new_hit_regp->forw->index) + 1;
+           /* Insert the new hit region into the list of hit regions */
+           new_hit_regp->forw = hit_list.forw;
+           new_hit_regp->backw = &hit_list;
+           new_hit_regp->forw->backw = new_hit_regp;
+           hit_list.forw = new_hit_regp;
+           new_hit_regp->index = (new_hit_regp->forw->index) + 1;
 
-               }
        }
+    }
 
     return HIT;
 }
@@ -281,50 +281,50 @@
 int
 if_miss(struct application *UNUSED(ap))
 {
-       bu_log("MISS");
+    bu_log("MISS");
     return MISS;
 }
 
 
 int
 if_overlap(struct application *ap, struct partition *pp, struct region *reg1,
-               struct region *reg2, struct partition *InputHdp)
+          struct region *reg2, struct partition *InputHdp)
 {
-       struct overlap *new_ovlp;
+    struct overlap *new_ovlp;
 
-       bu_log("if_overlap: OVERLAP between %s and %s", reg1->reg_name, 
reg2->reg_name);
+    bu_log("if_overlap: OVERLAP between %s and %s", reg1->reg_name, 
reg2->reg_name);
 
-       new_ovlp = (struct overlap *) bu_malloc(sizeof(struct overlap), 
"new_ovlp");
-       if(new_ovlp){
-               new_ovlp->ap = ap;
-               new_ovlp->pp = pp;
-               new_ovlp->reg1 = reg1;
-               new_ovlp->reg2 = reg2;
-               new_ovlp->in_dist = pp->pt_inhit->hit_dist;
-               new_ovlp->out_dist = pp->pt_outhit->hit_dist;
-               VJOIN1(new_ovlp->in_point, ap->a_ray.r_pt, 
pp->pt_inhit->hit_dist,
-                  ap->a_ray.r_dir);
-               VJOIN1(new_ovlp->out_point, ap->a_ray.r_pt, 
pp->pt_outhit->hit_dist,
-                  ap->a_ray.r_dir);
+    new_ovlp = (struct overlap *) bu_malloc(sizeof(struct overlap), 
"new_ovlp");
+    if(new_ovlp){
+       new_ovlp->ap = ap;
+       new_ovlp->pp = pp;
+       new_ovlp->reg1 = reg1;
+       new_ovlp->reg2 = reg2;
+       new_ovlp->in_dist = pp->pt_inhit->hit_dist;
+       new_ovlp->out_dist = pp->pt_outhit->hit_dist;
+       VJOIN1(new_ovlp->in_point, ap->a_ray.r_pt, pp->pt_inhit->hit_dist,
+              ap->a_ray.r_dir);
+       VJOIN1(new_ovlp->out_point, ap->a_ray.r_pt, pp->pt_outhit->hit_dist,
+              ap->a_ray.r_dir);
 
-               /* Insert the new overlap into the list of overlaps */
-               new_ovlp->forw = overlap_list.forw;
-               new_ovlp->backw = &overlap_list;
-               new_ovlp->forw->backw = new_ovlp;
-               overlap_list.forw = new_ovlp;
-               new_ovlp->index = (new_ovlp->forw->index) + 1;
+       /* Insert the new overlap into the list of overlaps */
+       new_ovlp->forw = overlap_list.forw;
+       new_ovlp->backw = &overlap_list;
+       new_ovlp->forw->backw = new_ovlp;
+       overlap_list.forw = new_ovlp;
+       new_ovlp->index = (new_ovlp->forw->index) + 1;
 
-               if(new_ovlp->reg1->reg_name[0] == '/')
-                       new_ovlp->reg1->reg_name++;
+       if(new_ovlp->reg1->reg_name[0] == '/')
+           new_ovlp->reg1->reg_name++;
 
-               if(new_ovlp->reg2->reg_name[0] == '/')
-                                       new_ovlp->reg2->reg_name++;
-       }
+       if(new_ovlp->reg2->reg_name[0] == '/')
+           new_ovlp->reg2->reg_name++;
+    }
 
-       bu_log("if_overlap: Entering at (%f,%f,%f) at distance of %f",
-                       V3ARGS(new_ovlp->in_point), new_ovlp->in_dist);
-       bu_log("if_overlap: Exiting  at (%f,%f,%f) at distance of %f",
-                       V3ARGS(new_ovlp->out_point), new_ovlp->out_dist);
+    bu_log("if_overlap: Entering at (%f,%f,%f) at distance of %f",
+          V3ARGS(new_ovlp->in_point), new_ovlp->in_dist);
+    bu_log("if_overlap: Exiting  at (%f,%f,%f) at distance of %f",
+          V3ARGS(new_ovlp->out_point), new_ovlp->out_dist);
 
 
     return rt_defoverlap (ap, pp, reg1, reg2, InputHdp);
@@ -334,74 +334,74 @@
 int
 shoot_ray(struct rt_i *rtip, point_t pt, point_t dir)
 {
-       struct application ap;
+    struct application ap;
 
     /* Initialize the table of resource structures */
     /* rt_init_resource(&res_tab, 0, rtip); */
 
-       /* initialization of the application structure */
-       RT_APPLICATION_INIT(&ap);
-       ap.a_hit = if_hit;        /* branch to if_hit routine */
-       ap.a_miss = if_miss;      /* branch to if_miss routine */
-       ap.a_overlap = if_overlap;/* branch to if_overlap routine */
-       /*ap.a_logoverlap = rt_silent_logoverlap;*/
-       ap.a_onehit = 0;          /* continue through shotline after hit */
-       ap.a_purpose = "Manifold ray";
-       ap.a_rt_i = rtip;         /* rt_i pointer */
-       ap.a_zero1 = 0;           /* sanity check, sayth raytrace.h */
-       ap.a_zero2 = 0;           /* sanity check, sayth raytrace.h */
+    /* initialization of the application structure */
+    RT_APPLICATION_INIT(&ap);
+    ap.a_hit = if_hit;        /* branch to if_hit routine */
+    ap.a_miss = if_miss;      /* branch to if_miss routine */
+    ap.a_overlap = if_overlap;/* branch to if_overlap routine */
+    /*ap.a_logoverlap = rt_silent_logoverlap;*/
+    ap.a_onehit = 0;          /* continue through shotline after hit */
+    ap.a_purpose = "Manifold ray";
+    ap.a_rt_i = rtip;         /* rt_i pointer */
+    ap.a_zero1 = 0;           /* sanity check, sayth raytrace.h */
+    ap.a_zero2 = 0;           /* sanity check, sayth raytrace.h */
 
-       /* Set the ray start point and direction rt_shootray() uses these
-        * two to determine what ray to fire.
-        * It's worth nothing that librt assumes units of millimeters.
-        * All geometry is stored as millimeters regardless of the units
-        * set during editing.  There are libbu routines for performing
-        * unit conversions if desired.
-        */
-       VMOVE(ap.a_ray.r_pt, pt);
-       VMOVE(ap.a_ray.r_dir, dir);
+    /* Set the ray start point and direction rt_shootray() uses these
+     * two to determine what ray to fire.
+     * It's worth nothing that librt assumes units of millimeters.
+     * All geometry is stored as millimeters regardless of the units
+     * set during editing.  There are libbu routines for performing
+     * unit conversions if desired.
+     */
+    VMOVE(ap.a_ray.r_pt, pt);
+    VMOVE(ap.a_ray.r_dir, dir);
 
-       /* Simple debug printing */
-       VPRINT("Pnt", ap.a_ray.r_pt);
-       VPRINT("Dir", ap.a_ray.r_dir);
+    /* Simple debug printing */
+    VPRINT("Pnt", ap.a_ray.r_pt);
+    VPRINT("Dir", ap.a_ray.r_dir);
 
-       /* Shoot the ray. */
-       (void)rt_shootray(&ap);
+    /* Shoot the ray. */
+    (void)rt_shootray(&ap);
 
-       return GED_OK;
+    return GED_OK;
 }
 
 
 int
 init_raytrace(struct simulation_params *sim_params, struct rt_i *rtip)
 {
-       struct rigid_body *rb;
+    struct rigid_body *rb;
 
-       /* Add all sim objects to raytrace instance */
+    /* Add all sim objects to raytrace instance */
 
-       /* Add all the sim objects to the rt_i */
-       for (rb = sim_params->head_node; rb != NULL; rb = rb->next) {
-               if (rt_gettree(rtip, rb->rb_namep) < 0)
-                       bu_log("generate_manifolds: Failed to load geometry for 
[%s]\n", rb->rb_namep);
-               else
-                       bu_log("generate_manifolds: Added [%s] to raytracer\n", 
rb->rb_namep);
-       }
+    /* Add all the sim objects to the rt_i */
+    for (rb = sim_params->head_node; rb != NULL; rb = rb->next) {
+       if (rt_gettree(rtip, rb->rb_namep) < 0)
+           bu_log("generate_manifolds: Failed to load geometry for [%s]\n", 
rb->rb_namep);
+       else
+           bu_log("generate_manifolds: Added [%s] to raytracer\n", 
rb->rb_namep);
+    }
 
-       /* This next call causes some values to be pre-computed, sets up space
-        * partitioning, computes bounding volumes, etc.
-        */
-       rt_prep_parallel(rtip, 1);
+    /* This next call causes some values to be pre-computed, sets up space
+     * partitioning, computes bounding volumes, etc.
+     */
+    rt_prep_parallel(rtip, 1);
 
-       bu_log("Simulation objects bounding box (%f, %f, %f):(%f,%f,%f)",
-                       V3ARGS(rtip->mdl_min), V3ARGS(rtip->mdl_max));
+    bu_log("Simulation objects bounding box (%f, %f, %f):(%f,%f,%f)",
+          V3ARGS(rtip->mdl_min), V3ARGS(rtip->mdl_max));
 
-       overlap_list.forw = overlap_list.backw = &overlap_list;
-       hit_list.forw = hit_list.backw = &hit_list;
+    overlap_list.forw = overlap_list.backw = &overlap_list;
+    hit_list.forw = hit_list.backw = &hit_list;
 
-       overlap_list.index = 0;
-       hit_list.index = 0;
+    overlap_list.index = 0;
+    hit_list.index = 0;
 
-       return GED_OK;
+    return GED_OK;
 }
 
 
@@ -410,271 +410,262 @@
  */
 int
 traverse_lists(struct ged *gedp, struct simulation_params *sim_params,
-               point_t pt, point_t dir)
+              point_t pt, point_t dir)
 {
-       struct overlap *ovp;
-       /*struct hit_reg *hrp;*/
-       struct bu_vls reg_vls = BU_VLS_INIT_ZERO;
+    struct overlap *ovp;
+    /*struct hit_reg *hrp;*/
+    struct bu_vls reg_vls = BU_VLS_INIT_ZERO;
 
-       /* quellage */
-       bu_log("traverse_lists : From : (%f,%f,%f), towards(%f,%f,%f)", 
V3ARGS(pt),  V3ARGS(dir));
+    /* quellage */
+    bu_log("traverse_lists : From : (%f,%f,%f), towards(%f,%f,%f)", 
V3ARGS(pt),  V3ARGS(dir));
 
-       /* Draw all the overlap regions : lines are added for overlap segments
-        * to help visual debugging
-        */
-       if (overlap_list.forw != &overlap_list) {
+    /* Draw all the overlap regions : lines are added for overlap segments
+     * to help visual debugging
+     */
+    if (overlap_list.forw != &overlap_list) {
 
-               /* Initialize the result structure : todo move to separate 
function*/
-               rt_result.xr_min_y = MAX_FASTF;
-               rt_result.xr_max_y = -MAX_FASTF;
-               rt_result.xr_min_x_x  = MAX_FASTF;
-               rt_result.xr_max_x_x  = -MAX_FASTF;
+       /* Initialize the result structure : todo move to separate function*/
+       rt_result.xr_min_y = MAX_FASTF;
+       rt_result.xr_max_y = -MAX_FASTF;
+       rt_result.xr_min_x_x  = MAX_FASTF;
+       rt_result.xr_max_x_x  = -MAX_FASTF;
 
-               ovp = overlap_list.forw;
-               while (ovp != &overlap_list) {
+       ovp = overlap_list.forw;
+       while (ovp != &overlap_list) {
 
-                       bu_vls_sprintf(&reg_vls, 
"ray_overlap_%s_%s_%d_%f_%f_%f_%f_%f_%f",
-                                       ovp->reg1->reg_name,
-                                       ovp->reg2->reg_name,
-                                       ovp->index,
-                                       V3ARGS(pt), V3ARGS(dir));
-                       line(gedp, bu_vls_addr(&reg_vls),
-                                       ovp->in_point,
-                                       ovp->out_point,
-                                       0, 210, 0);
+           bu_vls_sprintf(&reg_vls, "ray_overlap_%s_%s_%d_%f_%f_%f_%f_%f_%f",
+                          ovp->reg1->reg_name,
+                          ovp->reg2->reg_name,
+                          ovp->index,
+                          V3ARGS(pt), V3ARGS(dir));
+           line(gedp, bu_vls_addr(&reg_vls),
+                ovp->in_point,
+                ovp->out_point,
+                0, 210, 0);
 
-                       add_to_comb(gedp, sim_params->sim_comb_name, 
bu_vls_addr(&reg_vls));
+           add_to_comb(gedp, sim_params->sim_comb_name, bu_vls_addr(&reg_vls));
 
 
-                       /* Fill up the result structure */
+           /* Fill up the result structure */
 
-                       /* The min x in the direction of the ray where it hit 
an overlap */
-                       if(ovp->in_point[X] < rt_result.xr_min_x_x){
-                               rt_result.xr_min_x_x = ovp->in_point[X];
-                               rt_result.xr_min_x_y = ovp->in_point[Y];
-                               rt_result.xr_min_x_z = ovp->in_point[Z];
-                       }
+           /* The min x in the direction of the ray where it hit an overlap */
+           if(ovp->in_point[X] < rt_result.xr_min_x_x){
+               rt_result.xr_min_x_x = ovp->in_point[X];
+               rt_result.xr_min_x_y = ovp->in_point[Y];
+               rt_result.xr_min_x_z = ovp->in_point[Z];
+           }
 
-                       /* The max x in the direction of the ray where it hit 
an overlap,
-                        * could be on a different ray from above
-                        */
-                       if(ovp->out_point[X] > rt_result.xr_max_x_x){
-                               rt_result.xr_max_x_x = ovp->out_point[X];
-                               rt_result.xr_max_x_y = ovp->out_point[Y];
-                               rt_result.xr_max_x_z = ovp->out_point[Z];
-                       }
+           /* The max x in the direction of the ray where it hit an overlap,
+            * could be on a different ray from above
+            */
+           if(ovp->out_point[X] > rt_result.xr_max_x_x){
+               rt_result.xr_max_x_x = ovp->out_point[X];
+               rt_result.xr_max_x_y = ovp->out_point[Y];
+               rt_result.xr_max_x_z = ovp->out_point[Z];
+           }
 
-                       /* The min y where the x rays encountered overlap */
-                       if(ovp->in_point[Y] < rt_result.xr_min_y){
-                               rt_result.xr_min_y   = ovp->in_point[Y];
-                               rt_result.xr_min_y_z = ovp->in_point[Z];
-                       }
+           /* The min y where the x rays encountered overlap */
+           if(ovp->in_point[Y] < rt_result.xr_min_y){
+               rt_result.xr_min_y   = ovp->in_point[Y];
+               rt_result.xr_min_y_z = ovp->in_point[Z];
+           }
 
-                       /* The max y for the same */
-                       if(ovp->in_point[Y] > rt_result.xr_max_y){
-                               rt_result.xr_max_y   = ovp->in_point[Y];
-                               rt_result.xr_max_y_z = ovp->in_point[Z];
-                       }
+           /* The max y for the same */
+           if(ovp->in_point[Y] > rt_result.xr_max_y){
+               rt_result.xr_max_y   = ovp->in_point[Y];
+               rt_result.xr_max_y_z = ovp->in_point[Z];
+           }
 
-                       /* The min z where the x rays encountered overlap */
-                       if(ovp->in_point[Y] < rt_result.xr_min_z){
-                               /* Not need currently, may be removed when 
z-rays are shot */
-                       }
+           /* The min z where the x rays encountered overlap */
+           if(ovp->in_point[Y] < rt_result.xr_min_z){
+               /* Not need currently, may be removed when z-rays are shot */
+           }
 
-                       /* The max z for the same */
-                       if(ovp->in_point[Y] > rt_result.xr_max_z){
-                               /* Not need currently, may be removed when 
z-rays are shot */
-                       }
+           /* The max z for the same */
+           if(ovp->in_point[Y] > rt_result.xr_max_z){
+               /* Not need currently, may be removed when z-rays are shot */
+           }
 
 
-                       ovp = ovp->forw;
+           ovp = ovp->forw;
 
 
-               }
        }
+    }
 
-       /* Draw all the hit regions : not really needed to be visualized */
-/*     if (hit_list.forw != &hit_list) {
+    /* Draw all the hit regions : not really needed to be visualized */
+    /* if (hit_list.forw != &hit_list) {
 
-               hrp = hit_list.forw;
+       hrp = hit_list.forw;
 
-               while (hrp != &hit_list) {
-                       bu_vls_sprintf(&reg_vls, 
"ray_hit_%s_%d_%f_%f_%f_%f_%f_%f",
-                               hrp->reg_name,
-                               hrp->index,
-                               V3ARGS(pt), V3ARGS(dir));
-                       line(gedp, bu_vls_addr(&reg_vls),
-                                       hrp->in_point,
-                                       hrp->out_point,
-                                       0, 210, 0);
+       while (hrp != &hit_list) {
+       bu_vls_sprintf(&reg_vls, "ray_hit_%s_%d_%f_%f_%f_%f_%f_%f",
+       hrp->reg_name,
+       hrp->index,
+       V3ARGS(pt), V3ARGS(dir));
+       line(gedp, bu_vls_addr(&reg_vls),
+       hrp->in_point,
+       hrp->out_point,
+       0, 210, 0);
 
-                       add_to_comb(gedp, sim_params->sim_comb_name, 
bu_vls_addr(&reg_vls));
-                       hrp = hrp->forw;
-               }
+       add_to_comb(gedp, sim_params->sim_comb_name, bu_vls_addr(&reg_vls));
+       hrp = hrp->forw;
+       }
        }*/
 
-        bu_vls_free(&reg_vls);
+    bu_vls_free(&reg_vls);
 
-       return GED_OK;
+    return GED_OK;
 }
 
 
 int
 shoot_x_rays(
-               struct ged *gedp,
-               struct sim_manifold *current_manifold,
-               struct simulation_params *sim_params,
-               struct rt_i *rtip,
-               vect_t overlap_min, vect_t overlap_max)
+            struct ged *gedp,
+            struct sim_manifold *current_manifold,
+            struct simulation_params *sim_params,
+            struct rt_i *rtip,
+            vect_t overlap_min, vect_t overlap_max)
 {
-       point_t r_pt, r_dir;
-       fastf_t startz, starty, y, z;
-       vect_t diff;
+    point_t r_pt, r_dir;
+    fastf_t startz, starty, y, z;
+    vect_t diff;
 
-       /* Set direction as straight down X-axis */
-       VSET(r_dir, -1.0, 0.0, 0.0);
+    /* Set direction as straight down X-axis */
+    VSET(r_dir, 1.0, 0.0, 0.0);
 
-       startz = overlap_min[Z];
-       starty = overlap_min[Y];
+    startz = overlap_min[Z];
+    starty = overlap_min[Y];
 
-       bu_log("Querying overlap between %s & %s",
-                       current_manifold->rbA->rb_namep,
-                       current_manifold->rbB->rb_namep);
+    bu_log("Querying overlap between %s & %s",
+          current_manifold->rbA->rb_namep,
+          current_manifold->rbB->rb_namep);
 
-       /* Determine the width along z axis */
-       VSUB2(diff, overlap_max, overlap_min);
+    /* Determine the width along z axis */
+    VSUB2(diff, overlap_max, overlap_min);
 
-       /* Is it thinner than TOLerance ? */
-       if(diff[Z] < TOL){
+    /* Is it thinner than TOLerance ? */
+    if(diff[Z] < TOL){
 
-               /* Yep , so shoot rays only in a single plane in the middle of 
the overlap region*/
-               startz = overlap_min[Z] + diff[Z]*0.5;
+       /* Yep , so shoot rays only in a single plane in the middle of the 
overlap region*/
+       startz = overlap_min[Z] + diff[Z]*0.5;
 
-               /* The overlap region is too thin for generating 4 contacts 
points, 2 will do */
-               for(z=startz; z<=overlap_max[Z]; z += TOL){
-                       for(y=starty; y<=overlap_max[Y]; y += TOL){
+       /* The overlap region is too thin for generating 4 contacts points, 2 
will do */
+       for(z=startz; z<=overlap_max[Z]; z += TOL){
+           for(y=starty; y<=overlap_max[Y]; y += TOL){
 
-                               /* Shooting towards lower x, so start from max 
x outside of overlap box */
-                               VSET(r_pt, overlap_max[X], y, z);
+               /* Shooting towards lower x, so start from max x outside of 
overlap box */
+               VSET(r_pt, overlap_min[X], y, z);
 
-                               bu_log("*****shoot_x_rays : From : (%f,%f,%f) 
>>> towards(%f,%f,%f)*******",
-                                               V3ARGS(r_pt),  V3ARGS(r_dir));
+               bu_log("*****shoot_x_rays : From : (%f,%f,%f) >>> 
towards(%f,%f,%f)*******",
+                      V3ARGS(r_pt),  V3ARGS(r_dir));
 
-                               shoot_ray(rtip, r_pt, r_dir);
+               shoot_ray(rtip, r_pt, r_dir);
 
-                               /* Traverse the hit list and overlap list, 
drawing the ray segments
-                                * for the current ray
-                                */
-                               traverse_lists(gedp, sim_params, r_pt, r_dir);
+               /* Traverse the hit list and overlap list, drawing the ray 
segments
+                * for the current ray
+                */
+               traverse_lists(gedp, sim_params, r_pt, r_dir);
 
-                               print_rayshot_results();
+               print_rayshot_results();
 
-                               /* Cleanup the overlap and hit lists and free 
memory */
-                               cleanup_lists();
+               /* Cleanup the overlap and hit lists and free memory */
+               cleanup_lists();
 
-                       }
-               }
+           }
        }
+    }
 
 
-
-       return GED_OK;
+    return GED_OK;
 }
 
 
 int
 create_contact_pairs(struct sim_manifold *mf)
 {
-       /* Prepare the overlap prim name */
-       bu_log("create_contact_pairs : between %s & %s",
-                       mf->rbA->rb_namep, mf->rbB->rb_namep);
+    /* Prepare the overlap prim name */
+    bu_log("create_contact_pairs : between %s & %s",
+          mf->rbA->rb_namep, mf->rbB->rb_namep);
 
 
-       /* Determine if an arb4 needs to be generated using x/y/z diff. */
+    /* Determine if an arb4 needs to be generated using x/y/z diff. */
 
 
-
-       return GED_OK;
+    return GED_OK;
 }
 
 
 int
 generate_manifolds(struct ged *gedp, struct simulation_params *sim_params)
 {
-       struct sim_manifold *current_manifold;
-       struct rigid_body *rb;
-       vect_t overlap_min, overlap_max;
-       char *prefix_overlap = "overlap_";
-       struct bu_vls overlap_name = BU_VLS_INIT_ZERO;
+    struct sim_manifold *current_manifold;
+    struct rigid_body *rb;
+    vect_t overlap_min, overlap_max;
+    char *prefix_overlap = "overlap_";
+    struct bu_vls overlap_name = BU_VLS_INIT_ZERO;
 
-       /* Raytrace related stuff */
-       struct rt_i *rtip;
+    /* Raytrace related stuff */
+    struct rt_i *rtip;
 
-       /* Make a new rt_i instance from the existing db_i structure */
-       if ((rtip=rt_new_rti(gedp->ged_wdbp->dbip)) == RTI_NULL) {
-               bu_log("generate_manifolds: rt_new_rti failed while getting new 
rt instance\n");
-               return GED_ERROR;
-       }
-       rtip->useair = 1;
+    /* Make a new rt_i instance from the existing db_i structure */
+    if ((rtip=rt_new_rti(gedp->ged_wdbp->dbip)) == RTI_NULL) {
+       bu_log("generate_manifolds: rt_new_rti failed while getting new rt 
instance\n");
+       return GED_ERROR;
+    }
+    rtip->useair = 1;
 
-       init_raytrace(sim_params, rtip);
+    init_raytrace(sim_params, rtip);
 
 
-       /* Check all rigid bodies for overlaps using their manifold lists */
-       for (rb = sim_params->head_node; rb != NULL; rb = rb->next) {
+    /* Check all rigid bodies for overlaps using their manifold lists */
+    for (rb = sim_params->head_node; rb != NULL; rb = rb->next) {
 
-               for (current_manifold = rb->head_manifold; current_manifold != 
NULL;
-                current_manifold = current_manifold->next) {
+       for (current_manifold = rb->head_manifold; current_manifold != NULL;
+            current_manifold = current_manifold->next) {
 
-                       /* Get the overlap region */
-                       get_overlap(current_manifold->rbA, 
current_manifold->rbB,
-                                       overlap_min,
-                                       overlap_max);
+           /* Get the overlap region */
+           get_overlap(current_manifold->rbA, current_manifold->rbB,
+                       overlap_min,
+                       overlap_max);
 
-                       /* Prepare the overlap prim name */
-                       bu_vls_sprintf(&overlap_name, "%s%s_%s",
-                                       prefix_overlap,
-                                       current_manifold->rbA->rb_namep,
-                                       current_manifold->rbB->rb_namep);
+           /* Prepare the overlap prim name */
+           bu_vls_sprintf(&overlap_name, "%s%s_%s",
+                          prefix_overlap,
+                          current_manifold->rbA->rb_namep,
+                          current_manifold->rbB->rb_namep);
 
-                       /* Make the overlap volume RPP */
-                       make_rpp(gedp, overlap_min, overlap_max, 
bu_vls_addr(&overlap_name));
+           /* Make the overlap volume RPP */
+           make_rpp(gedp, overlap_min, overlap_max, 
bu_vls_addr(&overlap_name));
 
-                       /* Add the region to the result of the sim so it will 
be drawn too */
-                       add_to_comb(gedp, sim_params->sim_comb_name, 
bu_vls_addr(&overlap_name));
+           /* Add the region to the result of the sim so it will be drawn too 
*/
+           add_to_comb(gedp, sim_params->sim_comb_name, 
bu_vls_addr(&overlap_name));
 
-                       /* Shoot rays right here as the pair of rigid_body ptrs 
are known,
-                        * todo: ignore volumes already shot
-                        */
-                       shoot_x_rays(gedp, current_manifold, sim_params, rtip, 
overlap_min, overlap_max);
+           /* Shoot rays right here as the pair of rigid_body ptrs are known,
+            * todo: ignore volumes already shot
+            */
+           shoot_x_rays(gedp, current_manifold, sim_params, rtip, overlap_min, 
overlap_max);
 
 
-                       /* shoot_y_rays(); */
+           /* shoot_y_rays(); */
 
 
-                       /* shoot_z_rays(); */
+           /* shoot_z_rays(); */
 
-                       /* Note down this volume as already covered, so no need 
to shoot rays through it again */
+           /* Note down this volume as already covered, so no need to shoot 
rays through it again */
 
-                       /* Create the contact pairs and normals */
-                       create_contact_pairs(current_manifold);
+           /* Create the contact pairs and normals */
+           create_contact_pairs(current_manifold);
 
 
-               }
        }
+    }
 
 
-       return GED_OK;
+    return GED_OK;
 }
 
 
-
-
-
-
-
-
-
 /*
  * Local Variables:
  * tab-width: 8

Modified: brlcad/trunk/src/libged/simulate/simrt.h
===================================================================
--- brlcad/trunk/src/libged/simulate/simrt.h    2011-10-13 04:44:10 UTC (rev 
47219)
+++ brlcad/trunk/src/libged/simulate/simrt.h    2011-10-13 11:03:51 UTC (rev 
47220)
@@ -58,7 +58,7 @@
  */
 struct overlap {
     int index;
-       struct application *ap;
+    struct application *ap;
     struct partition *pp;
     struct region *reg1;
     struct region *reg2;
@@ -77,7 +77,7 @@
  */
 struct hit_reg {
     int index;
-       struct application *ap;
+    struct application *ap;
     struct partition *pp;
     const char *reg_name;
     struct soltab *in_stp;
@@ -96,20 +96,19 @@
 
 
 struct rayshot_results{
-       /* Results of shooting rays towards -ve x-axis : xr means x rays */
-       fastf_t xr_min_x_x, xr_min_x_y, xr_min_x_z;  /* the min X found while 
shooting x rays & rltd y,z*/
-       fastf_t xr_max_x_x, xr_max_x_y, xr_max_x_z;  /* the max X found while 
shooting x rays & rltd y,z*/
-       fastf_t xr_min_y, xr_min_y_z; /* the min y where overlap was found & 
the z co-ord for it*/
-       fastf_t xr_max_y, xr_max_y_z; /* the max y where overlap was still 
found */
-       fastf_t xr_min_z, xr_min_z_y; /* the min z where overlap was found & 
the y co-ord for it*/
-       fastf_t xr_max_z, xr_max_z_y; /* the max z where overlap was still 
found */
+    /* Results of shooting rays towards -ve x-axis : xr means x rays */
+    fastf_t xr_min_x_x, xr_min_x_y, xr_min_x_z;  /* the min X found while 
shooting x rays & rltd y,z*/
+    fastf_t xr_max_x_x, xr_max_x_y, xr_max_x_z;  /* the max X found while 
shooting x rays & rltd y,z*/
+    fastf_t xr_min_y, xr_min_y_z; /* the min y where overlap was found & the z 
co-ord for it*/
+    fastf_t xr_max_y, xr_max_y_z; /* the max y where overlap was still found */
+    fastf_t xr_min_z, xr_min_z_y; /* the min z where overlap was found & the y 
co-ord for it*/
+    fastf_t xr_max_z, xr_max_z_y; /* the max z where overlap was still found */
 
-       /* Results of shooting rays down y axis */
+    /* Results of shooting rays down y axis */
 
 
+    /* Results of shooting rays down z axis */
 
-       /* Results of shooting rays down z axis */
-
 };
 
 
@@ -141,7 +140,7 @@
  */
 int
 get_overlap(struct rigid_body *rbA, struct rigid_body *rbB, vect_t overlap_min,
-                                                                               
                                        vect_t overlap_max);
+           vect_t overlap_max);
 
 
 /**
@@ -168,7 +167,7 @@
  */
 int
 if_overlap(struct application *ap, struct partition *pp, struct region *reg1,
-               struct region *reg2, struct partition *InputHdp);
+          struct region *reg2, struct partition *InputHdp);
 
 
 /**
@@ -180,15 +179,15 @@
 
 
 /**
- * Shoots a grid of rays towards negative x axis
+ * Shoots a grid of rays down x axis
  */
 int
 shoot_x_rays(
-               struct ged *gedp,
-               struct sim_manifold *current_manifold,
-               struct simulation_params *sim_params,
-               struct rt_i *rtip,
-               vect_t overlap_min, vect_t overlap_max);
+            struct ged *gedp,
+            struct sim_manifold *current_manifold,
+            struct simulation_params *sim_params,
+            struct rt_i *rtip,
+            vect_t overlap_min, vect_t overlap_max);
 
 
 /**
@@ -198,11 +197,6 @@
 init_raytrace(struct simulation_params *sim_params, struct rt_i *rtip);
 
 
-
-
-
-
-
 #endif /* SIMRT_H_ */
 
 /*

Modified: brlcad/trunk/src/libged/simulate/simulate.c
===================================================================
--- brlcad/trunk/src/libged/simulate/simulate.c 2011-10-13 04:44:10 UTC (rev 
47219)
+++ brlcad/trunk/src/libged/simulate/simulate.c 2011-10-13 11:03:51 UTC (rev 
47220)
@@ -106,16 +106,16 @@
 
            if (BU_STR_EMPTY(dp->d_namep)) {
                bu_vls_printf(gedp->ged_result_str, "add_regions: Skipping 
\"%s\" due to empty name\n",
-                                 dp->d_namep);
+                             dp->d_namep);
                continue;
-               }
+           }
 
            /* Duplicate the region */
            bu_vls_sprintf(&dp_name_vls, "%s%s", prefix, dp->d_namep);
 
            kill_copy(gedp, dp, bu_vls_addr(&dp_name_vls));
            bu_vls_printf(gedp->ged_result_str, "add_regions: Copied \"%s\" to 
\"%s\"\n", dp->d_namep,
-                       bu_vls_addr(&dp_name_vls));
+                         bu_vls_addr(&dp_name_vls));
 
            /* Get the directory pointer for the object just added */
            if ((ndp=db_lookup(gedp->ged_wdbp->dbip, bu_vls_addr(&dp_name_vls), 
LOOKUP_QUIET)) == RT_DIR_NULL) {
@@ -153,12 +153,11 @@
     bu_vls_free(&dp_name_vls);
 
     if(sim_params->num_bodies == 0){
-       bu_vls_printf(gedp->ged_result_str, "add_regions: ERROR No objects were 
added\n");
-       return GED_ERROR;
+       bu_vls_printf(gedp->ged_result_str, "add_regions: ERROR No objects were 
added\n");
+       return GED_ERROR;
     }
 
 
-
     /* Show list of objects to be added to the sim : keep for debugging as of 
now */
     /* bu_log("add_regions: The following %d regions will participate in the 
sim : \n", sim_params->num_bodies);
        for (current_node = sim_params->head_node; current_node != NULL; 
current_node = current_node->next) {
@@ -205,7 +204,7 @@
        VSCALE(current_node->bb_center, current_node->bb_dims, 0.5);
        VADD2(current_node->bb_center, current_node->bb_center, 
current_node->bb_min)
 
-               MAT_IDN(current_node->m);
+           MAT_IDN(current_node->m);
        current_node->m[12] = current_node->bb_center[0];
        current_node->m[13] = current_node->bb_center[1];
        current_node->m[14] = current_node->bb_center[2];
@@ -442,35 +441,35 @@
 
     for (i=0 ; i < sim_params.duration ; i++) {
 
-               bu_log("%s: ------------------------- Iteration %d 
-----------------------\n", argv[0], i+1);
+       bu_log("%s: ------------------------- Iteration %d 
-----------------------\n", argv[0], i+1);
 
-               /* Recreate sim.c to clear AABBs and manifold regions from 
previous iteration */
-               recreate_sim_comb(gedp, &sim_params);
+       /* Recreate sim.c to clear AABBs and manifold regions from previous 
iteration */
+       recreate_sim_comb(gedp, &sim_params);
 
-               /* Run the physics simulation */
-               rv = run_simulation(&sim_params);
-               if (rv != GED_OK) {
-                       bu_vls_printf(gedp->ged_result_str, "%s: ERROR while 
running the simulation\n", argv[0]);
-                       return GED_ERROR;
-               }
+       /* Run the physics simulation */
+       rv = run_simulation(&sim_params);
+       if (rv != GED_OK) {
+           bu_vls_printf(gedp->ged_result_str, "%s: ERROR while running the 
simulation\n", argv[0]);
+           return GED_ERROR;
+       }
 
-               /* Apply transforms on the participating objects, also shades 
objects */
-               rv = apply_transforms(gedp, &sim_params);
-               if (rv != GED_OK) {
-                       bu_vls_printf(gedp->ged_result_str, "%s: ERROR while 
applying transforms\n", argv[0]);
-                       return GED_ERROR;
-               }
+       /* Apply transforms on the participating objects, also shades objects */
+       rv = apply_transforms(gedp, &sim_params);
+       if (rv != GED_OK) {
+           bu_vls_printf(gedp->ged_result_str, "%s: ERROR while applying 
transforms\n", argv[0]);
+           return GED_ERROR;
+       }
 
-               /* Generate manifolds using rt */
-               rv = generate_manifolds(gedp, &sim_params);
-               if (rv != GED_OK) {
-                       bu_vls_printf(gedp->ged_result_str, "%s: ERROR while 
calculating manifolds\n", argv[0]);
-                       return GED_ERROR;
-               }
+       /* Generate manifolds using rt */
+       rv = generate_manifolds(gedp, &sim_params);
+       if (rv != GED_OK) {
+           bu_vls_printf(gedp->ged_result_str, "%s: ERROR while calculating 
manifolds\n", argv[0]);
+           return GED_ERROR;
+       }
 
-               free_manifold_lists(&sim_params);
+       free_manifold_lists(&sim_params);
 
-       }
+    }
 
 
     /* Free memory in rigid_body list */

Modified: brlcad/trunk/src/libged/simulate/simutils.c
===================================================================
--- brlcad/trunk/src/libged/simulate/simutils.c 2011-10-13 04:44:10 UTC (rev 
47219)
+++ brlcad/trunk/src/libged/simulate/simutils.c 2011-10-13 11:03:51 UTC (rev 
47220)
@@ -86,18 +86,18 @@
     for (current_manifold = rb->head_manifold; current_manifold != NULL;
         current_manifold = current_manifold->next) {
 
-       bu_log("--Manifold between %s & %s has %d contacts--\n",
+       bu_log("--Manifold between %s & %s has %d contacts--\n",
               current_manifold->rbA->rb_namep,
               current_manifold->rbB->rb_namep,
               current_manifold->num_bt_contacts);
 
-       for (i=0; i<current_manifold->num_bt_contacts; i++) {
+       for (i=0; i<current_manifold->num_bt_contacts; i++) {
            bu_log("%d, (%f, %f, %f):(%f, %f, %f), n(%f, %f, %f)\n",
                   i+1,
                   V3ARGS(current_manifold->bt_contacts[i].ptA),
                   V3ARGS(current_manifold->bt_contacts[i].ptB),
                   V3ARGS(current_manifold->bt_contacts[i].normalWorldOnB));
-       }
+       }
     }
 }
 
@@ -108,7 +108,7 @@
     int i;
     char buffer[500] = "";
     for (i=0; i<argc; i++) {
-       sprintf(buffer, "%s %s", buffer, cmd_args[i]);
+       sprintf(buffer, "%s %s", buffer, cmd_args[i]);
     }
 
     bu_log(buffer);
@@ -123,17 +123,17 @@
 
     /* Check if the duplicate already exists, and kill it if so */
     if (db_lookup(gedp->ged_wdbp->dbip, name, LOOKUP_QUIET) != RT_DIR_NULL) {
-       bu_log("kill: WARNING \"%s\" exists, deleting it\n", name);
-       cmd_args[0] = bu_strdup("kill");
-       cmd_args[1] = bu_strdup(name);
-       cmd_args[2] = (char *)0;
+       bu_log("kill: WARNING \"%s\" exists, deleting it\n", name);
+       cmd_args[0] = bu_strdup("kill");
+       cmd_args[1] = bu_strdup(name);
+       cmd_args[2] = (char *)0;
 
-       if (ged_kill(gedp, argc, (const char **)cmd_args) != GED_OK) {
+       if (ged_kill(gedp, argc, (const char **)cmd_args) != GED_OK) {
            bu_log("kill: ERROR Could not delete existing \"%s\"\n", name);
            return GED_ERROR;
-       }
+       }
 
-       bu_free_array(argc, cmd_args, "kill: free cmd_args");
+       bu_free_array(argc, cmd_args, "kill: free cmd_args");
     }
 
     return GED_OK;
@@ -147,8 +147,8 @@
     int rv, argc = 3;
 
     if (kill(gedp, new_name) != GED_OK) {
-       bu_log("kill_copy: ERROR Could not delete existing \"%s\"\n", new_name);
-       return GED_ERROR;
+       bu_log("kill_copy: ERROR Could not delete existing \"%s\"\n", new_name);
+       return GED_ERROR;
     }
 
     /* Copy the passed prim/comb */
@@ -158,9 +158,9 @@
     cmd_args[3] = (char *)0;
     rv = ged_copy(gedp, 3, (const char **)cmd_args);
     if (rv != GED_OK) {
-       bu_log("kill_copy: ERROR Could not copy \"%s\" to \"%s\"\n", 
dp->d_namep,
+       bu_log("kill_copy: ERROR Could not copy \"%s\" to \"%s\"\n", 
dp->d_namep,
               new_name);
-       return GED_ERROR;
+       return GED_ERROR;
     }
 
     bu_free_array(argc, cmd_args, "kill_copy: free cmd_args");
@@ -182,9 +182,9 @@
     cmd_args[4] = (char *)0;
     rv = ged_comb(gedp, 4, (const char **)cmd_args);
     if (rv != GED_OK) {
-        bu_log("add_to_comb: ERROR Could not add \"%s\" to the combination 
\"%s\"\n",
+       bu_log("add_to_comb: ERROR Could not add \"%s\" to the combination 
\"%s\"\n",
               add, target);
-        return GED_ERROR;
+       return GED_ERROR;
     }
 
     bu_free_array(argc, cmd_args, "add_to_comb: free cmd_args");
@@ -195,9 +195,9 @@
 
 int
 line(struct ged *gedp, char* name, point_t from, point_t to,
-               unsigned char r,
-           unsigned char g,
-           unsigned char b)
+     unsigned char r,
+     unsigned char g,
+     unsigned char b)
 {
     char *cmd_args[20];
     int rv, argc = 19;
@@ -466,43 +466,42 @@
 int
 make_rpp(struct ged *gedp, vect_t min, vect_t max, char* name)
 {
-       int rv, argc = 9;
-       char buffer_str[MAX_FLOATING_POINT_STRLEN];
-       char* cmd_args[28];
+    int rv, argc = 9;
+    char buffer_str[MAX_FLOATING_POINT_STRLEN];
+    char* cmd_args[28];
 
-       if (kill(gedp, name) != GED_OK) {
-               bu_log("line: ERROR Could not delete existing \"%s\"\n", name);
-               return GED_ERROR;
-       }
+    if (kill(gedp, name) != GED_OK) {
+       bu_log("line: ERROR Could not delete existing \"%s\"\n", name);
+       return GED_ERROR;
+    }
 
-       cmd_args[0] = bu_strdup("in");
-       cmd_args[1] = bu_strdup(name);
-       cmd_args[2] = bu_strdup("rpp");
+    cmd_args[0] = bu_strdup("in");
+    cmd_args[1] = bu_strdup(name);
+    cmd_args[2] = bu_strdup("rpp");
 
-       sprintf(buffer_str, "%f", min[0]); cmd_args[3] = bu_strdup(buffer_str);
-       sprintf(buffer_str, "%f", max[0]); cmd_args[4] = bu_strdup(buffer_str);
+    sprintf(buffer_str, "%f", min[0]); cmd_args[3] = bu_strdup(buffer_str);
+    sprintf(buffer_str, "%f", max[0]); cmd_args[4] = bu_strdup(buffer_str);
 
-       sprintf(buffer_str, "%f", min[1]); cmd_args[5] = bu_strdup(buffer_str);
-       sprintf(buffer_str, "%f", max[1]); cmd_args[6] = bu_strdup(buffer_str);
+    sprintf(buffer_str, "%f", min[1]); cmd_args[5] = bu_strdup(buffer_str);
+    sprintf(buffer_str, "%f", max[1]); cmd_args[6] = bu_strdup(buffer_str);
 
-       sprintf(buffer_str, "%f", min[2]); cmd_args[7] = bu_strdup(buffer_str);
-       sprintf(buffer_str, "%f", max[2]); cmd_args[8] = bu_strdup(buffer_str);
+    sprintf(buffer_str, "%f", min[2]); cmd_args[7] = bu_strdup(buffer_str);
+    sprintf(buffer_str, "%f", max[2]); cmd_args[8] = bu_strdup(buffer_str);
 
 
-       cmd_args[9] = (char *)0;
+    cmd_args[9] = (char *)0;
 
-       rv = ged_in(gedp, argc, (const char **)cmd_args);
-       if (rv != GED_OK) {
-               bu_log("make_rpp: WARNING Could not insert RPP %s (%f, %f, 
%f):(%f, %f, %f)\n",
-                  name, V3ARGS(min), V3ARGS(max));
-               return GED_ERROR;
-       }
+    rv = ged_in(gedp, argc, (const char **)cmd_args);
+    if (rv != GED_OK) {
+       bu_log("make_rpp: WARNING Could not insert RPP %s (%f, %f, %f):(%f, %f, 
%f)\n",
+              name, V3ARGS(min), V3ARGS(max));
+       return GED_ERROR;
+    }
 
-       bu_free_array(argc, cmd_args, "make_rpp: free cmd_args");
+    bu_free_array(argc, cmd_args, "make_rpp: free cmd_args");
 
 
-
-       return GED_OK;
+    return GED_OK;
 }
 
 
@@ -520,11 +519,11 @@
 
     /* Prepare prefixed bounding box primitive name */
     bu_vls_sprintf(&buffer1, "%s%s", prefix, current_node->rb_namep);
-       prefixed_name = bu_vls_addr(&buffer1);
+    prefixed_name = bu_vls_addr(&buffer1);
 
     /* Prepare prefixed bounding box region name */
     bu_vls_sprintf(&buffer2, "%s%s", prefix_reg, current_node->rb_namep);
-       prefixed_reg_name = bu_vls_addr(&buffer2);
+    prefixed_reg_name = bu_vls_addr(&buffer2);
 
     /* Delete existing bb prim and region */
     rv = kill(gedp, prefixed_name);
@@ -649,9 +648,9 @@
     char *prefix_reg = "mf_reg_";
     char *prefix_normal = "normal_";
     struct bu_vls name = BU_VLS_INIT_ZERO,
-                         prefixed_name = BU_VLS_INIT_ZERO,
-                         prefixed_reg_name = BU_VLS_INIT_ZERO,
-                         prefixed_normal_name = BU_VLS_INIT_ZERO;
+       prefixed_name = BU_VLS_INIT_ZERO,
+       prefixed_reg_name = BU_VLS_INIT_ZERO,
+       prefixed_normal_name = BU_VLS_INIT_ZERO;
     vect_t scaled_normal;
     point_t from, to;
     struct sim_manifold *current_manifold;
@@ -787,33 +786,33 @@
 
            /* Finally make the manifold primitive, if proper command generated 
*/
            if (argc > 2) {
-               rv = ged_in(gedp, argc, (const char **)cmd_args);
-               if (rv != GED_OK) {
-                       bu_log("insert_manifolds: WARNING Could not draw 
manifold for \"%s\"\n", rb->rb_namep);
-               }
+               rv = ged_in(gedp, argc, (const char **)cmd_args);
+               if (rv != GED_OK) {
+                   bu_log("insert_manifolds: WARNING Could not draw manifold 
for \"%s\"\n", rb->rb_namep);
+               }
 
-               bu_free_array(argc, cmd_args, "insert_manifolds: free 
cmd_args");
+               bu_free_array(argc, cmd_args, "insert_manifolds: free 
cmd_args");
 
-                       /* Make the region for the manifold primitive */
-                       add_to_comb(gedp, bu_vls_addr(&prefixed_reg_name), 
bu_vls_addr(&prefixed_name));
+               /* Make the region for the manifold primitive */
+               add_to_comb(gedp, bu_vls_addr(&prefixed_reg_name), 
bu_vls_addr(&prefixed_name));
 
-                       /* Adjust the material for region to be visible */
-                       apply_material(gedp, bu_vls_addr(&prefixed_reg_name), 
"plastic tr 0.9", 210, 210, 0);
+               /* Adjust the material for region to be visible */
+               apply_material(gedp, bu_vls_addr(&prefixed_reg_name), "plastic 
tr 0.9", 210, 210, 0);
 
-                       /* Add the region to the result of the sim so it will 
be drawn too */
-                       add_to_comb(gedp, sim_params->sim_comb_name, 
bu_vls_addr(&prefixed_reg_name));
+               /* Add the region to the result of the sim so it will be drawn 
too */
+               add_to_comb(gedp, sim_params->sim_comb_name, 
bu_vls_addr(&prefixed_reg_name));
 
-                       /* Finally draw the normal */
-                       VSCALE(scaled_normal, 
current_manifold->bt_contacts[0].normalWorldOnB, NORMAL_SCALE_FACTOR);
-                       VADD2(to, scaled_normal, from);
+               /* Finally draw the normal */
+               VSCALE(scaled_normal, 
current_manifold->bt_contacts[0].normalWorldOnB, NORMAL_SCALE_FACTOR);
+               VADD2(to, scaled_normal, from);
 
-                       bu_log("insert_manifolds: line (%f,%f,%f)-> 
(%f,%f,%f)-> (%f,%f,%f) \n",
-                                  
V3ARGS(current_manifold->bt_contacts[0].normalWorldOnB),
-                                  V3ARGS(to),
-                                  V3ARGS(scaled_normal));
+               bu_log("insert_manifolds: line (%f,%f,%f)-> (%f,%f,%f)-> 
(%f,%f,%f) \n",
+                      V3ARGS(current_manifold->bt_contacts[0].normalWorldOnB),
+                      V3ARGS(to),
+                      V3ARGS(scaled_normal));
 
-                       arrow(gedp, bu_vls_addr(&prefixed_normal_name), from, 
to);
-                       add_to_comb(gedp, sim_params->sim_comb_name, 
bu_vls_addr(&prefixed_normal_name));
+               arrow(gedp, bu_vls_addr(&prefixed_normal_name), from, to);
+               add_to_comb(gedp, sim_params->sim_comb_name, 
bu_vls_addr(&prefixed_normal_name));
 
            }/*  if-argc */
 

Modified: brlcad/trunk/src/libged/simulate/simutils.h
===================================================================
--- brlcad/trunk/src/libged/simulate/simutils.h 2011-10-13 04:44:10 UTC (rev 
47219)
+++ brlcad/trunk/src/libged/simulate/simutils.h 2011-10-13 11:03:51 UTC (rev 
47220)
@@ -109,9 +109,9 @@
  */
 int
 line(struct ged *gedp, char* name, point_t from, point_t to,
-               unsigned char r,
-           unsigned char g,
-           unsigned char b);
+     unsigned char r,
+     unsigned char g,
+     unsigned char b);
 
 
 /**
@@ -159,8 +159,8 @@
  */
 int
 insert_AABB(struct ged *gedp,
-                       struct simulation_params *sim_params,
-                       struct rigid_body *current_node);
+           struct simulation_params *sim_params,
+           struct rigid_body *current_node);
 
 
 /**

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


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to