Revision: 47150 http://brlcad.svn.sourceforge.net/brlcad/?rev=47150&view=rev Author: abhi2011 Date: 2011-10-06 12:56:22 +0000 (Thu, 06 Oct 2011) Log Message: ----------- Finished creating the AABB overlap regions
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 Modified: brlcad/trunk/src/libged/simulate/simrt.c =================================================================== --- brlcad/trunk/src/libged/simulate/simrt.c 2011-10-06 12:03:40 UTC (rev 47149) +++ brlcad/trunk/src/libged/simulate/simrt.c 2011-10-06 12:56:22 UTC (rev 47150) @@ -29,43 +29,74 @@ int -get_overlap(struct rigid_body *rbA, struct rigid_body *rbB) +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 A %s(%f, %f, %f):(%f,%f,%f) \ - and B %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) ); + + VMOVE(overlap_max, rbA->btbb_max); + VMIN(overlap_max, rbB->btbb_max); + + 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) + ); + + return GED_OK; } int -generate_manifolds(struct simulation_params *sim_params) +generate_manifolds(struct ged *gedp, struct simulation_params *sim_params) { - /* Shoot lasers */ - struct sim_manifold *current_manifold; struct rigid_body *rb; - /*vect_t overlap_max, overlap_min;*/ + vect_t overlap_min, overlap_max; + char *prefix_overlap = "overlap_"; + struct bu_vls overlap_name = BU_VLS_INIT_ZERO; + /* 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->bt_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_overlap(current_manifold->rbA, current_manifold->rbB); + /* 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_rpp(gedp, overlap_max, overlap_min, overlap_name); */ + /* Make the overlpa volume RPP */ + make_rpp(gedp, overlap_min, overlap_max, bu_vls_addr(&overlap_name)); + applycolor(gedp, bu_vls_addr(&overlap_name), 0, 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(&overlap_name)); - } + /* Shoot rays right here as the pair of rigid_body ptrs are known, ignore volumes already shot */ + /* Note down this volume as already covered, so no need to shoot rays through it again */ + + } } Modified: brlcad/trunk/src/libged/simulate/simrt.h =================================================================== --- brlcad/trunk/src/libged/simulate/simrt.h 2011-10-06 12:03:40 UTC (rev 47149) +++ brlcad/trunk/src/libged/simulate/simrt.h 2011-10-06 12:56:22 UTC (rev 47150) @@ -57,7 +57,7 @@ * in a grid of finer granularity and to increase performance. */ int -generate_manifolds(struct simulation_params *sim_params); +generate_manifolds(struct ged *gedp, struct simulation_params *sim_params); Modified: brlcad/trunk/src/libged/simulate/simulate.c =================================================================== --- brlcad/trunk/src/libged/simulate/simulate.c 2011-10-06 12:03:40 UTC (rev 47149) +++ brlcad/trunk/src/libged/simulate/simulate.c 2011-10-06 12:56:22 UTC (rev 47150) @@ -449,7 +449,7 @@ } /* Generate manifolds using rt */ - generate_manifolds(&sim_params); + generate_manifolds(gedp, &sim_params); free_manifold_lists(&sim_params); Modified: brlcad/trunk/src/libged/simulate/simutils.c =================================================================== --- brlcad/trunk/src/libged/simulate/simutils.c 2011-10-06 12:03:40 UTC (rev 47149) +++ brlcad/trunk/src/libged/simulate/simutils.c 2011-10-06 12:56:22 UTC (rev 47150) @@ -380,7 +380,7 @@ int -make_rpp(struct ged *gedp, vect_t max, vect_t min, char* name) +make_rpp(struct ged *gedp, vect_t min, vect_t max, char* name) { int rv; char buffer_str[MAX_FLOATING_POINT_STRLEN]; 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