Revision: 47149
          http://brlcad.svn.sourceforge.net/brlcad/?rev=47149&view=rev
Author:   abhi2011
Date:     2011-10-06 12:03:40 +0000 (Thu, 06 Oct 2011)
Log Message:
-----------
Added initial code to create 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/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-06 05:58:41 UTC (rev 
47148)
+++ brlcad/trunk/src/libged/simulate/simrt.c    2011-10-06 12:03:40 UTC (rev 
47149)
@@ -29,9 +29,46 @@
 
 
 int
+get_overlap(struct rigid_body *rbA, struct rigid_body *rbB)
+{
+       bu_log("Calculating overlap between BB of A %s(%f, %f, %f):(%f,%f,%f) \
+                       and B %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)
+                 );
+       return GED_OK;
+}
+
+
+int
 generate_manifolds(struct simulation_params *sim_params)
 {
        /* Shoot lasers */
+
+       struct sim_manifold *current_manifold;
+       struct rigid_body *rb;
+       /*vect_t overlap_max, overlap_min;*/
+
+
+       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_overlap(current_manifold->rbA, 
current_manifold->rbB);
+
+                       /* make_rpp(gedp, overlap_max, overlap_min, 
overlap_name); */
+
+
+               }
+
+
+       }
+
+
        return GED_OK;
 }
 

Modified: brlcad/trunk/src/libged/simulate/simrt.h
===================================================================
--- brlcad/trunk/src/libged/simulate/simrt.h    2011-10-06 05:58:41 UTC (rev 
47148)
+++ brlcad/trunk/src/libged/simulate/simrt.h    2011-10-06 12:03:40 UTC (rev 
47149)
@@ -41,8 +41,17 @@
 /* Private Headers */
 #include "../ged_private.h"
 #include "simulate.h"
+#include "simutils.h"
 
 
+/* Rays will be at least this far apart when shot through the overlap regions
+ * This is also the contact threshold for Bullet (0.04 cm if units are in 
meters)
+ * Overlaps regions smaller than this will have only a single plane of rays 
slicing the
+ * region in half, generating manifolds in a plane.
+ */
+#define GRID_GRANULARITY 0.04
+
+
 /**
  * Shoots rays within the AABB overlap regions only to allow more rays to be 
shot
  * in a grid of finer granularity and to increase performance.

Modified: brlcad/trunk/src/libged/simulate/simutils.c
===================================================================
--- brlcad/trunk/src/libged/simulate/simutils.c 2011-10-06 05:58:41 UTC (rev 
47148)
+++ brlcad/trunk/src/libged/simulate/simutils.c 2011-10-06 12:03:40 UTC (rev 
47149)
@@ -380,6 +380,39 @@
 
 
 int
+make_rpp(struct ged *gedp, vect_t max, vect_t min, char* name)
+{
+       int rv;
+       char buffer_str[MAX_FLOATING_POINT_STRLEN];
+       char* cmd_args[28];
+
+       cmd_args[0] = "in";
+       cmd_args[1] = name;
+       cmd_args[2] = "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[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);
+
+
+       cmd_args[9] = (char *)0;
+
+       rv = ged_in(gedp, 9, (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;
+       }
+
+       return GED_OK;
+}
+
+int
 insert_AABB(struct ged *gedp, struct simulation_params *sim_params, struct 
rigid_body *current_node)
 {
     char* cmd_args[28];

Modified: brlcad/trunk/src/libged/simulate/simutils.h
===================================================================
--- brlcad/trunk/src/libged/simulate/simutils.h 2011-10-06 05:58:41 UTC (rev 
47148)
+++ brlcad/trunk/src/libged/simulate/simutils.h 2011-10-06 12:03:40 UTC (rev 
47149)
@@ -166,6 +166,15 @@
 #endif /* SIMUTILS_H_ */
 
 
+/**
+ * This function creates and inserts a RPP
+ * Used to show AABB overlap volume
+ *
+ * TODO: this function will be lowered to librt
+ */
+int
+make_rpp(struct ged *gedp, vect_t max, vect_t min, char* name);
+
 /*
  * Local Variables:
  * tab-width: 8

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

Reply via email to