## Wanted: Information on the ASCII-geometry format from AVS

### Wanted: Information on the ASCII-geometry format from AVS

The example you posted seems to be two squares, not one.  One square
is at [[1,1,1], [1,1,-1], [1,-1,-1], [1,-1,1]], and the other is the
same but with X=-1.

The secret to understanding polytriangle strips is to realize that
vertices are doubled on either side of a "break" in the strip. This
creates two zero-area triangles (we call them "cobwebs") which are
culled in our renderer and ignored by many others.  If you wanted to
convert a polytriangle strip to disjoint triangles, you probably
want to skip over these zero-area triangles (easily identified by having
two of the vertices being identical).  Other than that, if the indexes
of the strip are [1,2,3,4,5,6], then the triangles are: [1,2,3], [2,3,4],
[3,4,5], [4,5,6]. I.e., there are N-2 triangles for a polytri strip
of N vertices.

Does this help?
larryg

--

Advanced Visual Systems Inc. (AVS Inc.)
300 Fifth Ave, Waltham, MA 02154
===== Tel: 617-890-4300 = Fax: 617-890-8287 =========================

### Wanted: Information on the ASCII-geometry format from AVS

The subject line pretty much says it; Has anyone a representation
of a geodesic dome - or , even better, a means of generating
the vertex co-ordinates ??

thanks

Craig

### Wanted: Information on the ASCII-geometry format from AVS

On 19 Nov 92 19:13:10 GMT <cr...@EDU.UCLA.LONI.HYPERION> said:

>    The subject line pretty much says it; Has anyone a representation
>    of a geodesic dome - or , even better, a means of generating
>    the vertex co-ordinates ??

>    thanks

>            Craig

>            cr...@hyperion.loni.ucla.edu

Some months ago there was code for Platonic solids and a football
circulated.  This may be useful, in that it's close to a geodesic
dome.  I attach the code in the form that it came from the authors.
It works!

Chris Osland
Rutherford Appleton Laboratory, UK
----------------------------------
======================================================================== 342
Received: from UKACRL by UK.AC.RL.IB (Mailer R2.07) with BSMTP id 1836; Thu, 21
May 92 15:27:02 BST
from UKACRL by UKACRL.BITNET (Mailer R2.07) with BSMTP id 5427; Thu,
21 May 92 15:26:46 BST
Received:      from psi.rutgers.edu by ib.rl.ac.uk (IBM VM SMTP V2R1) with TCP;
Thu, 21 May 92 15:26:34 BS
Received:      from RUTGERS.EDU by psi.rutgers.edu (5.59/SMI4.0/RU1.4/3.08)
id AA14133; Thu, 21 May 92 10:24:54 ED
id AA08528; Thu, 21 May 92 10:24:50 ED
Message-Id:    <9205211424.AA08528@rutgers.edu>
From:          wil...@EDU.UCF.CS.OSCEOLA
Subject:       (NFF) Platonic Solid Generator: platonics.c
Date:          21 May 92 13:14:21 GMT
Sender:        n...@EDU.FSU.SCRI.SUN13
Followup-To:   comp.graphics
Approved:      mur...@vs6.scri.fsu.edu
X-Submissions-To: graph...@scri1.scri.fsu.edu
Apparently-To: comp-graphics-research-d...@vizlab.rutgers.edu

/*
Platonic Solid Generator by Tom Wilson, 1992

This program generates the seven platonic solids: tetra, cube, octahedron,
cubeoctahedron, icosahedron, dodecahedron, and icosidodecahedron. These may be
scaled and/or translated (no rotation). After compiling the program, invoke it
with any of the following parameters:

-h  generates an NFF header (viewpoint, etc.) which should be hand edited
-C  generates polygons for a cube
-c  generates polygons for a cubeoctahedron
-D  generates polygons for a dodecahedron
-I  generates polygons for an icosahedron
-i  generates polygons for an icosidodecahedron
-O  generates polygons for an octahedron
-T  generates polygons for a tetrahedron
-s# scales any objects that follow it by #
-x# translates any objects that follow it by # in the x direction
-y# translates any objects that follow it by # in the y direction
-z# translates any objects that follow it by # in the z direction

Each object is normally centered about 0,0,0 and exists within a box with
corners -1.61803,-1.61803,-1.61803 and 1.61803,1.61803,1.61803 (you can always
scale it to something else). Each object consists of 3-, 4-, or 5-sided
polygons. Each object is preceded by a comment defining where the object begins
and another comment with a surface characterics line that should be hand
edited. Here's an example which generates a header, and one of each object in
the form of an H (the program when compiled is called "platonics"):

platonics -h -x-3 -y3 -C -x3 -c -x-3 -y0 -T -x0 -D -x3 -O -x-3 -y-3 -I -x3 -i

Use "from 0 0 10" and lights at (10,10,10), (-10,10,10), (10,-10,10), and
(-10,-10,10) with the above example.
*/

#include <stdio.h>

typedef float FLT;

FLT scale = 1.0, tx = 0.0, ty = 0.0, tz = 0.0;

typedef struct pointrec
{FLT x, y, z;
} POINT;

POINT tetra[4] = /* tetrahedron */
{{1.0, 1.0, 1.0}, {1.0, -1.0, -1.0}, {-1.0, 1.0, -1.0},
{-1.0, -1.0, 1.0}};
POINT cube[8] = /* cube */
{{1.0, 1.0, 1.0}, {1.0, 1.0, -1.0}, {1.0, -1.0, -1.0}, {1.0, -1.0, 1.0},
{-1.0, -1.0, 1.0}, {-1.0, 1.0, 1.0}, {-1.0, 1.0, -1.0},
{-1.0, -1.0, -1.0}};
POINT octa[6] = /* octahedron */
{{1.0, 0.0, 0.0}, {-1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, -1.0, 0.0},
{0.0, 0.0, 1.0}, {0.0, 0.0, -1.0}};
POINT cubeocta[12] = /* cubeoctahedron */
{{0.0, 1.0, 1.0}, {0.0, -1.0, 1.0}, {0.0, -1.0, -1.0}, {0.0, 1.0, -1.0},
{1.0, 0.0, 1.0}, {-1.0, 0.0, 1.0}, {-1.0, 0.0, -1.0}, {1.0, 0.0, -1.0},
{1.0, 1.0, 0.0}, {-1.0, 1.0, 0.0}, {-1.0, -1.0, 0.0}, {1.0, -1.0, 0.0}};
POINT icosa[12] = /* icosahedron */
{{0.0, 1.61803, 1.0}, {0.0, -1.61803, 1.0}, {0.0, 1.61803, -1.0},
{0.0, -1.61803, -1.0}, {1.0, 0.0, 1.61803}, {-1.0, 0.0, 1.61803},
{1.0, 0.0, -1.61803}, {-1.0, 0.0, -1.61803}, {1.61803, 1.0, 0.0},
{-1.61803, 1.0, 0.0}, {1.61803, -1.0, 0.0}, {-1.61803, -1.0, 0.0}};
POINT dodeca[20] = /* dodecahedron */
{{0.0, 0.618034, 1.61803}, {0.0, -0.618034, 1.61803},
{0.0, -0.618034, -1.61803}, {0.0, 0.618034, -1.61803},
{1.61803, 0.0, 0.618034}, {-1.61803, 0.0, 0.618034},
{-1.61803, 0.0, -0.618034}, {1.61803, 0.0, -0.618034},
{0.618034, 1.61803, 0.0}, {-0.618034, 1.61803, 0.0},
{-0.618034, -1.61803, 0.0}, {0.618034, -1.61803, 0.0}, {1.0, 1.0, 1.0},
{-1.0, 1.0, 1.0}, {-1.0, -1.0, 1.0}, {1.0, -1.0, 1.0},
{1.0, -1.0, -1.0}, {1.0, 1.0, -1.0}, {-1.0, 1.0, -1.0},
{-1.0, -1.0, -1.0}};
POINT icosidodeca[30] = /* icosidodecahedron */
{{2.0, 0.0, 0.0}, {-2.0, 0.0, 0.0}, {0.0, 2.0, 0.0}, {0.0, -2.0, 0.0},
{0.0, 0.0, 2.0}, {0.0, 0.0, -2.0},
{1.61803, 0.618034, 1.0}, {1.61803, 0.618034, -1.0},
{1.61803, -0.618034, 1.0}, {1.61803, -0.618034, -1.0},
{-1.61803, 0.618034, 1.0}, {-1.61803, 0.618034, -1.0},
{-1.61803, -0.618034, 1.0}, {-1.61803, -0.618034, -1.0},
{1.0, 1.61803, 0.618034}, {1.0, 1.61803, -0.618034},
{1.0, -1.61803, 0.618034}, {1.0, -1.61803, -0.618034},
{-1.0, 1.61803, 0.618034}, {-1.0, 1.61803, -0.618034},
{-1.0, -1.61803, 0.618034}, {-1.0, -1.61803, -0.618034},
{0.618034, 1.0, 1.61803}, {0.618034, 1.0, -1.61803},
{0.618034, -1.0, 1.61803}, {0.618034, -1.0, -1.61803},
{-0.618034, 1.0, 1.61803}, {-0.618034, 1.0, -1.61803},
{-0.618034, -1.0, 1.61803}, {-0.618034, -1.0, -1.61803}};

main(argc,argv)
int argc;
char *argv[];
{char *s;
int cnt;

cnt = 1;
while (--argc > 0 && argv[cnt][0] == '-')
{s = argv[cnt]+1;
switch (*s)
{case 'C':
makecube();
break;
case 'c':
makecubeocta();
break;
case 'D':
makedodeca();
break;
case 'h':
break;
case 'I':
makeicosa();
break;
case 'i':
makeicosidodeca();
break;
case 'O':
makeocta();
break;
case 's':
sscanf(argv[cnt]+2,"%f",&scale);
break;
case 'T':
maketetra();
break;
case 'x':
sscanf(argv[cnt]+2,"%f",&tx);
break;
case 'y':
sscanf(argv[cnt]+2,"%f",&ty);
break;
case 'z':
sscanf(argv[cnt]+2,"%f",&tz);
break;
default: printf("argv[%d]=%s\n",cnt,argv[cnt]);
break;
}
cnt++;
}

}

{printf("v\nfrom 0 0 1\nat 0 0 0\nup 0 1 0\nangle 45\nhither 1\n");
printf("resolution 512 512\nb 0 0 0\nl 0 1 1\n");

}

maketetra()
{printf("#tetrahedron: 4 polygons\n");
printf("#f 0 0 0 0 0 0 0 0\n");
tri(tetra,0,1,2);
tri(tetra,0,1,3);
tri(tetra,0,2,3);
tri(tetra,1,2,3);

}

makecube()
{printf("#cube: 6 polygons\n");
printf("#f 0 0 0 0 0 0 0 0\n");

}

makeocta()
{printf("#octahedron: 8 polygons\n");
printf("#f 0 0 0 0 0 0 0 0\n");
tri(octa,0,2,4);
tri(octa,0,2,5);
tri(octa,0,3,4);
tri(octa,0,3,5);
tri(octa,1,2,4);
tri(octa,1,2,5);
tri(octa,1,3,4);
tri(octa,1,3,5);

}

makecubeocta()
{printf("#cubeoctahedron: 14 polygons\n");
printf("#f 0 0 0 0 0 0 0 0\n");
tri(cubeocta,0,4,8);
tri(cubeocta,0,5,9);
tri(cubeocta,1,4,11);
tri(cubeocta,1,5,10);
tri(cubeocta,2,6,10);
tri(cubeocta,2,7,11);
tri(cubeocta,3,6,9);
tri(cubeocta,3,7,8);

}

makeicosa()
{printf("#icosahedron: 20 polygons\n");
printf("#f 0 0 0 0 0 0 0 0\n");
tri(icosa,0,4,5);
tri(icosa,0,4,8);
tri(icosa,4,8,10);
tri(icosa,1,4,10);
tri(icosa,1,4,5);
tri(icosa,1,5,11);
tri(icosa,5,9,11);
tri(icosa,0,5,9);
tri(icosa,0,2,9);
tri(icosa,0,2,8);
tri(icosa,1,3,11);
tri(icosa,1,3,10);
tri(icosa,2,6,7);
tri(icosa,2,6,8);
tri(icosa,6,8,10);
tri(icosa,3,6,10);
tri(icosa,3,6,7);
tri(icosa,3,7,11);
tri(icosa,7,9,11);
tri(icosa,2,7,9);

}

makedodeca()
{printf("#dodecahedron: 12 polygons\n");
printf("#f 0 0 0 0 0 0 0 0\n");
pent(dodeca,0,1,15,4,12);
pent(dodeca,0,12,8,9,13);
pent(dodeca,0,13,5,14,1);
pent(dodeca,1,14,10,11,15);
pent(dodeca,2,3,17,7,16);
pent(dodeca,2,16,11,10,19);
pent(dodeca,2,19,6,18,3);
pent(dodeca,3,17,8,9,18);
pent(dodeca,4,7,16,11,15);
pent(dodeca,4,7,17,8,12);
pent(dodeca,5,6,18,9,13);
pent(dodeca,5,6,19,10,14);

}

makeicosidodeca()
{printf("#icosidodecahedron: 32 polygons\n");
printf("#f 0 0 0 0 0 0 0 0\n");
pent(icosidodeca,0,6,14,15,7);
pent(icosidodeca,0,8,16,17,9);
pent(icosidodeca,1,10,18,19,11);
pent(icosidodeca,1,12,20,21,13);
pent(icosidodeca,2,14,22,26,18);
pent(icosidodeca,2,15,23,27,19);
pent(icosidodeca,3,16,24,28,20);
pent(icosidodeca,3,17,25,29,21);
pent(icosidodeca,4,22,6,8,24);
pent(icosidodeca,4,26,10,12,28);
pent(icosidodeca,5,23,7,9,25);
pent(icosidodeca,5,27,11,13,29);
tri(icosidodeca,0,6,8);
tri(icosidodeca,0,7,9);
tri(icosidodeca,1,10,12);
tri(icosidodeca,1,11,13);
tri(icosidodeca,2,14,15);
tri(icosidodeca,2,18,19);
tri(icosidodeca,3,16,17);
tri(icosidodeca,3,20,21);
tri(icosidodeca,4,22,26);
tri(icosidodeca,4,24,28);
tri(icosidodeca,5,23,27);
tri(icosidodeca,5,25,29);
tri(icosidodeca,6,14,22);
...

Does anyone with 3d studio know if the utah
teapot is one of the standard shapes??

If it is (or even if it isn't) could anyone
who knows please send me it preferably in ascii
format but otherwise whatever will do