Polygons

Polygons


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.

disjoint polygon
This is one of the types for generating polygons. The vertex coordinates and the ordering of the vertices is directly specified for each polygon.

Format # Micro AVS Geom:2.10
disjoint polygon
Primitive Name
Normal Interpolation Type(facet or smooth)
Vertex Data Type(vertex or color)
m(number of polygons)
n1(the number of vertices in polygon #1)
the data for vertex #1 of polygon #1
the data for vertex #2 of polygon #1
.
.
.
nm(the number of vertices in polygon#m)
the data for vertex #1 of polygon #m
the data for vertex #2 of polygon #m
.
.
.
the data for vertex #nm of polygon #m

The basic primitive type disjoint polygon is specified in the second line.
An arbitrary name is specified in the third line.
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.
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.
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.

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.

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).

The maximum number of vertices for each polygon is 200.

The vertices defining a polygon should lie on the same plane.

Example: A polygon with color (polygon.mgf)

# Micro AVS Geom:2.10
disjoint polygon
polygon_sample
facet
color
6
4
-1.0 1.0 1.0 1.0 0.0 0.0
-1.0 -1.0 1.0 1.0 0.0 0.0
1.0 -1.0 1.0 1.0 0.0 0.0
1.0 1.0 1.0 1.0 0.0 0.0
4
-1.0 1.0 -1.0 0.5 0.5 0.0
1.0 1.0 -1.0 0.5 0.5 0.0
1.0 -1.0 -1.0 0.5 0.5 0.0
-1.0 -1.0 -1.0 0.5 0.5 0.0
4
-1.0 1.0 1.0 0.0 1.0 0.0
1.0 1.0 1.0 0.0 1.0 0.0
1.0 1.0 -1.0 0.0 1.0 0.0
-1.0 1.0 -1.0 0.0 1.0 0.0
4
-1.0 1.0 1.0 0.0 0.5 0.5
-1.0 1.0 -1.0 0.0 0.5 0.5
-1.0 -1.0 -1.0 0.0 0.5 0.5
-1.0 -1.0 1.0 0.0 0.5 0.5
4
-1.0 -1.0 1.0 0.0 0.0 1.0
-1.0 -1.0 -1.0 0.0 0.0 1.0
1.0 -1.0 -1.0 0.0 0.0 1.0
1.0 -1.0 1.0 0.0 0.0 1.0
4
1.0 -1.0 1.0 0.5 0.0 0.5
1.0 -1.0 -1.0 0.5 0.0 0.5
1.0 1.0 -1.0 0.5 0.0 0.5
1.0 1.0 1.0 0.5 0.0 0.5

polyhedron
This is a type which generates polygons. Polygons are defined using a list of vertex coordinates and a list of vertex combinations.

Format
# Micro AVS Geom:2.10
polyhedron
Primitive Name
Normal Interpolation Type(facet or smooth)
Vertex Data Type(vertex or color)
n(number of vertices)
Data for vertex #1
Data for vertex #2
.
.
.
Data for vertex #n
m(number of polygons)
Number of vertices in polygon #1
Ordering of vertices in polygon #1
Number of vertices in polygon #2
Ordering of vertices in polygon #2
.
.
.
Number of vertices in polygon #m
Ordering of vertices in polygon #m
The basic primitive type polyhedron is specified in the second line.
An arbitrary name is specified in the third line.
In the fourth line, the normal interpolation type is specified as either facet or smooth.
In the fifth line, the vertex data type is defined either as vertex or as color.
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.

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).

The maximum number of vertices for each polygon is 200.

The vertices defining a polygon should lie on the same plane.

Example: A polyhedron (polyh.mgf) # Micro AVS Geom:2.10
polyhedron
polyh_sample
facet
vertex
8
-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
6
4
1 2 3 4
4
1 5 6 2
4
2 6 7 3
4
3 7 8 4
4
1 4 8 5
4
5 8 7 6



UP © 1999-2008 KGT Inc. All rights reserved.