Revision: 56747
http://sourceforge.net/p/brlcad/code/56747
Author: iiizzzaaakkk
Date: 2013-08-12 17:01:50 +0000 (Mon, 12 Aug 2013)
Log Message:
-----------
Added rt_hrt_import5() routine to import the database format to the internal
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 16:16:01 UTC (rev
56746)
+++ brlcad/trunk/src/librt/primitives/hrt/hrt.c 2013-08-12 17:01:50 UTC (rev
56747)
@@ -382,14 +382,44 @@
/**
* R T _ H R T _ I M P O R T 5
*
- * Import a HRT from the database format to the internal format.
+ * Import a heart from the database format to the internal format.
*
*/
int
-rt_hrt_import5()
+rt_hrt_import5(struct rt_db_internal *ip, const struct bu_external *ep, const
fastf_t *mat, const struct db_i *dbip)
{
- bu_log("rt_hrt_import5: Not implemented yet!\n");
- return 0;
+ 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);
+ BU_CK_EXTERNAL(ep);
+
+ BU_ASSERT_LONG(ep->ext_nbytes, ==, SIZEOF_NETWORK_DOUBLE *
(ELEMENTS_PER_VECT*4 + 1));
+
+ ip->idb_major_type = DB5_MAJORTYPE_BRLCAD;
+ ip->idb_type = ID_HRT;
+ ip->idb_meth = &OBJ[ID_HRT];
+ BU_ALLOC(ip->idb_ptr, struct rt_hrt_internal);
+
+ hip = (struct rt_hrt_internal *)ip->idb_ptr;
+ hip->hrt_magic = RT_HRT_INTERNAL_MAGIC;
+
+ /* Convert from database(network) to internal (host) format */
+ ntohd((unsigned char *)hec, ep->ext_buf, ELEMENTS_PER_VECT*4 + 1);
+
+ /* Apply modelling transormations */
+ if(mat == NULL) mat = bn_mat_identity;
+ MAT4X3PNT(hip->v, mat, &hec[0*ELEMENTS_PER_VECT]);
+ MAT4X3PNT(hip->xdir, mat, &hec[1*ELEMENTS_PER_VECT]);
+ MAT4X3PNT(hip->ydir, mat, &hec[2*ELEMENTS_PER_VECT]);
+ MAT4X3PNT(hip->zdir, mat, &hec[3*ELEMENTS_PER_VECT]);
+ hip->d = hec[4*ELEMENTS_PER_VECT];
+
+ return 0; /* OK */
}
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