Todd R Pravata (tpravata++at++rts.dseg.ti.com)
Wed, 28 Sep 94 13:19:03 CDT
Here's the code I am using to do the same thing (pretty straightforward).
I have not tried it with FLT format files.
/* FUNCTION
*
* find_geode
*
* DESCRIPTION
*
* Finds the first geode in the input DAG by recursively decending
* to "leaf" nodes. Assumes that the DAG is built for a single
* stamped model.
*
* RETURNS
*
* pointer to a Geode
*
* NOTES
*
* AUTHOR
*
* Todd Pravata, Texas Instruments, 6/94
*/
static pfGeode *find_geode(pfNode *node)
{
long type;
long num_children;
pfGeode *geode;
int i;
type = pfGetType(node);
if (type & PFCLASS_GROUP) {
num_children = pfGetNumChildren(node);
for (i = 0; i < num_children; ++i) {
geode = find_geode(pfGetChild((pfGroup *)node, i));
if (geode != NULL) return(geode);
}
}
else if (type == PFTYPE_GEODE)
return((pfGeode *)node);
return(NULL);
}
/* FUNCTION
*
* add_stamp_geoset
*
* DESCRIPTION
*
* Add the geometry from the stamp (built from S1000 data) to the
* input billboard. The billboard contains multiple Geosets each
* with their own stamp geometry.
*
* RETURNS
*
* void
*
* NOTES
*
* AUTHOR
*
* Todd Pravata, Texas Instruments, 6/94
*/
static void add_stamp_geoset(pfBillboard *bboard, pfNode *stamp)
{
pfGeode *geode;
geode = find_geode(stamp);
if (geode != NULL) {
if (pfGetNumGSets(geode) != 1)
fprintf(stderr, "pfS1K: Warning - geode has wrong number of geosets %d\n",
pfGetNumGSets(geode));
pfAddGSet((pfGeode *)bboard, pfGetGSet(geode, 0));
}
else
fprintf(stderr, "pfS1K: cannot find geode for stamp\n");
}
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:33 PDT