Revision: 47271 http://brlcad.svn.sourceforge.net/brlcad/?rev=47271&view=rev Author: abhi2011 Date: 2011-10-16 20:24:39 +0000 (Sun, 16 Oct 2011) Log Message: ----------- Corrected some errors in setting up the linked list
Modified Paths: -------------- brlcad/trunk/src/libged/simulate/simrt.c brlcad/trunk/src/libged/simulate/simulate.h Modified: brlcad/trunk/src/libged/simulate/simrt.c =================================================================== --- brlcad/trunk/src/libged/simulate/simrt.c 2011-10-16 20:11:13 UTC (rev 47270) +++ brlcad/trunk/src/libged/simulate/simrt.c 2011-10-16 20:24:39 UTC (rev 47271) @@ -594,7 +594,7 @@ /* Determine if an arb4 needs to be generated using x/y/z diff. */ - mf->num_contacts = 2; + mf->num_contacts = 4; VMOVE(mf->contacts[0].ptA, rt_result.xr_min_y_in); VMOVE(mf->contacts[1].ptA, rt_result.xr_min_y_out); @@ -672,7 +672,7 @@ int generate_manifolds(struct ged *gedp, struct simulation_params *sim_params) { - struct sim_manifold *bt_mf, *rt_mf; + struct sim_manifold *bt_mf, *rt_mf, *p1, *p2; struct rigid_body *rb; vect_t overlap_min, overlap_max; char *prefix_overlap = "overlap_"; @@ -726,11 +726,28 @@ /* Allocate memory for a new RT manifold */ rt_mf = (struct sim_manifold *) bu_malloc(sizeof(struct sim_manifold), "sim_manifold: rt_mf"); - rt_mf->rbA = bt_mf->rbA; + rt_mf->rbA = bt_mf->rbA; rt_mf->rbB = bt_mf->rbB; rt_mf->num_contacts = 0; rt_mf->next = NULL; + /* Setup the new manifold in the linked list of manifolds for this rigid body */ + if (rb->head_rt_manifold == NULL) { + rb->head_rt_manifold = rt_mf; + } else{ + //Go upto the last manifold, keeping a ptr 1 node behind + p1 = rb->head_bt_manifold; + while (p1 != NULL) { + p2 = p1; + p1 = p1->next; + } + + p2->next = rt_mf; + //print_manifold_list(rb->head_manifold); + } + rb->num_rt_manifolds++; + + /* Shoot rays right here as the pair of rigid_body ptrs are known, * TODO: ignore volumes already shot */ Modified: brlcad/trunk/src/libged/simulate/simulate.h =================================================================== --- brlcad/trunk/src/libged/simulate/simulate.h 2011-10-16 20:11:13 UTC (rev 47270) +++ brlcad/trunk/src/libged/simulate/simulate.h 2011-10-16 20:24:39 UTC (rev 47271) @@ -86,13 +86,13 @@ vect_t linear_velocity; /**< @brief linear velocity components */ vect_t angular_velocity; /**< @brief angular velocity components */ - /* Manifold generated, where this body is B, only body B has manifold info */ + /* Manifold generated by Bullet, where this body is B, only body B has manifold info */ int num_bt_manifolds; /**< @brief number of manifolds for this body */ - struct sim_manifold *head_bt_manifold;/**< @brief head of the manifolds linked list */ + struct sim_manifold *head_bt_manifold; /**< @brief head of the manifolds linked list */ - /* Manifold generated, where this body is B, only body B has manifold info */ + /* Manifold generated by RT, where this body is B, only body B has manifold info */ int num_rt_manifolds; /**< @brief number of manifolds for this body */ - struct sim_manifold *head_rt_manifold;/**< @brief head of the manifolds linked list */ + struct sim_manifold *head_rt_manifold; /**< @brief head of the manifolds linked list */ /* Debugging */ int iter; 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