Revision: 56751
http://sourceforge.net/p/brlcad/code/56751
Author: iiizzzaaakkk
Date: 2013-08-12 17:46:39 +0000 (Mon, 12 Aug 2013)
Log Message:
-----------
Added rt_hrt_export5() routine to export from internal format to database format
Modified Paths:
--------------
brlcad/trunk/src/librt/primitives/hrt/hrt.c
Modified: brlcad/trunk/src/librt/primitives/hrt/hrt.c
===================================================================
--- brlcad/trunk/src/librt/primitives/hrt/hrt.c 2013-08-12 17:42:33 UTC (rev
56750)
+++ brlcad/trunk/src/librt/primitives/hrt/hrt.c 2013-08-12 17:46:39 UTC (rev
56751)
@@ -370,11 +370,42 @@
/**
* R T _ H R T _ E X P O R T 5
+ *
+ * The external form is:
+ * V point
+ * Xdir vector
+ * Ydir vector
+ * Zdir vector
*/
int
-rt_hrt_export5()
+rt_hrt_export5(struct bu_external *ep, const struct rt_db_internal *ip, double
local2mm, const struct db_i *dbip)
{
- bu_log("rt_hrt_export5: Not implemented yet!\n");
+ struct rt_hrt_internal *hip;
+
+ /* must be double for import and export */
+ double hec[ELEMENTS_PER_VECT*4 + 1];
+
+ if (dbip) RT_CK_DBI(dbip);
+
+ RT_CK_DB_INTERNAL(ip);
+ if (ip->idb_type != ID_HRT) return -1;
+ hip = (struct rt_hrt_internal *)ip->idb_ptr;
+ RT_HRT_CK_MAGIC(hip);
+
+ BU_CK_EXTERNAL(ep);
+ ep->ext_nbytes = SIZEOF_NETWORK_DOUBLE * (ELEMENTS_PER_VECT*4 + 1);
+ ep->ext_buf = (genptr_t)bu_malloc(ep->ext_nbytes, "hrt external");
+
+ /* scale values to local buffer */
+ VSCALE(&hec[0*ELEMENTS_PER_VECT], hip->v, local2mm);
+ VSCALE(&hec[1*ELEMENTS_PER_VECT], hip->xdir, local2mm);
+ VSCALE(&hec[2*ELEMENTS_PER_VECT], hip->ydir, local2mm);
+ VSCALE(&hec[3*ELEMENTS_PER_VECT], hip->zdir, local2mm);
+ hec[4*ELEMENTS_PER_VECT] = hip->d;
+
+ /* Convert from internal (host) to database (network) format */
+ htond(ep->ext_buf, (unsigned char *)hec, ELEMENTS_PER_VECT*4 + 1);
+
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits