<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" 
               "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" [
  <!ENTITY mathml "http://www.w3.org/1998/Math/MathML">
]>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<link rel="stylesheet" type="text/css" href="../../../comsci/css/s011.css"/>
<link rel='SHORTCUT ICON' href='../../../comsci/images/FrameHome.ico' />
<style type="text/css">
</style>
<title> Polygon Meshes </title>

</head>

<body>


<div class="message_right">
  <a href="http://validator.w3.org/check/referer">
    <img src="http://www.w3.org/Icons/valid-xhtml11" alt="Valid
	XHTML 1.1!" height="31" width="88" />
  </a>

  <a href="http://jigsaw.w3.org/css-validator/">
    <img style="width:88px;height:31px"
       src="http://jigsaw.w3.org/css-validator/images/vcss" 
       alt="Valid CSS!" />
  </a>
  <br/>
  Created 2004-09-06 &nbsp; Modified 
<!--UPDATE_DATE_MODIFIED-->
<!--UPDATE_DATE_BEGIN-->
2007-01-01
<br/>
<a href="mailto:chelton.evans@yahoo.com">Chelton Evans</a>
<!--UPDATE_DATE_END-->
</div>


<h1> 
<a href="geom.html"> <img alt="proj" src="../../../comsci/images/compgeom.png" /></a>
Polygon Meshes 
<a href="../../../../index.html">
<img alt="home" src="../../../comsci/images/Frame.gif" /> </a>
</h1>

<p>
<a href="#Intro">Intro</a> <br/>
<a href="#Indexing_Points">Indexing Points</a><br/>
<a href="#comparison">  Comparison of Triangle Table, Edge Table and the Double Connected Edge List </a> <br/>
<a href="#gentritet"> Generalized Triangle/Tetrahedron Mesh </a> <br/>

<a href="#Polygon_List_with_Edges_or_Edge_Table">Polygon List with Edges or Edge Table </a> <br/>
<a href="#Doubly_Connected_Edge_List"> Doubly Connected Edge List </a> <br/>
<a href="#Polygons_as_List_of_Boundary_Polygons">
  Polygons as List of Boundary Polygons</a><br/>
<a href="#Dual_Mesh"> Dual Mesh</a><br/>

</p>


<div class="float25">
<a id="Intro"></a>
<h2> Intro </h2>

<p>"... the more explicitly the relations among polygons, vertexes, and edges are represented, 
 the faster the operations are and the more space the representation requires." [1]
</p>

<p>I am of the view that primitive shapes are the best tools for dealing with polygons.
 Operators defined on primitive shapes and meshes are the building blocks of
 other methods and views.
</p>





<p> Polygon meshes are used to represent surfaces. They generalize to higher dimensions.
 The focus here is on triangle representations, because ultimately the surface has 
 triangles for geometry which are processed. I will look at two traditional data structures
 for polygon representations and use them with triangles. Further I will come up with a 
 new data structure called the triangle table to do the same thing and more.

</p>

<p> The triangle table uses convexity and the order of the points/edges to define
 the structure. </p>



</div>

<div class="float25">

<a id="Indexing_Points"></a>
<h2>Indexing Points</h2>

<p>All useful polygon representations use pointers, so a particular data structure may have
 certain pointers to edges, vertexes, and polygons.  However not all pointers are created 
 equal and just because a structure has a pointer is completely different to a structure
 which implements that pointer on an array. Integer pointers or integer indexing into stacks
 is probably one of the oldest techniques.  Arrays are the most common data structure and can
 implement all other data structures.
</p>

<p>So while it may appear that I have gone on a tangent, polygons are best implemented with
 integer indexes in arrays.  Hybrids are extremely good too where the C++ pointers can be 
 combined with arrays for some interesting data structures, but integer calculations are
 superior in the sense that we may be able to define inverse operations on integer indexes
 more easily than on a C/C++ style pointer arithmetic.
</p>

</div>

<div class="spacer" />

<div class="float25">
<h2>Polygon Mesh with Indexes into a Vertex List</h2>
<p>The most common polygon representation. If a program can output a list
 of points it can output a list of indexes to those points instead.
 This makes it ideal for communication between algorithms as their
 output can be compared. For example examining different tessellation 
 output on the same data.
</p>

<img src="diagg01901.png" alt="diagg01901.png" />

<table>
<tr><td>Polygon</td><td>Points</td></tr>
<tr><td>1</td><td>4,5,1</td></tr>
<tr><td>2</td><td>4,1,2</td></tr>
<tr><td>3</td><td>4,2,3</td></tr>
</table>

<img src="diagg01905.png" alt="diagg01905.png" />

<table>
<tr><td>Polygon</td><td>Points</td></tr>
<tr><td>1</td><td>1,2,7,6,5</td></tr>
<tr><td>2</td><td>1,2,4,3,8,9,6,7</td></tr>
</table>

</div>

<div class="float25">
<img src="diagg01900.png" alt="diagg01900.png" />
</div>

<div class="float25">

<h2> Triangle Table </h2>

<table>

<tr>
<td> Index </td>
<td> Points </td>
<td> Neighb.</td>
</tr>

<tr>
<td>1</td>
<td>4,5,1</td>
<td> 0,0,2</td>
</tr>

<tr>
<td>2</td>
<td>4,1,2</td>
<td>1,0,3</td>
</tr>

<tr>
<td>3</td>
<td>2,3,4</td>
<td>0,0,2</td>
</tr>

</table>

<p>
The neighbors correspond to the right of the directed edge.
 eg 4,5,1 produces edges 45, 51, 14 with neighbors 0,0,2
 where 0 is no neighbor.

</p>

</div>



<div class="float25">

<a id="Polygon_List_with_Edges_or_Edge_Table"></a>
<h2> Polygon List with Edges or Edge Table</h2>

<p>An extension to the polygon list is to include the edges.</p>

<img src="diagg01901.png" alt="diagg01901.png" />
<img src="diagg01904.png" alt="diagg01904.png" />

<table>
<tr><td>Poly</td><td>Edges</td></tr>
<tr><td>1</td>  <td>6,5,7</td></tr>
<tr><td>2</td>  <td>5,4,3</td></tr>
<tr><td>3</td>  <td>3,1,2</td></tr>
</table>

<p>
The neighbors are left and right respectively of
 the directed edge.
</p>

<table>
<tr><td>Edge</td><td>Points</td><td>Neigh</td></tr>
<tr><td>1</td><td>2,3</td><td>3,0</td></tr>
<tr><td>2</td><td>3,4</td><td>3,0</td></tr>
<tr><td>3</td><td>4,2</td><td>3,2</td></tr>
<tr><td>4</td><td>1,2</td><td>2,0</td></tr>
<tr><td>5</td><td>4,1</td><td>2,1</td></tr>
<tr><td>6</td><td>5,1</td><td>1,0</td></tr>
<tr><td>7</td><td>4,5</td><td>1,0</td></tr>
</table>




</div>

<div class="spacer" />

<div class="float25">
<a id="Doubly_Connected_Edge_List"></a>
<h2> Doubly Connected Edge List </h2>

<table>
<tr><td>Edge</td><td>Points</td><td>Neigh</td>
  <td>Next E0</td> <td>Next E1</td> </tr>
<tr><td>1</td><td>2,3</td><td>3,0</td><td>3</td><td>2</td></tr>
<tr><td>2</td><td>3,4</td><td>3,0</td><td>1</td><td>7</td></tr>
<tr><td>3</td><td>4,2</td><td>3,2</td><td>2</td><td>4</td></tr>
<tr><td>4</td><td>1,2</td><td>2,0</td><td>5</td><td>1</td></tr>
<tr><td>5</td><td>4,1</td><td>2,1</td><td>7</td><td>6</td></tr>
<tr><td>6</td><td>5,1</td><td>1,0</td><td>7</td><td>4</td></tr>
<tr><td>7</td><td>4,5</td><td>1,0</td><td>5</td><td>6</td></tr>
</table>

<p>
The Next Ei is counter clockwise from the point. 
</p>

<h3> Polygon List</h3>
<table>
<tr><td>Poly</td><td>Edge Entree</td></tr>
<tr><td>1</td><td>7</td></tr>
<tr><td>2</td><td>4</td></tr>
<tr><td>3</td><td>2</td></tr>
</table>

</div>

<div class="spacer" />

<div class="float25">

<a id="comparison"> </a>
<h2> Comparison of Triangle Table, Edge Table and the Double Connected Edge List </h2>

<p> All share point table. </p>

<table>
<tr><td> Index</td><td> x y z </td></tr>
<tr><td>1</td> <td> </td> </tr>
<tr><td>2</td> <td> </td> </tr>
<tr><td>.</td> <td>...</td></tr>
</table>


<p> The second and third data structures
 have an edge and vertex perspective. They
 are the standard data structures.
</p>

<p> The first data structure is homegrown and
 uses half the memory. More importantly its 
 perspective is that of the shape, not the edges or
 vertexes.
</p>

<p> I am amazed that this doesn't appear much more
 in the literature - especially since it uses half
 the memory!
</p>

<p>
A discussion of data structures always involves generality.
 Clearly the standard structures are "the most general"
 because every shape has vertexes and edges.
</p>

<p>
But what are they used for? Algorithms!  So would it 
 not be better to have a data structure that suits algorithms
 better?  This sounds like it could shock a few people - common sense.
 To be direct because I am sure the subtle argument was missed,
 this IS GENERAL because its the perspective of the algorithms!
 Indeed this perspective shows how the other ones are NOT general
 by its existence. The end result is general from who's perspective,
 and we can always use more perspectives when algorithms are
 concerned.
</p>

<p>
Thats why I thought up the triangle structure - because I am designing
 algorithms and I wanted a simple way to think of transversing
 a surface.
</p>

</div>

<div class="spacer" />

<div class="float25">

<a id="gentritet"> </a>

<h2> Generalized Triangle/Tetrahedron Mesh </h2>

<p>
After speaking with some computer scientists I get the feeling
 that they have no idea of generality in mathematics. 
 Generality is not a standard, just because the Jones do
 it this way ... does not mean that is the only way of doing it.
 Instead generality is taking some property and seeing the flow.
</p>

<p>
As I said previously looking at vertexes and edges is not the only 
 generalization of meshes, even if every single book I know does
 this to a large extent they are wrong not to look at problems differently.
 You do not know what you are talking about if you stick to these 
 structures. They are at times too difficult to wield and are not
 general enough. 
</p>

<p>
For those of you with an open mind the following is really simple,
  perhaps already done by many other people but I did not know where
 to find it in the literature.
</p>

<p>
The work of tessellation in 2D and 3D with the most primitive regions
 in their dimension is working with the triangle and tetrahedron
 respectively. They are the building blocks. How can these be related
 and represented?
</p>

<p> When I used a triangle mesh with triangle representation that
 took into account triangles windings the triangle data structure was 
 born. eg <code> 1 4 5 1 0 0 2 </code> for index, 3 points and 3 neighbors.
 This had a counter clockwise winding of points 4 5 1 with the order
 of neighbors from the position of the next edge in the winding. 
</p>

<p> While this structure was successful it did not generalize to 3D.
 What does adjacent mean to a point in 3D. Further it was not till I
 started working in 3D that I realized this, else I would have implemented
 the data structure slightly differently. Instead of having the next
 or neighboring edge I would have the opposite edge. The counter clockwise
 winding remains but this time the data structure does generalize from
 2D to 3D with the same meaning. The generality has been captured and
 makes sense.
</p>

<p>
The mesh itself acted also as an iterator with a current state or
 current pointer, similar to a pointer in a doubly linked list.
 With triangles from the base there are two sides - say left and right.
 Transversal algorithms could choose one of the two when moving through
 the mesh, the third side could be the previous move. 
</p>

<p> This generalized for tetrahedrons which have three possible moves.
 If you like you could further define the orientation but this way
 was good enough for my purposes.
</p>


</div>

<div class="float25">
<img src="diagg01902.png" alt="diagg01902.png" />
<p> In 2D an edge is opposite a point. </p>
<img src="diagg01903.png" alt="diagg01903.png" />
<p> In 3D a surface is opposite a point. </p>

</div>

<div class="float25">
<p> The previous triangle table is easily rewritten. 
</p>

<table>

<tr>
<td> Index </td>
<td> Points </td>
<td> Neighb.</td>
</tr>

<tr>
<td>1</td>
<td>4,5,1</td>
<td> 0,2,0</td>
</tr>

<tr>
<td>2</td>
<td>4,1,2</td>
<td>0,3,1</td>
</tr>

<tr>
<td>3</td>
<td>2,3,4</td>
<td>0,2,0</td>
</tr>

</table>

<p>
Between the point and the opposite line/face is within the
 shapes region. For a tetrahedron the first 3 points describe the base,
 the next point is on the side of the base with the arms cross product
 from the first point. 
</p>

<p class="equ">

<math xmlns="&amp;mathml;">
  <mi>x</mi>
  <msub>
    <mi></mi>
    <mrow><mi>i</mi></mrow>
  </msub>
</math> 
 &nbsp; are points of tetrahedron, &nbsp; 

<math xmlns="&amp;mathml;">
  <mi>i</mi>
  <mo>=</mo>
  <mi>0</mi>
  <mo>...</mo>
  <mi>3</mi>
</math> 

<br/>


<math xmlns="&mathml;">
  <mo>(</mo>
  <mo>(</mo>
  <mo>-</mo>
  <mi>x</mi>
  <msub>
    <mi></mi>
    <mrow><mi>0</mi></mrow>
  </msub>
  <mo>+</mo>
  <mi>x</mi>
  <msub>
    <mi></mi>
    <mrow><mi>1</mi></mrow>
  </msub>
  <mo>)</mo>
  <mi>&nbsp;</mi>
  <mo>&times;</mo>
  <mi>&nbsp;</mi>
  <mo>(</mo>
  <mo>-</mo>
  <mi>x</mi>
  <msub>
    <mi></mi>
    <mrow><mi>0</mi></mrow>
  </msub>
  <mo>+</mo>
  <mi>x</mi>
  <msub>
    <mi></mi>
    <mrow><mi>2</mi></mrow>
  </msub>
  <mo>)</mo>
  <mo>)</mo>
  <mo>&CenterDot;</mo>
  <mi>x</mi>
  <msub>
    <mi></mi>
    <mrow><mi>3</mi></mrow>
  </msub>
  <mo>&gt;</mo>
  <mi>0</mi>
</math>


</p>

</div>

<div class="float25">
<a id="Polygons_as_List_of_Boundary_Polygons"></a>
<h2>Polygons as List of Boundary Polygons</h2>
<p>The boundary is always one dimension less and have
 the boundary in an anticlockwise winding then
 the figure can be described in the following way.
</p>

<pre>
Polygon Points    Neighbor
1:  
  2,1,6,7             2
  2,7,5               0
  1,2,5               0
  5,6,7               0
  1,6,5               0

2: 
  1,6,7,2             1
  2,4,9,7             0
  1,2,4,3             0
  8,9,7,6             0
  3,8,6,1             0
  3,4,9,8             0
</pre>

<p>Although this representation seems unusual, it has the
 property that each face is mapped to another polygon.
</p>

<p>For simplexes this has the special property that the face
 need only be represented by one number - the number opposite
 the associated faces vertex.  Hence simplex data structures
 have the links with less memory.
</p>

<p>Since the links are unique, we can use it as a key or function
 argument to operations on the neighbor. eg given 1,6,7,2 what is
 the local index of the neighboring face of polygon 2 which has
 an answerer of 1 if we have +ve indexes only (count from 1) and
 use zero as there being no such face hence if 0 were returned the
 two polygons would have no faces in common.
</p>

<p>What is unusual is that this above would probably process quite quickly!
 Its a strange world.</p>

  
    

<img src="diagg01905.png" alt="diagg01905.png" />

</div>

<div class="float25">
<a id="Dual_Mesh"></a>
<h2>Dual Mesh</h2>

<p>
A dual mesh is made from a simplex mesh by making each simplex a node and connecting
 it with the neighboring nodes.
</p>

<p>In its simplest form this uses no geometry.  For example are the nodes simplexes or
 do we construct a point inside the simplex and make this the node? Here the node know
 is a point in space and not a simplex in space.
</p>

<p>With this definition linked simplexes is a dual mesh because it forms such connections.
</p>

<p> The dual of a triangular mesh produces a mesh of polygons. It would be interesting to
 consider this as a linked structure where each polygon is uniquely associated with a point
 in the triangle mesh.  The points on the outside are not associated with any of the polygons.
 Let each face of the polygon point to a point. Have a table of points pointing to the polygon that
 they are uniquely associated with.  
</p>

<p>While this structure is clean it does not answers questions for points not on the boundary.  For example
 for non-leaf points - those points not on the boundary, by iterating about their polygon all their
 neighboring points can be visited.  It would be nice to have this property for all points so that you could
 iterate about any point in the simplex mesh.
</p>

<p>If we extend the definition so that all the points in the triangle mesh have a 
  unique polygon then the polygons are divided into two types - those on the inside and
 then those on the boundary.  The polygons on the boundary are infinite.  Let the inner points
 be generated from the average of the three points.  Let the outer polygon be defined
 by generating edges perpendicular to the mesh and through the newely generated dual point within
 the mesh. This lets the space be uniquely partitioned, something which a Voronoi Diagram dotes.
</p>

<p>For partition algorithms this is very useful to divide the spaces into unique regions.
</p>

<p>What I with for is a practical algorithm/function to reverse the dual operation to 
 return the original simplex mesh back. Is this possible for convex meshes?
 Actually I believe that this is the property of the Voronoi Diagram. ie the Voronoi diagram
 and Delaunay triangulation are eachothers duals. It would be good to see software that can convert
 between the two meshes.
</p>

<p>Another look at dual meshes is as a new maths.  For example a two adjacent triangles
 mesh has a two points connected by a line dual.  A three fan triangle has a three point line
 as a dual.  Is there a maths theory of any use here? Is this already known?  Is there any maths here?
</p>

<h3>Constructing a Dual Mesh from the Centroid</h3>

<p>Narrow this for a convex hull. In 2D apply to 
  inner simplexes. The outer polygons are created
 by having rays extend from each outer edge point off
 to infinity.  
</p>

<p>The centroid is always inside the triangle.
  For an arbitary triangle on the convex hulls boundary,
 construct a line at right angles to the boundary starting
 from the centroid and extending out to infinity.
</p>

<p>While this partitions the space, is it a reversible
 operation?
</p>





</div>



<div class="float25">
<h2>References</h2>

<ol>
<li>Foley... Second Edit. 1990  page 473</li>

</ol>


</div>

<div class="float25">

<a id="&lt;TODO&gt;"></a>
<h2>&lt;TODO&gt;</h2>

<ul>

<li>Construct a reversible Dual Mesh using centroids in 2D.</li>
</ul>


</div>




</body>
</html>




