Revision: 52652
          http://brlcad.svn.sourceforge.net/brlcad/?rev=52652&view=rev
Author:   brlcad
Date:     2012-10-02 04:20:51 +0000 (Tue, 02 Oct 2012)
Log Message:
-----------
plane equations should be being written out always as doubles for size 
consistency.  when reading them back in, don't assume anything -- read them as 
doubles.  this warrants some manual testing to make sure i didn't fluxxor the 
indices.

Modified Paths:
--------------
    brlcad/trunk/TODO
    brlcad/trunk/src/librt/primitives/arbn/arbn.c

Modified: brlcad/trunk/TODO
===================================================================
--- brlcad/trunk/TODO   2012-10-02 03:29:54 UTC (rev 52651)
+++ brlcad/trunk/TODO   2012-10-02 04:20:51 UTC (rev 52652)
@@ -18,6 +18,9 @@
 THESE TASKS SHOULD HAPPEN BEFORE THE NEXT RELEASE
 -------------------------------------------------
 
+* test arbn v5 import/export (make sure plane equations are not
+  corrupted)
+
 * make igraph/graph command exist even if adaptagrams does not
 
 

Modified: brlcad/trunk/src/librt/primitives/arbn/arbn.c
===================================================================
--- brlcad/trunk/src/librt/primitives/arbn/arbn.c       2012-10-02 03:29:54 UTC 
(rev 52651)
+++ brlcad/trunk/src/librt/primitives/arbn/arbn.c       2012-10-02 04:20:51 UTC 
(rev 52652)
@@ -952,6 +952,7 @@
     unsigned long neqn;
     int double_count;
     size_t byte_count;
+    double *eqn;
 
     RT_CK_DB_INTERNAL(ip);
     BU_CK_EXTERNAL(ep);
@@ -972,9 +973,14 @@
     aip->magic = RT_ARBN_INTERNAL_MAGIC;
     aip->neqn = neqn;
     if (aip->neqn <= 0) return -1;
-    aip->eqn = (plane_t *)bu_malloc(byte_count, "arbn plane eqn[]");
 
-    ntohd((unsigned char *)aip->eqn, (unsigned char *)ep->ext_buf + 4, 
double_count);
+    eqn = (double *)bu_malloc(byte_count, "arbn plane eqn[] temp buf");
+    ntohd((unsigned char *)eqn, (unsigned char *)ep->ext_buf + 4, 
double_count);
+    aip->eqn = (plane_t *)bu_malloc(double_count * sizeof(fastf_t), "arbn 
plane eqn[]");
+    for (i=0; i < aip->neqn; i++) {
+       HMOVE(aip->eqn[i], &eqn[i*ELEMENTS_PER_PLANE]);
+    }
+    bu_free(eqn, "arbn plane eqn[] temp buf");
 
     /* Transform by the matrix, if we have one that is not the identity */
     if (mat && !bn_mat_is_identity(mat)) {
@@ -1015,8 +1021,8 @@
 {
     struct rt_arbn_internal *aip;
     size_t i;
-    fastf_t *vec;
-    fastf_t *sp;
+    double *vec;
+    double *sp;
     int double_count;
     int byte_count;
 

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


------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to