From albanycs!leah:rsb584 Wed Apr 20 01:31:09 1988
Received: by albanycs.albany.edu (5.54/4.8)
	id AA10551; Tue, 19 Apr 88 21:55:24 EST
Date: Tue, 19 Apr 88 22:55:19 EDT
From: albanycs!leah:rsb584 (Raymond S Brand)
Received: by leah.Albany.EDU (5.58/1.1)
	id AA00271; Tue, 19 Apr 88 22:55:19 EDT
Message-Id: <8804200255.AA00271@leah.Albany.EDU>
To: albanycs:beowulf!rsbx
Subject: cadfmt.shar

>From rrr@naucse.UUCP Mon Apr 11 20:19:40 1988
Path: leah!itsgw!nysernic!cmx!batcomputer!cornell!rochester!ur-tut!sunybcs!boulder!ncar!noao!arizona!naucse!rrr
From: rrr@naucse.UUCP (Bob Rose )
Newsgroups: comp.graphics
Subject: Re: Enterprise 3D database query
Summary: Data format? (answer maybe, C-code yes)
Message-ID: <635@naucse.UUCP>
Date: 12 Apr 88 00:19:40 GMT
References: <2641@im4u.UUCP> <699UD140469@NDSUVM1>
Organization: Northern Arizona University, Flagstaff, AZ
Lines: 69

In article <699UD140469@NDSUVM1>, UD140469@NDSUVM1.BITNET writes:
> [posted the binarys to enterprise and f14 because ...]
> file format:
>      [ a data format (or what he though was the data format)]

Well I tried the format and BOOM! I've narrowing it down though.
[Note a word is 16 bits, first-byte*256 + second-byte]
    word: junk             (file id)
    word: count of objects (1-40)
    30 bytes of junk
    loop for the number of objects:
        9 bytes for name
        word: number of vertices
		loop for the number of vertices
             x,y,z all 4 bytes each
        word: number of faces (each face a triangle)
		loop for the number of faces
             a,b,c,d all 2 bytes each (a,b,c are vertic numbers, d 
                                       is other data)

The thing is I haven't been able to figure out how to arrange the
4 bytes in the x, y, z to get useful data. I've tried a float, longs, etc.
(They all have the high bit set if that helps.)
At the end of the article is some code to extract the data, but again
I don't know how to print out the verts.

> I hope this all helps.  If it causes me much more trouble I'll probably stop
> posting objects.
>                       Scott Udell

Please, don't stop posting unless we can't figure out the format.
And surely we can figure it out, just like we figured out if a
point was inside a poly :^)
It's nice to have people out on the net willing to share.

Heres the code. Please no FLAMES that it looks like garbage, I ran it
through the wrong formatter to shorten it up.
-----------------------cut here-------------------
#include <stdio.h>
getword()
{ register int i; i = 256*getchar(); i += getchar(); return i; }

main(argc, argv)
int argc;
char *argv[];
{ int i, j, num;
	getword(); num = getword(); for (i = 0; i < 30; i++) getchar();
	for (i = 0; i < num; i++) doit(); }

doit() {
	int i, j, x, y, z, w; char s[10];
	for (i = 0; i < 9; i++) s[i] = getchar();
	printf("%s\n", s);
	j = getword(); printf("verts = %d\n", j);
	for (i = 0; i < j; i++) {
		x = getword(); x = x*65536 + getword();
		y = getword(); y = y*65536 + getword();
		z = getword(); z = z*65536 + getword();
		printf("%d %d %d\n", x, y, z); }
	j = getword(); printf("poly = %d\n", j);
	for (i = 0; i < j; i++) {
		x = getword(); y = getword(); z = getword(); w = getword();
		printf("%d %d %d %d\n", x, y, z, w); }
}
-------------------end here--------------------
Robert R. Rose
Northern Arizona University, Box 15600
Flagstaff, AZ 86011
                    .....!ihnp4!arizona!naucse!rrr


