Revision: 47117 http://brlcad.svn.sourceforge.net/brlcad/?rev=47117&view=rev Author: abhi2011 Date: 2011-10-05 20:39:08 +0000 (Wed, 05 Oct 2011) Log Message: ----------- Converted some strings to vls
Modified Paths: -------------- brlcad/trunk/src/libged/simulate/simcollisionalgo.cpp brlcad/trunk/src/libged/simulate/simulate.c brlcad/trunk/src/libged/simulate/simulate.h brlcad/trunk/src/libged/simulate/simutils.c Modified: brlcad/trunk/src/libged/simulate/simcollisionalgo.cpp =================================================================== --- brlcad/trunk/src/libged/simulate/simcollisionalgo.cpp 2011-10-05 20:05:13 UTC (rev 47116) +++ brlcad/trunk/src/libged/simulate/simcollisionalgo.cpp 2011-10-05 20:39:08 UTC (rev 47117) @@ -110,20 +110,20 @@ current_manifold->rbA = rbA; current_manifold->rbB = rbB; - if (rbB->first_manifold == NULL) { - rbB->first_manifold = current_manifold; + if (rbB->bt_manifold == NULL) { + rbB->bt_manifold = current_manifold; } else{ //Go upto the last manifold, keeping a ptr 1 node behind - struct sim_manifold *p1 = rbB->first_manifold, *p2; + struct sim_manifold *p1 = rbB->bt_manifold, *p2; while (p1 != NULL) { p2 = p1; p1 = p1->next; } p2->next = current_manifold; - //print_manifold_list(rb->first_manifold); + //print_manifold_list(rb->bt_manifold); } - rbB->num_manifolds++; + rbB->num_bt_manifolds++; bu_log("processCollision(box/box): %s & %s \n", rbA->rb_namep, rbB->rb_namep); Modified: brlcad/trunk/src/libged/simulate/simulate.c =================================================================== --- brlcad/trunk/src/libged/simulate/simulate.c 2011-10-05 20:05:13 UTC (rev 47116) +++ brlcad/trunk/src/libged/simulate/simulate.c 2011-10-05 20:39:08 UTC (rev 47117) @@ -61,8 +61,8 @@ VSETALL(current_node->linear_velocity, 0.0f); VSETALL(current_node->angular_velocity, 0.0f); - current_node->num_manifolds = 0; - current_node->first_manifold = NULL; + current_node->num_bt_manifolds = 0; + current_node->bt_manifold = NULL; return GED_OK; } @@ -336,16 +336,16 @@ for (current_node = sim_params->head_node; current_node != NULL; current_node = current_node->next) { - for (current_manifold = current_node->first_manifold; current_manifold != NULL;) { + for (current_manifold = current_node->bt_manifold; current_manifold != NULL;) { next_manifold = current_manifold->next; bu_free(current_manifold, "simulate : current_manifold"); current_manifold = next_manifold; - current_node->num_manifolds--; + current_node->num_bt_manifolds--; } - current_node->num_manifolds = 0; - current_node->first_manifold = NULL; + current_node->num_bt_manifolds = 0; + current_node->bt_manifold = NULL; } return GED_OK; Modified: brlcad/trunk/src/libged/simulate/simulate.h =================================================================== --- brlcad/trunk/src/libged/simulate/simulate.h 2011-10-05 20:05:13 UTC (rev 47116) +++ brlcad/trunk/src/libged/simulate/simulate.h 2011-10-05 20:39:08 UTC (rev 47117) @@ -85,9 +85,13 @@ vect_t linear_velocity; /**< @brief linear velocity components */ vect_t angular_velocity; /**< @brief angular velocity components */ - /* Manifolds in which this body participates and is body B, only body B has manifold info*/ - int num_manifolds; /**< @brief angular velocity components */ - struct sim_manifold *first_manifold; /**< @brief angular velocity components */ + /* Manifold generated by Bullet, where this body is B, only body B has manifold info, used to DEBUG */ + int num_bt_manifolds; /**< @brief number of manifold for this body as reported by Bullet */ + struct sim_manifold *bt_manifold;/**< @brief head of the manifolds linked list as got from Bullet*/ + + /* The manifolds got by raytracing: this is the core of the simulation */ + int num_rt_manifolds; /**< @brief number of manifold for this body as got by rt */ + struct sim_manifold *rt_manifold; /**< @brief head of the manifolds linked list as got by rt */ }; Modified: brlcad/trunk/src/libged/simulate/simutils.c =================================================================== --- brlcad/trunk/src/libged/simulate/simutils.c 2011-10-05 20:05:13 UTC (rev 47116) +++ brlcad/trunk/src/libged/simulate/simutils.c 2011-10-05 20:39:08 UTC (rev 47117) @@ -83,7 +83,7 @@ bu_log("print_manifold_list: %s\n", rb->rb_namep); - for (current_manifold = rb->first_manifold; current_manifold != NULL; + for (current_manifold = rb->bt_manifold; current_manifold != NULL; current_manifold = current_manifold->next) { bu_log("--Manifold between %s & %s has %d contacts--\n", @@ -517,61 +517,54 @@ char* cmd_args[28]; char buffer[20]; int rv, num_args; - char *prefixed_name, *prefixed_reg_name, *prefixed_normal_name; char *prefix = "mf_"; char *prefix_reg = "mf_reg_"; char *prefix_normal = "normal_"; - struct bu_vls buffer1 = BU_VLS_INIT_ZERO, - buffer2 = BU_VLS_INIT_ZERO, - buffer3 = BU_VLS_INIT_ZERO, - buffer4 = BU_VLS_INIT_ZERO; - char *name; + 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; vect_t scaled_normal; point_t from, to; struct sim_manifold *current_manifold; int i; - for (current_manifold = rb->first_manifold; current_manifold != NULL; + for (current_manifold = rb->bt_manifold; current_manifold != NULL; current_manifold = current_manifold->next) { if(current_manifold->num_contacts > 0){ /* Prepare prefixed bounding box primitive name */ - bu_vls_sprintf(&buffer1, "%s_%s", current_manifold->rbA->rb_namep, - current_manifold->rbB->rb_namep); - name = bu_vls_addr(&buffer1); + bu_vls_sprintf(&name, "%s_%s", current_manifold->rbA->rb_namep, current_manifold->rbB->rb_namep); /* Prepare the manifold shape name */ - bu_vls_sprintf(&buffer2, "%s%s", prefix, name); - prefixed_name = bu_vls_addr(&buffer2); + bu_vls_sprintf(&prefixed_name, "%s%s", prefix, bu_vls_addr(&name)); /* Prepare prefixed manifold region name */ - bu_vls_sprintf(&buffer3, "%s%s", prefix_reg, name); - prefixed_reg_name = bu_vls_addr(&buffer3); + bu_vls_sprintf(&prefixed_reg_name, "%s%s", prefix_reg, bu_vls_addr(&name)); /* Prepare prefixed manifold region name */ - bu_vls_sprintf(&buffer4, "%s%s", prefix_normal, name); - prefixed_normal_name = bu_vls_addr(&buffer4); + bu_vls_sprintf(&prefixed_normal_name, "%s%s", prefix_normal, bu_vls_addr(&name)); /* Delete existing manifold prim and region */ - rv = kill(gedp, prefixed_name); + rv = kill(gedp, bu_vls_addr(&prefixed_name)); if (rv != GED_OK) { bu_log("insert_manifolds: ERROR Could not delete existing bounding box arb8 : %s \ - so NOT attempting to add new bounding box\n", prefixed_name); + so NOT attempting to add new bounding box\n", bu_vls_addr(&prefixed_name)); return GED_ERROR; } - rv = kill(gedp, prefixed_reg_name); + rv = kill(gedp, bu_vls_addr(&prefixed_reg_name)); if (rv != GED_OK) { bu_log("insert_manifolds: ERROR Could not delete existing bounding box region : %s \ - so NOT attempting to add new region\n", prefixed_reg_name); + so NOT attempting to add new region\n", bu_vls_addr(&prefixed_reg_name)); return GED_ERROR; } /* Setup the simulation result group union-ing the new objects */ cmd_args[0] = "in"; - cmd_args[1] = bu_strdup(prefixed_name); + cmd_args[1] = bu_vls_addr(&prefixed_name); cmd_args[2] = (char *)0; num_args = 2; @@ -672,13 +665,13 @@ } /* Make the region for the manifold primitive */ - add_to_comb(gedp, prefixed_reg_name, prefixed_name); + 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, prefixed_reg_name, "plastic tr 0.9", 210, 210, 0); + 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, prefixed_reg_name); + add_to_comb(gedp, sim_params->sim_comb_name, bu_vls_addr(&prefixed_reg_name)); /* Finally draw the normal */ VSCALE(scaled_normal, current_manifold->rb_contacts[0].normalWorldOnB, NORMAL_SCALE_FACTOR); @@ -689,8 +682,8 @@ V3ARGS(to), V3ARGS(scaled_normal)); - arrow(gedp, prefixed_normal_name, from, to); - add_to_comb(gedp, sim_params->sim_comb_name, 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-num_args */ @@ -698,10 +691,10 @@ } /* end for-manifold */ - bu_vls_free(&buffer1); - bu_vls_free(&buffer2); - bu_vls_free(&buffer3); - bu_vls_free(&buffer4); + bu_vls_free(&name); + bu_vls_free(&prefixed_name); + bu_vls_free(&prefixed_reg_name); + bu_vls_free(&prefixed_normal_name); return GED_OK; 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-d2dcopy1 _______________________________________________ BRL-CAD Source Commits mailing list brlcad-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/brlcad-commits