[brlcad-commits] SF.net SVN: brlcad:[48866] brlcad/trunk/src/rt/viewweight.c
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <tbr...@us...> - 2012-01-16 17:47:13
|
Revision: 48866 http://brlcad.svn.sourceforge.net/brlcad/?rev=48866&view=rev Author: tbrowder2 Date: 2012-01-16 17:47:05 +0000 (Mon, 16 Jan 2012) Log Message: ----------- add a sort comparison function for a region array; add variables for array handling and hoisting loops upward Modified Paths: -------------- brlcad/trunk/src/rt/viewweight.c Modified: brlcad/trunk/src/rt/viewweight.c =================================================================== --- brlcad/trunk/src/rt/viewweight.c 2012-01-16 17:45:10 UTC (rev 48865) +++ brlcad/trunk/src/rt/viewweight.c 2012-01-16 17:47:05 UTC (rev 48866) @@ -280,6 +280,24 @@ { } +/* a region ID sort comparison */ +int region_ID_cmp(const void *p1, + const void *p2) +{ + /* cast into correct type--note the incoming pointer type is a + pointer to a pointer which must be dereferenced! */ + struct region *r1 = *(struct region **)p1; + struct region *r2 = *(struct region **)p2; + + if (r1->reg_regionid < r2->reg_regionid) + return -1; + else if (r1->reg_regionid > r2->reg_regionid) + return +1; + else + return strcmp(r1->reg_name, r2->reg_name); +} + + /* end of a frame */ void view_end(struct application *ap) @@ -299,6 +317,14 @@ struct tm *locltime; char *timeptr; + /* a sortable array is needed to have a consistently sorted region + list for regression tests */ + struct region **rp_array = (struct region **)NULL; + register int id = 0; + fastf_t *item_wt = (fastf_t *)NULL; + int nregions = 0; + int ridx; /* for region array */ + /* default units */ bu_strlcpy(units, "grams", sizeof(units)); bu_strlcpy(unit2, bu_units_string(dbp->dbi_local2base), sizeof(unit2)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |