<HTML>
<A NAME="pagetop"></A>
<BASEFONT SIZE="3">
<HEAD>
<TITLE>
Polygons
</TITLE>
</HEAD>
<BODY BGCOLOR="white" TEXT="black">
<CENTER>
<A HREF="../../index.htm" target="_top"><IMAGE SRC="../../image/mokuji.gif"></A>
</CENTER>
<H3>
Polygons
</H3>
<HR SIZE="1">
Generates  polygons. There are two types of formats to generate polygons. 
The first one has the primitive element type as disjoint polygon and the other 
has a primitive element type of polyhedron.
<P>
<FONT COLOR="blue">
disjoint polygon
</FONT><BR>
This is one of the types for generating polygons. The vertex coordinates and 
the ordering of the vertices is directly specified for each polygon.
<P>
<BLOCKQUOTE>
<B>Format</B>
<TABLE BORDER>
            # Micro AVS Geom:2.10<BR>
	    disjoint polygon<BR>
	    Primitive Name<BR>
	    Normal Interpolation Type(facet or smooth)<BR>
	    Vertex Data Type(vertex or color)<BR>
	    m(number of polygons)<BR>
	    n1(the number of vertices in polygon #1)<BR>
	    the data for vertex #1 of polygon #1<BR>
	    the data for vertex #2 of polygon #1<BR>
                  .<BR>
                  .<BR>
                  .<BR>
	    nm(the number of vertices in polygon#m)<BR>
            the data for vertex #1 of polygon #m<BR>
            the data for vertex #2 of polygon #m<BR>
                  .<BR>
                  .<BR>
                  .<BR>
            the data for vertex #nm of polygon #m<BR>
</TABLE>
<P>   
<BLOCKQUOTE>
The basic primitive type disjoint polygon is specified in the second line.<BR>
An arbitrary name is specified in the third line.<BR>
In the fourth line, the normal interpolation type is specified as either 
facet or smooth. When smooth is specified, the normal vector at each vertex 
is calculated to be the average of the normal vectors of all the surfaces 
intersecting at that vertex and hence, the transition from surface to surface 
appears very smooth. When facet is specified, the angle at the transition is 
seen markedly.<BR>
In the fifth line, the vertex data type is defined either as vertex or as color.
 When the vertex data type is vertex, only the X, Y and Z coordinates are 
specified for each vertex. When the vertex data type is color, the X, Y and Z 
coordinates as well as the R, G, B color values are specified for each vertex.<BR>
From the 6th line onwards, sets of data each consisting of the number of 
vertices of each polygon and their coordinate values (X, Y, Z)  are specified.<BR>
<P>
Note: When the vertex data type is color, the normals are not averaged even if 
the normal interpolation type is set to smooth and the display is faceted.
<P>
Looking at a polygon from the front, if the vertices are defined in the 
anti-clockwise order, the face is a front face and if the vertex are defined 
in a clockwise order, the face becomes a back face (no ordering can be specified 
such that the faces intersect).
<P>
The maximum number of vertices for each polygon is 200.
<P>
The vertices defining a polygon should lie on the same plane.
<P>
</BLOCKQUOTE>
<B><U>Example: A polygon with color (polygon.mgf)</U></B>
<P>
           # Micro AVS Geom:2.10<BR>
           disjoint polygon<BR>
           polygon_sample<BR>
           facet<BR>
           color<BR>
           6<BR>
           4<BR>
           -1.0   1.0   1.0   1.0  0.0  0.0<BR>
           -1.0  -1.0   1.0   1.0  0.0  0.0<BR>
            1.0  -1.0   1.0   1.0  0.0  0.0<BR>
            1.0   1.0   1.0   1.0  0.0  0.0<BR>
           4<BR>
           -1.0   1.0  -1.0   0.5  0.5  0.0<BR>
            1.0   1.0  -1.0   0.5  0.5  0.0<BR>
            1.0  -1.0  -1.0   0.5  0.5  0.0<BR>
           -1.0  -1.0  -1.0   0.5  0.5  0.0<BR>
           4<BR>
           -1.0   1.0   1.0   0.0  1.0  0.0<BR>
            1.0   1.0   1.0   0.0  1.0  0.0<BR>
            1.0   1.0  -1.0   0.0  1.0  0.0<BR>
           -1.0   1.0  -1.0   0.0  1.0  0.0<BR>
           4<BR>
           -1.0   1.0   1.0   0.0  0.5  0.5<BR>
           -1.0   1.0  -1.0   0.0  0.5  0.5<BR>
           -1.0  -1.0  -1.0   0.0  0.5  0.5<BR>
           -1.0  -1.0   1.0   0.0  0.5  0.5<BR>
           4<BR>
           -1.0  -1.0   1.0   0.0  0.0  1.0<BR>
           -1.0  -1.0  -1.0   0.0  0.0  1.0<BR>
            1.0  -1.0  -1.0   0.0  0.0  1.0<BR>
            1.0  -1.0   1.0   0.0  0.0  1.0<BR>
           4<BR>
            1.0  -1.0   1.0   0.5  0.0  0.5<BR>
            1.0  -1.0  -1.0   0.5  0.0  0.5<BR>
            1.0   1.0  -1.0   0.5  0.0  0.5<BR>
            1.0   1.0   1.0   0.5  0.0  0.5<BR>
</BLOCKQUOTE>
<P>
<FONT COLOR="blue">
polyhedron
</FONT><BR>
This is a type which generates polygons. Polygons are defined using a list of 
vertex coordinates and a list of vertex combinations.
<P>
<BLOCKQUOTE>
<B>Format</B>
<CENTER>
<TABLE BORDER>
           # Micro AVS Geom:2.10<BR>
	   polyhedron<BR>
	   Primitive Name<BR>
	   Normal Interpolation Type(facet or smooth)<BR>
	   Vertex Data Type(vertex or color)<BR>
           n(number of vertices)<BR>
	   Data for vertex #1<BR>
           Data for vertex #2<BR>
              .<BR>
              .<BR>
              .<BR>
           Data for vertex #n<BR>
           m(number of polygons)<BR>
           Number of vertices in polygon #1<BR>
           Ordering of vertices in polygon #1<BR>
           Number of vertices in polygon #2<BR>
           Ordering of vertices in polygon #2<BR>
              .<BR>
              .<BR>
              .<BR>
           Number of vertices in polygon #m<BR>
           Ordering of vertices in polygon #m<BR>
</TABLE>
</CENTER>
<BLOCKQUOTE>
The basic primitive type polyhedron is specified in the second line.<BR>
An arbitrary name is specified in the third line.<BR>
In the fourth line, the normal interpolation type is specified as either 
facet or smooth.<BR>
In the fifth line, the vertex data type is defined either as vertex or 
as color.<BR>
From the 6th line onwards, the coordinate values (X, Y, Z) of each vertex 
is specified. This is followed by the total number of polygons and the 
information of each of the polygons specified as shown below.
<P>
Note: The polygon is specified by ordering the vertices with numbers 
from 1 to n where the first vertex is numbered 1 and the second is numbered n.
Looking at a polygon from the front, if the vertices are defined in the 
anti-clockwise order, the face is a front face and if the vertex are defined 
in a clockwise order, the face becomes a back face (no ordering can be 
specified such that the faces intersect).
<P>
The maximum number of vertices for each polygon is 200.
<P>
The vertices defining a polygon should lie on the same plane.
<P>
</BLOCKQUOTE>
<P>
<B><U>Example: A polyhedron (polyh.mgf)</U></B>
           # Micro AVS Geom:2.10<BR>
           polyhedron<BR>
           polyh_sample<BR>
           facet<BR>
           vertex<BR>
           8<BR>
           -1.0    1.0    1.0<BR>
           -1.0   -1.0    1.0<BR>
            1.0   -1.0    1.0<BR>
            1.0    1.0    1.0<BR>
           -1.0    1.0   -1.0<BR>
           -1.0   -1.0   -1.0<BR>
            1.0   -1.0   -1.0<BR>
            1.0    1.0   -1.0<BR>
           6<BR>
           4<BR>
           1  2  3  4<BR>
           4<BR>
           1  5  6  2<BR>
           4<BR>
           2  6  7  3<BR>
           4<BR>
           3  7  8  4<BR>
           4<BR>
           1  4  8  5<BR>
           4<BR>
           5  8  7  6 <BR>
</BLOCKQUOTE>
<HR SIZE="1">
<TABLE BORDER=0 WIDTH="100%"><TR><TD ALIGN=LEFT>
<A HREF="#pagetop"><IMG SRC="../../image/pagetop.gif" ALT="UP"></A></TD><BR>
<TD ALIGN=RIGHT><FONT FACE="MS SANS SERIF" SIZE=1 COLOR="BLACK">
&copy; 1999-2011 <A HREF="http://www.cybernet.co.jp/english/">CYBERNET SYSTEMS CO.,LTD.</A>
 All rights reserved.</FONT></TD>
</TR></TABLE>
</BODY>
</HTML>
