<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>.classpath</filename>
    </added>
    <added>
      <filename>.project</filename>
    </added>
    <added>
      <filename>test/geomerative/HelloSplittingShapesTest.java</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -41,8 +41,9 @@
 
 package geomerative;
 
-import java.util.ArrayList ;
-import java.util.List ;
+import java.util.ArrayList;
+import java.util.List;
+import geomerative.RClip.OperationType;
 
 /**
  * &lt;code&gt;Clip&lt;/code&gt; is a Java version of the &lt;i&gt;General RPolygon Clipper&lt;/i&gt; algorithm
@@ -67,24 +68,24 @@ class FastRClip
   // -----------------
   // --- Constants ---
   // -----------------
-  private static final boolean DEBUG = false ;
+  private static final boolean DEBUG = false;
   
   // Maximum precision for floats
-  private static final double GPC_EPSILON = 2.2204460492503131e-016 ;
+  private static final double GPC_EPSILON = 2.2204460492503131e-016;
   //private static final float GPC_EPSILON = 1.192092896e-07F;
   //private static final float GPC_EPSILON = 1F;
-  private static final String GPC_VERSION = &quot;2.31&quot; ;
+  private static final String GPC_VERSION = &quot;2.31&quot;;
   
-  private static final int LEFT  = 0 ;
-  private static final int RIGHT = 1 ;
+  private static final int LEFT  = 0;
+  private static final int RIGHT = 1;
   
-  private static final int ABOVE = 0 ;
-  private static final int BELOW = 1 ;
+  private static final int ABOVE = 0;
+  private static final int BELOW = 1;
   
-  private static final int CLIP = 0 ;
-  private static final int SUBJ = 1 ;
+  private static final int CLIP = 0;
+  private static final int SUBJ = 1;
   
-  private static final boolean INVERT_TRISTRIPS = false ;
+  private static final boolean INVERT_TRISTRIPS = false;
   
   // ------------------------
   // --- Member Variables ---
@@ -101,119 +102,6 @@ class FastRClip
   // ----------------------
   // --- Static Methods ---
   // ----------------------
-  /**
-   * Return the intersection of &lt;code&gt;p1&lt;/code&gt; and &lt;code&gt;p2&lt;/code&gt; where the
-   * return type is of &lt;code&gt;polyClass&lt;/code&gt;.  See the note in the class description
-   * for more on &lt;ocde&gt;polyClass&lt;/code&gt;.
-   *
-   * @param p1        One of the polygons to performt he intersection with
-   * @param p2        One of the polygons to performt he intersection with
-   * @param polyClass The type of &lt;code&gt;RPolygon&lt;/code&gt; to return
-   */
-  static RPolygon intersection( RPolygon p1, RPolygon p2, Class polyClass )
-  {
-    return clip( OperationType.GPC_INT, p1, p2, polyClass );
-  }
-  
-  /**
-   * Return the union of &lt;code&gt;p1&lt;/code&gt; and &lt;code&gt;p2&lt;/code&gt; where the
-   * return type is of &lt;code&gt;polyClass&lt;/code&gt;.  See the note in the class description
-   * for more on &lt;ocde&gt;polyClass&lt;/code&gt;.
-   *
-   * @param p1        One of the polygons to performt he union with
-   * @param p2        One of the polygons to performt he union with
-   * @param polyClass The type of &lt;code&gt;RPolygon&lt;/code&gt; to return
-   */
-  static RPolygon union( RPolygon p1, RPolygon p2, Class polyClass )
-  {
-    return clip( OperationType.GPC_UNION, p1, p2, polyClass );
-  }
-  
-  /**
-   * Return the xor of &lt;code&gt;p1&lt;/code&gt; and &lt;code&gt;p2&lt;/code&gt; where the
-   * return type is of &lt;code&gt;polyClass&lt;/code&gt;.  See the note in the class description
-   * for more on &lt;ocde&gt;polyClass&lt;/code&gt;.
-   *
-   * @param p1        One of the polygons to performt he xor with
-   * @param p2        One of the polygons to performt he xor with
-   * @param polyClass The type of &lt;code&gt;RPolygon&lt;/code&gt; to return
-   */
-  static RPolygon xor( RPolygon p1, RPolygon p2, Class polyClass )
-  {
-    return clip( OperationType.GPC_XOR, p1, p2, polyClass );
-  }
-  
-  /**
-   * Return the diff of &lt;code&gt;p1&lt;/code&gt; and &lt;code&gt;p2&lt;/code&gt; where the
-   * return type is of &lt;code&gt;polyClass&lt;/code&gt;.  See the note in the class description
-   * for more on &lt;ocde&gt;polyClass&lt;/code&gt;.
-   *
-   * @param p1        One of the polygons to performt he diff with
-   * @param p2        One of the polygons to performt he diff with
-   * @param polyClass The type of &lt;code&gt;RPolygon&lt;/code&gt; to return
-   */
-  static RPolygon diff( RPolygon p1, RPolygon p2, Class polyClass )
-  {
-    return clip( OperationType.GPC_DIFF, p1, p2, polyClass );
-  }
-  
-  /**
-   * Return the intersection of &lt;code&gt;p1&lt;/code&gt; and &lt;code&gt;p2&lt;/code&gt; where the
-   * return type is of &lt;code&gt;PolyDefault&lt;/code&gt;. 
-   *
-   * @param p1 One of the polygons to performt he intersection with
-   * @param p2 One of the polygons to performt he intersection with
-   */
-  static RPolygon intersection( RPolygon p1, RPolygon p2 )
-  {
-    return clip( OperationType.GPC_INT, p1, p2, RPolygon.class );
-  }
-  
-  /**
-   * Return the union of &lt;code&gt;p1&lt;/code&gt; and &lt;code&gt;p2&lt;/code&gt; where the
-   * return type is of &lt;code&gt;PolyDefault&lt;/code&gt;. 
-   *
-   * @param p1 One of the polygons to performt he union with
-   * @param p2 One of the polygons to performt he union with
-   */
-  static RPolygon union( RPolygon p1, RPolygon p2 )
-  {
-    return clip( OperationType.GPC_UNION, p1, p2, RPolygon.class );
-  }
-  
-  /**
-   * Return the xor of &lt;code&gt;p1&lt;/code&gt; and &lt;code&gt;p2&lt;/code&gt; where the
-   * return type is of &lt;code&gt;PolyDefault&lt;/code&gt;. 
-   *
-   * @param p1 One of the polygons to performt he xor with
-   * @param p2 One of the polygons to performt he xor with
-   */
-  static RPolygon xor( RPolygon p1, RPolygon p2 )
-  {
-    return clip( OperationType.GPC_XOR, p1, p2, RPolygon.class );
-  }
-  
-  /**
-   * Return the diff of &lt;code&gt;p1&lt;/code&gt; and &lt;code&gt;p2&lt;/code&gt; where the
-   * return type is of &lt;code&gt;PolyDefault&lt;/code&gt;. 
-   *
-   * @param p1 One of the polygons to performt he diff with
-   * @param p2 One of the polygons to performt he diff with
-   */
-  static RPolygon diff( RPolygon p1, RPolygon p2 )
-  {
-    return clip( OperationType.GPC_DIFF, p1, p2, RPolygon.class );
-  }
-  
-  /**
-   * Updates &lt;code&gt;p1&lt;/code&gt;. 
-   *
-   * @param p1 One of the polygons to performt he diff with
-   */
-  static RPolygon update( RPolygon p1 )
-  {
-    return clip( OperationType.GPC_DIFF, p1, new RPolygon(), RPolygon.class );
-  }
   
   
   // -----------------------
@@ -239,16 +127,17 @@ class FastRClip
    * &lt;code&gt;clip()&lt;/code&gt; is the main method of the clipper algorithm.
    * This is where the conversion from really begins.
    */
-  private static RPolygon clip( OperationType op, RPolygon subj, RPolygon clip, Class polyClass )
+  static RPolygon clip( OperationType op, RPolygon subj, RPolygon clip, Class polyClass )
   {
-    RPolygon result = createNewPoly( polyClass ) ;
+    RPolygon result = createNewPoly( polyClass );
+    TopPolygonNode out_poly = new TopPolygonNode(); // used to create resulting RPolygon
     
     /* Test for trivial NULL result cases */
     if( (subj.isEmpty() &amp;&amp; clip.isEmpty()) ||
         (subj.isEmpty() &amp;&amp; ((op == OperationType.GPC_INT) || (op == OperationType.GPC_DIFF))) ||
         (clip.isEmpty() &amp;&amp;  (op == OperationType.GPC_INT)) )
       {
-        return result ;
+        return null;
       }
     
     /* Identify potentialy contributing contours */
@@ -261,33 +150,21 @@ class FastRClip
     /* Build LMT */
     LmtTable lmt_table = new LmtTable();
     ScanBeamTreeEntries sbte = new ScanBeamTreeEntries();
-    EdgeTable s_heap = null ;
-    EdgeTable c_heap = null ;
+    EdgeTable s_heap = null;
+    EdgeTable c_heap = null;
     if (!subj.isEmpty())
       {
         s_heap = build_lmt(lmt_table, sbte, subj, SUBJ, op);
       }
-    if( DEBUG )
-      {
-        System.out.println(&quot;&quot;);
-        System.out.println(&quot; ------------ After build_lmt for subj ---------&quot;);
-        lmt_table.print();
-      }
     if (!clip.isEmpty())
       {
         c_heap = build_lmt(lmt_table, sbte, clip, CLIP, op);
       }
-    if( DEBUG )
-      {
-        System.out.println(&quot;&quot;);
-        System.out.println(&quot; ------------ After build_lmt for clip ---------&quot;);
-        lmt_table.print();
-      }
     
     /* Return a NULL result if no contours contribute */
     if (lmt_table.top_node == null)
       {
-        return result;
+        return null;
       }
     
     /* Build scanbeam table from scanbeam tree */
@@ -302,25 +179,18 @@ class FastRClip
         parity_clip= RIGHT;
       }
     
-    if( DEBUG )
-      {
-        print_sbt(sbt);
-      }
-    
-    LmtNode local_min = lmt_table.top_node ;
-    
-    TopPolygonNode out_poly = new TopPolygonNode(); // used to create resulting RPolygon
+    LmtNode local_min = lmt_table.top_node;
     
     AetTree aet = new AetTree();
-    int scanbeam = 0 ;
+    int scanbeam = 0;
     
     /* Process each scanbeam */
     while( scanbeam &lt; sbt.length )
       {
         /* Set yb and yt to the bottom and top of the scanbeam */
         float yb = sbt[scanbeam++];
-        float yt = 0.0F ;
-        float dy = 0.0F ;
+        float yt = 0.0F;
+        float dy = 0.0F;
         if( scanbeam &lt; sbt.length )
           {
             yt = sbt[scanbeam];
@@ -335,7 +205,7 @@ class FastRClip
             if (local_min.y == yb)
               {
                 /* Add edges starting at this local minimum to the AET */
-                for( EdgeNode edge = local_min.first_bound; (edge != null) ; edge= edge.next_bound)
+                for( EdgeNode edge = local_min.first_bound; (edge != null); edge= edge.next_bound)
                   {
                     add_edge_to_aet( aet, edge );
                   }
@@ -344,30 +214,26 @@ class FastRClip
               }
           }
         
-        if( DEBUG )
-          {
-            aet.print();
-          }
         /* Set dummy previous x value */
-        float px = -Float.MAX_VALUE ;
+        float px = -Float.MAX_VALUE;
         
         /* Create bundles within AET */
-        EdgeNode e0 = aet.top_node ;
-        EdgeNode e1 = aet.top_node ;
+        EdgeNode e0 = aet.top_node;
+        EdgeNode e1 = aet.top_node;
         
         /* Set up bundle fields of first edge */
         aet.top_node.bundle_above[ aet.top_node.type ] = (aet.top_node.top_y != yb) ? 1 : 0;
         aet.top_node.bundle_above[ ((aet.top_node.type==0) ? 1 : 0) ] = 0;
         aet.top_node.bstate_above = BundleState.UNBUNDLED;
         
-        for (EdgeNode next_edge= aet.top_node.next ; (next_edge != null); next_edge = next_edge.next)
+        for ( EdgeNode next_edge = aet.top_node.next; (next_edge != null); next_edge = next_edge.next)
           {
-            int ne_type = next_edge.type ;
+            int ne_type = next_edge.type;
             int ne_type_opp = ((next_edge.type==0) ? 1 : 0); //next edge type opposite
             
             /* Set up bundle fields of next edge */
             next_edge.bundle_above[ ne_type     ]= (next_edge.top_y != yb) ? 1 : 0;
-            next_edge.bundle_above[ ne_type_opp ] = 0 ;
+            next_edge.bundle_above[ ne_type_opp ] = 0;
             next_edge.bstate_above = BundleState.UNBUNDLED;
             
             /* Bundle edges above the scanbeam boundary if they coincide */
@@ -389,13 +255,13 @@ class FastRClip
         int horiz_clip = HState.NH;
         int horiz_subj = HState.NH;
         
-        int exists_clip = 0 ;
-        int exists_subj = 0 ;
+        int exists_clip = 0;
+        int exists_subj = 0;
         
-        PolygonNode cf = null ;
+        PolygonNode cf = null;
         
         /* Process each edge at this scanbeam boundary */
-        for (EdgeNode edge= aet.top_node ; (edge != null); edge = edge.next )
+        for ( EdgeNode edge = aet.top_node; (edge != null); edge = edge.next )
           {
             exists_clip = edge.bundle_above[CLIP] + (edge.bundle_below_clip &lt;&lt; 1);
             exists_subj = edge.bundle_above[SUBJ] + (edge.bundle_below_subj &lt;&lt; 1);
@@ -406,8 +272,8 @@ class FastRClip
                 edge.bside_clip = parity_clip;
                 edge.bside_subj = parity_subj;
                 
-                boolean contributing = false ;
-                int br=0, bl=0, tr=0, tl=0 ;
+                boolean contributing = false;
+                int br=0, bl=0, tr=0, tl=0;
                 /* Determine contributing status and quadrant occupancies */
                 if( (op == OperationType.GPC_DIFF) || (op == OperationType.GPC_INT) )
                   {
@@ -462,7 +328,7 @@ class FastRClip
                     horiz_subj = HState.next_h_state[horiz_subj][((exists_subj - 1) &lt;&lt; 1) + parity_subj];
                   }
                 
-                if (contributing)
+                if (contributing) // DIFFERENT!
                   {
                     float xb = edge.xb;
                     
@@ -562,19 +428,15 @@ class FastRClip
                       } /* End of switch */
                   } /* End of contributing conditional */
               } /* End of edge exists conditional */
-            if( DEBUG )
-              {
-                out_poly.print();
-              }
           } /* End of AET loop */
         
         /* Delete terminating edges from the AET, otherwise compute xt */
-        for (EdgeNode edge = aet.top_node ; (edge != null); edge = edge.next)
+        for (EdgeNode edge = aet.top_node; (edge != null); edge = edge.next)
           {
             if (edge.top_y == yb)
               {
                 EdgeNode prev_edge = edge.prev;
-                EdgeNode next_edge= edge.next;
+                EdgeNode next_edge = edge.next;
                 
                 if (prev_edge != null)
                   prev_edge.next = next_edge;
@@ -619,7 +481,7 @@ class FastRClip
             it_table.build_intersection_table(aet, dy);
             
             /* Process each node in the intersection table */
-            for (ItNode intersect = it_table.top_node ; (intersect != null); intersect = intersect.next)
+            for (ItNode intersect = it_table.top_node; (intersect != null); intersect = intersect.next)
               {
                 e0= intersect.ie0;
                 e1= intersect.ie1;
@@ -630,8 +492,8 @@ class FastRClip
                   {
                     PolygonNode p = e0.outp_above;
                     PolygonNode q = e1.outp_above;
-                    float ix = intersect.point.x;
-                    float iy = intersect.point.y + yb;
+                    float ix = intersect.point_x;
+                    float iy = intersect.point_y + yb;
                     
                     int in_clip = ( ( (e0.bundle_above[CLIP]!=0) &amp;&amp; !(e0.bside_clip!=0)) ||
                                     ( (e1.bundle_above[CLIP]!=0) &amp;&amp;  (e1.bside_clip!=0)) ||
@@ -643,7 +505,7 @@ class FastRClip
                                     (!(e0.bundle_above[SUBJ]!=0) &amp;&amp; !(e1.bundle_above[SUBJ]!=0) &amp;&amp;
                                      (e0.bside_subj!=0) &amp;&amp; (e1.bside_subj!=0) ) ) ? 1 : 0;
                     
-                    int tr=0, tl=0, br=0, bl=0 ;
+                    int tr=0, tl=0, br=0, bl=0;
                     /* Determine quadrant occupancies */
                     if( (op == OperationType.GPC_DIFF) || (op == OperationType.GPC_INT) )
                       {
@@ -810,10 +672,6 @@ class FastRClip
                 e0.next.prev = prev_edge;
                 e1.next.prev = e1;
                 e0.next      = next_edge;
-                if( DEBUG )
-                  {
-                    out_poly.print();
-                  }
               } /* End of IT loop*/
             
             /* Prepare for next scanbeam */
@@ -861,14 +719,10 @@ class FastRClip
   /**
    * Clipper to output tristrips
    */
-  private static PolygonNode clip( OperationType op, RPolygon subj, RPolygon clip )
-  {
-    PolygonNode tlist=null, tnn, tn;
-    EdgeNode prev_edge, next_edge, edge, cf=null, succ_edge, e0, e1;
-    VertexNode lt, ltn, rt, rtn;
-    int cft=VertexType.LED;
-    float []sbt;
-    float xb, px, nx=0, yb, yt, dy, ix, iy;
+  static RMesh clip( OperationType op, RPolygon subj, RPolygon clip )
+  {    
+    PolygonNode tlist = null;
+    float nx = 0;
     
     /* Test for trivial NULL result cases */
     if( (subj.isEmpty() &amp;&amp; clip.isEmpty()) ||
@@ -888,28 +742,16 @@ class FastRClip
     /* Build LMT */
     LmtTable lmt_table = new LmtTable();
     ScanBeamTreeEntries sbte = new ScanBeamTreeEntries();
-    EdgeTable s_heap = null ;
-    EdgeTable c_heap = null ;
+    EdgeTable s_heap = null;
+    EdgeTable c_heap = null;
     if (!subj.isEmpty())
       {
         s_heap = build_lmt(lmt_table, sbte, subj, SUBJ, op);
       }
-    if( DEBUG )
-      {
-        System.out.println(&quot;&quot;);
-        System.out.println(&quot; ------------ After build_lmt for subj ---------&quot;);
-        lmt_table.print();
-      }
     if (!clip.isEmpty())
       {
         c_heap = build_lmt(lmt_table, sbte, clip, CLIP, op);
       }
-    if( DEBUG )
-      {
-        System.out.println(&quot;&quot;);
-        System.out.println(&quot; ------------ After build_lmt for clip ---------&quot;);
-        lmt_table.print();
-      }
     
     /* Return a NULL result if no contours contribute */
     if (lmt_table.top_node == null)
@@ -918,7 +760,7 @@ class FastRClip
       }
     
     /* Build scanbeam table from scanbeam tree */
-    sbt = sbte.build_sbt();
+    float[] sbt = sbte.build_sbt();
     
     int parity_clip = LEFT;
     int parity_subj = LEFT;
@@ -929,23 +771,18 @@ class FastRClip
         parity_clip= RIGHT;
       }
     
-    if( DEBUG )
-      {
-        print_sbt(sbt);
-      }
-    
-    LmtNode local_min = lmt_table.top_node ;
+    LmtNode local_min = lmt_table.top_node;
     
     AetTree aet = new AetTree();
-    int scanbeam = 0 ;
+    int scanbeam = 0;
     
     /* Process each scanbeam */
     while( scanbeam &lt; sbt.length )
       {
         /* Set yb and yt to the bottom and top of the scanbeam */
-        yb = sbt[scanbeam++];
-        yt = 0.0F ;
-        dy = 0.0F ;
+        float yb = sbt[scanbeam++];
+        float yt = 0.0F;
+        float dy = 0.0F;
         if( scanbeam &lt; sbt.length )
           {
             yt = sbt[scanbeam];
@@ -953,709 +790,650 @@ class FastRClip
           }
         
         /* === SCANBEAM BOUNDARY PROCESSING ================================ */
-
+        
         /* If LMT node corresponding to yb exists */
         if (local_min != null )
-        {
-          if (local_min.y == yb)
           {
-            /* Add edges starting at this local minimum to the AET */
-            for( edge = local_min.first_bound; (edge != null) ; edge= edge.next_bound)
-            {
-              add_edge_to_aet( aet, edge );
-            }
-
-            local_min = local_min.next;
+            if (local_min.y == yb)
+              {
+                /* Add edges starting at this local minimum to the AET */
+                for( EdgeNode edge = local_min.first_bound; (edge != null); edge= edge.next_bound)
+                  {
+                    add_edge_to_aet( aet, edge );
+                  }
+                
+                local_min = local_min.next;
+              }
           }
-        }
-
-        if( DEBUG )
-        {
-          aet.print();
-        }
+        
         /* Set dummy previous x value */
-        px = -Float.MAX_VALUE ;
-
+        float px = -Float.MAX_VALUE;
+        
         /* Create bundles within AET */
-        e0 = aet.top_node ;
-        e1 = aet.top_node ;
-
+        EdgeNode e0 = aet.top_node;
+        EdgeNode e1 = aet.top_node;
+        
         /* Set up bundle fields of first edge */
         aet.top_node.bundle_above[ aet.top_node.type ] = (aet.top_node.top_y != yb) ? 1 : 0;
         aet.top_node.bundle_above[ ((aet.top_node.type==0) ? 1 : 0) ] = 0;
         aet.top_node.bstate_above = BundleState.UNBUNDLED;
-
-        for (next_edge= aet.top_node.next ; (next_edge != null); next_edge = next_edge.next)
-        {
-          int ne_type = next_edge.type ;
-          int ne_type_opp = ((next_edge.type==0) ? 1 : 0); //next edge type opposite
-
-          /* Set up bundle fields of next edge */
-          next_edge.bundle_above[ ne_type     ]= (next_edge.top_y != yb) ? 1 : 0;
-          next_edge.bundle_above[ ne_type_opp ] = 0 ;
-          next_edge.bstate_above = BundleState.UNBUNDLED;
-
-          /* Bundle edges above the scanbeam boundary if they coincide */
-          if ( next_edge.bundle_above[ne_type] == 1 )
+        
+        for ( EdgeNode next_edge = aet.top_node.next; (next_edge != null); next_edge = next_edge.next)
           {
-            if (EQ(e0.xb, next_edge.xb) &amp;&amp; EQ(e0.dx, next_edge.dx) &amp;&amp; (e0.top_y != yb))
-            {
-              next_edge.bundle_above[ ne_type     ] ^= e0.bundle_above[ ne_type     ];
-              next_edge.bundle_above[ ne_type_opp ]  = e0.bundle_above[ ne_type_opp ];
-              next_edge.bstate_above = BundleState.BUNDLE_HEAD;
-              e0.bundle_above[CLIP] = 0;
-              e0.bundle_above[SUBJ] = 0;
-              e0.bstate_above = BundleState.BUNDLE_TAIL;
-            }
-            e0 = next_edge;
+            int ne_type = next_edge.type;
+            int ne_type_opp = ((next_edge.type==0) ? 1 : 0); //next edge type opposite
+            
+            /* Set up bundle fields of next edge */
+            next_edge.bundle_above[ ne_type     ]= (next_edge.top_y != yb) ? 1 : 0;
+            next_edge.bundle_above[ ne_type_opp ] = 0;
+            next_edge.bstate_above = BundleState.UNBUNDLED;
+            
+            /* Bundle edges above the scanbeam boundary if they coincide */
+            if ( next_edge.bundle_above[ne_type] == 1 )
+              {
+                if (EQ(e0.xb, next_edge.xb) &amp;&amp; EQ(e0.dx, next_edge.dx) &amp;&amp; (e0.top_y != yb))
+                  {
+                    next_edge.bundle_above[ ne_type     ] ^= e0.bundle_above[ ne_type     ];
+                    next_edge.bundle_above[ ne_type_opp ]  = e0.bundle_above[ ne_type_opp ];
+                    next_edge.bstate_above = BundleState.BUNDLE_HEAD;
+                    e0.bundle_above[CLIP] = 0;
+                    e0.bundle_above[SUBJ] = 0;
+                    e0.bstate_above = BundleState.BUNDLE_TAIL;
+                  }
+                e0 = next_edge;
+              }
           }
-        }
-
+        
         int horiz_clip = HState.NH;
         int horiz_subj = HState.NH;
-
-        int exists_clip = 0 ;
-        int exists_subj = 0 ;
-
+        
+        int exists_clip = 0;
+        int exists_subj = 0;
+        
+        
+        EdgeNode cf = null;
+        int cft = VertexType.LED;
+        
         /* Process each edge at this scanbeam boundary */
-        for (edge= aet.top_node ; (edge != null); edge = edge.next )
-        {
-          exists_clip = edge.bundle_above[CLIP] + (edge.bundle_below_clip &lt;&lt; 1);
-          exists_subj = edge.bundle_above[SUBJ] + (edge.bundle_below_subj &lt;&lt; 1);
-
-          if( (exists_clip != 0) || (exists_subj != 0) )
+        for ( EdgeNode edge = aet.top_node; (edge != null); edge = edge.next )
           {
-            /* Set bundle side */
-            edge.bside_clip = parity_clip;
-            edge.bside_subj = parity_subj;
-
-            boolean contributing = false ;
-            int br=0, bl=0, tr=0, tl=0 ;
-            /* Determine contributing status and quadrant occupancies */
-            if( (op == OperationType.GPC_DIFF) || (op == OperationType.GPC_INT) )
-            {
-              contributing= ((exists_clip!=0) &amp;&amp; ((parity_subj!=0) || (horiz_subj!=0))) ||
-                ((exists_subj!=0) &amp;&amp; ((parity_clip!=0) || (horiz_clip!=0))) ||
-                ((exists_clip!=0) &amp;&amp; (exists_subj!=0) &amp;&amp; (parity_clip == parity_subj));
-              br = ((parity_clip!=0) &amp;&amp; (parity_subj!=0)) ? 1 : 0;
-              bl = ( ((parity_clip ^ edge.bundle_above[CLIP])!=0) &amp;&amp;
-                ((parity_subj ^ edge.bundle_above[SUBJ])!=0) ) ? 1 : 0;
-              tr = ( ((parity_clip ^ ((horiz_clip!=HState.NH)?1:0)) !=0) &amp;&amp; 
-                ((parity_subj ^ ((horiz_subj!=HState.NH)?1:0)) !=0) ) ? 1 : 0;
-              tl = (((parity_clip ^ ((horiz_clip!=HState.NH)?1:0) ^ edge.bundle_below_clip)!=0) &amp;&amp;
-                ((parity_subj ^ ((horiz_subj!=HState.NH)?1:0) ^ edge.bundle_below_subj)!=0))?1:0;
-            }
-            else if( op == OperationType.GPC_XOR )
-            {
-              contributing= (exists_clip!=0) || (exists_subj!=0);
-              br= (parity_clip) ^ (parity_subj);
-              bl= (parity_clip ^ edge.bundle_above[CLIP]) ^ (parity_subj ^ edge.bundle_above[SUBJ]);
-              tr= (parity_clip ^ ((horiz_clip!=HState.NH)?1:0)) ^ (parity_subj ^ ((horiz_subj!=HState.NH)?1:0));
-              tl= (parity_clip ^ ((horiz_clip!=HState.NH)?1:0) ^ edge.bundle_below_clip)
-                ^ (parity_subj ^ ((horiz_subj!=HState.NH)?1:0) ^ edge.bundle_below_subj);
-            }
-            else if( op == OperationType.GPC_UNION )
-            {
-              contributing= ((exists_clip!=0) &amp;&amp; (!(parity_subj!=0) || (horiz_subj!=0))) ||
-                ((exists_subj!=0) &amp;&amp; (!(parity_clip!=0) || (horiz_clip!=0))) ||
-                ((exists_clip!=0) &amp;&amp; (exists_subj!=0) &amp;&amp; (parity_clip == parity_subj));
-              br= ((parity_clip!=0) || (parity_subj!=0))?1:0;
-              bl= (((parity_clip ^ edge.bundle_above[CLIP])!=0) || ((parity_subj ^ edge.bundle_above[SUBJ])!=0))?1:0;
-              tr= ( ((parity_clip ^ ((horiz_clip!=HState.NH)?1:0))!=0) || 
-                ((parity_subj ^ ((horiz_subj!=HState.NH)?1:0))!=0) ) ?1:0;
-              tl= ( ((parity_clip ^ ((horiz_clip!=HState.NH)?1:0) ^ edge.bundle_below_clip)!=0) ||
-                ((parity_subj ^ ((horiz_subj!=HState.NH)?1:0) ^ edge.bundle_below_subj)!=0) ) ? 1:0;
-            }
-            else
-            {
-              throw new IllegalStateException(&quot;Unknown op&quot;);
-            }
-
-            /* Update parity */
-            parity_clip ^= edge.bundle_above[CLIP];
-            parity_subj ^= edge.bundle_above[SUBJ];
-
-            /* Update horizontal state */
-            if (exists_clip!=0)
-            {
-              horiz_clip = HState.next_h_state[horiz_clip][((exists_clip - 1) &lt;&lt; 1) + parity_clip];
-            }
-            if( exists_subj!=0)
-            {
-              horiz_subj = HState.next_h_state[horiz_subj][((exists_subj - 1) &lt;&lt; 1) + parity_subj];
-            }
-
-            if (contributing)
-            {
-              xb = edge.xb;
-
-
-              int vclass = VertexType.getType( tr, tl, br, bl );
-              switch (vclass)
+            exists_clip = edge.bundle_above[CLIP] + (edge.bundle_below_clip &lt;&lt; 1);
+            exists_subj = edge.bundle_above[SUBJ] + (edge.bundle_below_subj &lt;&lt; 1);
+            
+            if( (exists_clip != 0) || (exists_subj != 0) )
               {
-                case VertexType.EMN:
-                tlist=new_tristrip(tlist, edge, xb, yb);
-                cf= edge;
-                break;
-                case VertexType.ERI:
-                edge.outp_above= cf.outp_above;
-                if (xb != cf.xb)
-                {
-                  edge.outp_above.v_right=add_vertex(edge.outp_above.v_right,  xb,  yb);
-                  edge.outp_above.active++;
-                }
-                cf= null;
-                break;
-                case VertexType.ELI:
-                edge.outp_below.v_left=add_vertex(edge.outp_below.v_left,  xb,  yb);
-                edge.outp_above.active++;
-                edge.outp_above= null;
-                cf= edge;
-                break;
-                case VertexType.EMX:
-                if (xb != cf.xb)
-                {
-                  edge.outp_below.v_right=add_vertex(edge.outp_below.v_right,  xb,  yb);
-                  edge.outp_above.active++;
-                }
-                edge.outp_above = null;
-                cf= null;
-                break;
-                case VertexType.IMN:
-                if (cft == VertexType.LED)
-                {
-                  if (cf.bot_y != yb)
+                /* Set bundle side */
+                edge.bside_clip = parity_clip;
+                edge.bside_subj = parity_subj;
+                
+                boolean contributing = false;
+                int br=0, bl=0, tr=0, tl=0;
+                /* Determine contributing status and quadrant occupancies */
+                if( (op == OperationType.GPC_DIFF) || (op == OperationType.GPC_INT) )
+                  {
+                    contributing= ((exists_clip!=0) &amp;&amp; ((parity_subj!=0) || (horiz_subj!=0))) ||
+                      ((exists_subj!=0) &amp;&amp; ((parity_clip!=0) || (horiz_clip!=0))) ||
+                      ((exists_clip!=0) &amp;&amp; (exists_subj!=0) &amp;&amp; (parity_clip == parity_subj));
+                    br = ((parity_clip!=0) &amp;&amp; (parity_subj!=0)) ? 1 : 0;
+                    bl = ( ((parity_clip ^ edge.bundle_above[CLIP])!=0) &amp;&amp;
+                           ((parity_subj ^ edge.bundle_above[SUBJ])!=0) ) ? 1 : 0;
+                    tr = ( ((parity_clip ^ ((horiz_clip!=HState.NH)?1:0)) !=0) &amp;&amp; 
+                           ((parity_subj ^ ((horiz_subj!=HState.NH)?1:0)) !=0) ) ? 1 : 0;
+                    tl = (((parity_clip ^ ((horiz_clip!=HState.NH)?1:0) ^ edge.bundle_below_clip)!=0) &amp;&amp;
+                          ((parity_subj ^ ((horiz_subj!=HState.NH)?1:0) ^ edge.bundle_below_subj)!=0))?1:0;
+                  }
+                else if( op == OperationType.GPC_XOR )
                   {
-                    cf.outp_below.v_left=add_vertex(cf.outp_below.v_left,  cf.xb,  yb);
-                    cf.outp_below.active++;
+                    contributing= (exists_clip!=0) || (exists_subj!=0);
+                    br= (parity_clip) ^ (parity_subj);
+                    bl= (parity_clip ^ edge.bundle_above[CLIP]) ^ (parity_subj ^ edge.bundle_above[SUBJ]);
+                    tr= (parity_clip ^ ((horiz_clip!=HState.NH)?1:0)) ^ (parity_subj ^ ((horiz_subj!=HState.NH)?1:0));
+                    tl= (parity_clip ^ ((horiz_clip!=HState.NH)?1:0) ^ edge.bundle_below_clip)
+                      ^ (parity_subj ^ ((horiz_subj!=HState.NH)?1:0) ^ edge.bundle_below_subj);
                   }
-                  tlist=new_tristrip(tlist, cf, cf.xb, yb);
-                }
-                edge.outp_above= cf.outp_above;
-                edge.outp_above.v_right=add_vertex(edge.outp_above.v_right,  xb,  yb);
-                edge.outp_above.active++;
-                break;
-                case VertexType.ILI:
-                tlist=new_tristrip(tlist, edge, xb, yb);
-                cf= edge;
-                cft= VertexType.ILI;
-                break;
-                case VertexType.IRI:
-                if (cft == VertexType.LED)
-                {
-                  if (cf.bot_y != yb)
+                else if( op == OperationType.GPC_UNION )
                   {
-                    cf.outp_below.v_left=add_vertex(cf.outp_below.v_left,  cf.xb,  yb);
-                    cf.outp_below.active++;
+                    contributing= ((exists_clip!=0) &amp;&amp; (!(parity_subj!=0) || (horiz_subj!=0))) ||
+                      ((exists_subj!=0) &amp;&amp; (!(parity_clip!=0) || (horiz_clip!=0))) ||
+                      ((exists_clip!=0) &amp;&amp; (exists_subj!=0) &amp;&amp; (parity_clip == parity_subj));
+                    br= ((parity_clip!=0) || (parity_subj!=0))?1:0;
+                    bl= (((parity_clip ^ edge.bundle_above[CLIP])!=0) || ((parity_subj ^ edge.bundle_above[SUBJ])!=0))?1:0;
+                    tr= ( ((parity_clip ^ ((horiz_clip!=HState.NH)?1:0))!=0) || 
+                          ((parity_subj ^ ((horiz_subj!=HState.NH)?1:0))!=0) ) ?1:0;
+                    tl= ( ((parity_clip ^ ((horiz_clip!=HState.NH)?1:0) ^ edge.bundle_below_clip)!=0) ||
+                          ((parity_subj ^ ((horiz_subj!=HState.NH)?1:0) ^ edge.bundle_below_subj)!=0) ) ? 1:0;
                   }
-                  tlist=new_tristrip(tlist, cf, cf.xb, yb);
-                }
-                edge.outp_below.v_right=add_vertex(edge.outp_below.v_right,  xb,  yb);
-                edge.outp_above.active++;
-                edge.outp_above= null;
-                break;
-                case VertexType.IMX:
-                edge.outp_below.v_left=add_vertex(edge.outp_below.v_left,  xb,  yb);
-                edge.outp_above.active++;
-                edge.outp_above= null;
-                cft= VertexType.IMX;
-                break;
-                case VertexType.IMM:
-                edge.outp_below.v_left=add_vertex(edge.outp_below.v_left,  xb,  yb);
-                edge.outp_above.active++;
-                edge.outp_above= cf.outp_above;
-                if (xb != cf.xb)
-                {
-                  cf.outp_above.v_right=add_vertex(cf.outp_above.v_right,  xb,  yb);
-                  cf.outp_above.active++;
-                }
-                cf= edge;
-                break;
-                case VertexType.EMM:
-                edge.outp_below.v_right=add_vertex(edge.outp_below.v_right,  xb,  yb);
-                edge.outp_above.active++;
-                edge.outp_above= null;
-                tlist=new_tristrip(tlist, edge, xb, yb);
-                cf= edge;
-                break;
-                case VertexType.LED:
-                if (edge.bot_y == yb) {
-                  edge.outp_below.v_left=add_vertex(edge.outp_below.v_left,  xb,  yb);
-                  edge.outp_above.active++;
-                }
-                edge.outp_above= edge.outp_below;
-                cf= edge;
-                cft= VertexType.LED;
-                break;
-                case VertexType.RED:
-                edge.outp_above= cf.outp_above;
-                if (cft == VertexType.LED)
-                {
-                  if (cf.bot_y == yb)
+                else
                   {
-                    edge.outp_below.v_right=add_vertex(edge.outp_below.v_right,  xb,  yb);
-                    edge.outp_above.active++;
+                    throw new IllegalStateException(&quot;Unknown op&quot;);
                   }
-                  else
+                
+                /* Update parity */
+                parity_clip ^= edge.bundle_above[CLIP];
+                parity_subj ^= edge.bundle_above[SUBJ];
+                
+                /* Update horizontal state */
+                if (exists_clip!=0)
                   {
-                    if (edge.bot_y == yb)
-                    {
-                      cf.outp_below.v_left=add_vertex(cf.outp_below.v_left,  cf.xb,  yb);
-                      cf.outp_below.active++;
-                      edge.outp_below.v_right=add_vertex(edge.outp_below.v_right,  xb,  yb);
-                      edge.outp_above.active++;
-                    }
+                    horiz_clip = HState.next_h_state[horiz_clip][((exists_clip - 1) &lt;&lt; 1) + parity_clip];
                   }
-                }
-                else
-                {
-                  edge.outp_below.v_right=add_vertex(edge.outp_below.v_right,  xb,  yb);
-                  edge.outp_above.active++;
-                  edge.outp_above.v_right=add_vertex(edge.outp_above.v_right,  xb,  yb);
-                  edge.outp_above.active++;
-                }
-                cf= null;
-                break;
-                default:
-                break;
-              } /* End of switch */
-            } /* End of contributing conditional */
-          } /* End of edge exists conditional */
-        } /* End of AET loop */
-
+                if( exists_subj!=0)
+                  {
+                    horiz_subj = HState.next_h_state[horiz_subj][((exists_subj - 1) &lt;&lt; 1) + parity_subj];
+                  }
+                
+                if (contributing) // DIFFERENT!
+                  {
+                    float xb = edge.xb;
+                    
+                    int vclass = VertexType.getType( tr, tl, br, bl );
+                    switch (vclass)
+                      {
+                      case VertexType.EMN:
+                     	tlist=new_tristrip(tlist, edge, xb, yb);
+                     	cf= edge;
+                     	break;
+                      case VertexType.ERI:
+                        edge.outp_above= cf.outp_above;
+                        if (xb != cf.xb)
+                          {
+                            VERTEX(edge, ABOVE, RIGHT, xb, yb);
+                          }
+                        cf= null;
+                        break;
+                      case VertexType.ELI:
+                        VERTEX(edge, BELOW, LEFT, xb, yb);
+                        edge.outp_above= null;
+                        cf= edge;
+                        break;
+                      case VertexType.EMX:
+                        if (xb != cf.xb)
+                          {
+                            VERTEX(edge, BELOW, RIGHT, xb, yb);
+                          }
+                        edge.outp_above = null;
+                        cf= null;
+                        break;
+                      case VertexType.IMN:
+                     	if (cft == VertexType.LED)
+                          {
+                            if (cf.bot_y != yb)
+                              {
+                                VERTEX(cf, BELOW, LEFT, cf.xb, yb);
+                              }
+                            tlist=new_tristrip(tlist, cf, cf.xb, yb);
+                          }
+            		edge.outp_above= cf.outp_above;
+            		VERTEX(edge, ABOVE, RIGHT, xb, yb);
+            		break;
+                      case VertexType.ILI:
+                        tlist=new_tristrip(tlist, edge, xb, yb);
+            		cf= edge;
+            		cft= VertexType.ILI;
+            		break;
+                      case VertexType.IRI:
+                        if (cft == VertexType.LED)
+                          {
+                            if (cf.bot_y != yb)
+                              {
+                                VERTEX(cf, BELOW, LEFT, cf.xb, yb);
+                              }
+                            tlist=new_tristrip(tlist, cf, cf.xb, yb);
+                          }
+            		VERTEX(edge, BELOW, RIGHT, xb, yb);
+            		edge.outp_above= null;
+            		break;
+                      case VertexType.IMX:
+                        VERTEX(edge, BELOW, LEFT, xb, yb);
+            		edge.outp_above= null;
+            		cft= VertexType.IMX;
+            		break;
+                      case VertexType.IMM:
+                        VERTEX(edge, BELOW, LEFT, xb, yb);
+            		edge.outp_above= cf.outp_above;
+            		if (xb != cf.xb)
+                          {
+                            VERTEX(cf, ABOVE, RIGHT, xb, yb);
+                          }
+            		cf= edge;
+            		break;
+                      case VertexType.EMM:
+                        VERTEX(edge, BELOW, RIGHT, xb, yb);
+            		edge.outp_above= null;
+            		tlist=new_tristrip(tlist, edge, xb, yb);
+            		cf= edge;
+            		break;
+                      case VertexType.LED:
+                        if (edge.bot_y == yb)
+                          VERTEX(edge, BELOW, LEFT, xb, yb);
+                        edge.outp_above= edge.outp_below;
+                        cf= edge;
+            		cft= VertexType.LED;
+                        break;
+                      case VertexType.RED:
+                        edge.outp_above= cf.outp_above;
+            		if (cft == VertexType.LED)
+                          {
+                            if (cf.bot_y == yb)
+                              {
+                                VERTEX(edge, BELOW, RIGHT, xb, yb);
+                              }
+                            else
+                              {
+                                if (edge.bot_y == yb)
+                                  {
+                                    VERTEX(cf, BELOW, LEFT, cf.xb, yb);
+                                    VERTEX(edge, BELOW, RIGHT, xb, yb);
+                                  }
+                              }
+                          }
+            		else
+                          {
+                            VERTEX(edge, BELOW, RIGHT, xb, yb);
+                            VERTEX(edge, ABOVE, RIGHT, xb, yb);
+                          }
+            		cf= null;
+            		break;
+                      default:
+                        break;
+                      } /* End of switch */
+                  } /* End of contributing conditional */
+              } /* End of edge exists conditional */
+          } /* End of AET loop */
+        
         /* Delete terminating edges from the AET, otherwise compute xt */
-        for (edge = aet.top_node ; (edge != null); edge = edge.next)
-        {
-          if (edge.top_y == yb)
+        for (EdgeNode edge = aet.top_node; (edge != null); edge = edge.next)
           {
-            prev_edge = edge.prev;
-            next_edge= edge.next;
-
-            if (prev_edge != null)
-              prev_edge.next = next_edge;
-            else
-              aet.top_node = next_edge;
-
-            if (next_edge != null )
-              next_edge.prev = prev_edge;
-
-            /* Copy bundle head state to the adjacent tail edge if required */
-            if ((edge.bstate_below == BundleState.BUNDLE_HEAD) &amp;&amp; (prev_edge!=null))
-            {
-              if (prev_edge.bstate_below == BundleState.BUNDLE_TAIL)
+            if (edge.top_y == yb)
               {
-                prev_edge.outp_below= edge.outp_below;
-                prev_edge.bstate_below= BundleState.UNBUNDLED;
-                if ( prev_edge.prev != null)
-                {
-                  if (prev_edge.prev.bstate_below == BundleState.BUNDLE_TAIL)
+                EdgeNode prev_edge = edge.prev;
+                EdgeNode next_edge = edge.next;
+                
+                if (prev_edge != null)
+                  prev_edge.next = next_edge;
+                else
+                  aet.top_node = next_edge;
+                
+                if (next_edge != null )
+                  next_edge.prev = prev_edge;
+                
+                /* Copy bundle head state to the adjacent tail edge if required */
+                if ((edge.bstate_below == BundleState.BUNDLE_HEAD) &amp;&amp; (prev_edge!=null))
                   {
-                    prev_edge.bstate_below = BundleState.BUNDLE_HEAD;
+                    if (prev_edge.bstate_below == BundleState.BUNDLE_TAIL)
+                      {
+                        prev_edge.outp_below= edge.outp_below;
+                        prev_edge.bstate_below= BundleState.UNBUNDLED;
+                        if ( prev_edge.prev != null)
+                          {
+                            if (prev_edge.prev.bstate_below == BundleState.BUNDLE_TAIL)
+                              {
+                                prev_edge.bstate_below = BundleState.BUNDLE_HEAD;
+                              }
+                          }
+                      }
                   }
-                }
               }
-            }
-          }
-          else
-          {
-            if (edge.top_y == yt)
-              edge.xt= edge.top_x;
             else
-              edge.xt= edge.bot_x + edge.dx * (yt - edge.bot_y);
+              {
+                if (edge.top_y == yt)
+                  edge.xt= edge.top_x;
+                else
+                  edge.xt= edge.bot_x + edge.dx * (yt - edge.bot_y);
+              }
           }
-        }
-
+        
         if (scanbeam &lt; sbte.sbt_entries )
-        {
-          /* === SCANBEAM INTERIOR PROCESSING ============================== */
-          /* Build intersection table for the current scanbeam */
-          ItNodeTable it_table = new ItNodeTable();
-          it_table.build_intersection_table(aet, dy);
-
-          /* Process each node in the intersection table */
-          for (ItNode intersect = it_table.top_node ; (intersect != null); intersect = intersect.next)
           {
-            e0= intersect.ie0;
-            e1= intersect.ie1;
-
-            /* Only generate output for contributing intersections */
-            if ( ((e0.bundle_above[CLIP]!=0) || (e0.bundle_above[SUBJ]!=0)) &amp;&amp;
-              ((e1.bundle_above[CLIP]!=0) || (e1.bundle_above[SUBJ]!=0)))
-            {
-              PolygonNode p = e0.outp_above;
-              PolygonNode q = e1.outp_above;
-              ix = intersect.point.x;
-              iy = intersect.point.y + yb;
-
-              int in_clip = ( ( (e0.bundle_above[CLIP]!=0) &amp;&amp; !(e0.bside_clip!=0)) ||
-                ( (e1.bundle_above[CLIP]!=0) &amp;&amp;  (e1.bside_clip!=0)) ||
-                (!(e0.bundle_above[CLIP]!=0) &amp;&amp; !(e1.bundle_above[CLIP]!=0) &amp;&amp;
-                (e0.bside_clip!=0) &amp;&amp; (e1.bside_clip!=0) ) ) ? 1 : 0;
-
-              int in_subj = ( ( (e0.bundle_above[SUBJ]!=0) &amp;&amp; !(e0.bside_subj!=0)) ||
-                ( (e1.bundle_above[SUBJ]!=0) &amp;&amp;  (e1.bside_subj!=0)) ||
-                (!(e0.bundle_above[SUBJ]!=0) &amp;&amp; !(e1.bundle_above[SUBJ]!=0) &amp;&amp;
-                (e0.bside_subj!=0) &amp;&amp; (e1.bside_subj!=0) ) ) ? 1 : 0;
-
-              int tr=0, tl=0, br=0, bl=0 ;
-              /* Determine quadrant occupancies */
-              if( (op == OperationType.GPC_DIFF) || (op == OperationType.GPC_INT) )
-              {
-                tr= ((in_clip!=0) &amp;&amp; (in_subj!=0)) ? 1 : 0;
-                tl= (((in_clip ^ e1.bundle_above[CLIP])!=0) &amp;&amp; ((in_subj ^ e1.bundle_above[SUBJ])!=0))?1:0;
-                br= (((in_clip ^ e0.bundle_above[CLIP])!=0) &amp;&amp; ((in_subj ^ e0.bundle_above[SUBJ])!=0))?1:0;
-                bl= (((in_clip ^ e1.bundle_above[CLIP] ^ e0.bundle_above[CLIP])!=0) &amp;&amp;
-                  ((in_subj ^ e1.bundle_above[SUBJ] ^ e0.bundle_above[SUBJ])!=0) ) ? 1:0;
-              }
-              else if( op == OperationType.GPC_XOR )
-              {
-                tr= (in_clip)^ (in_subj);
-                tl= (in_clip ^ e1.bundle_above[CLIP]) ^ (in_subj ^ e1.bundle_above[SUBJ]);
-                br= (in_clip ^ e0.bundle_above[CLIP]) ^ (in_subj ^ e0.bundle_above[SUBJ]);
-                bl= (in_clip ^ e1.bundle_above[CLIP] ^ e0.bundle_above[CLIP])
-                  ^ (in_subj ^ e1.bundle_above[SUBJ] ^ e0.bundle_above[SUBJ]);
-              }
-              else if( op == OperationType.GPC_UNION )
+            /* === SCANBEAM INTERIOR PROCESSING ============================== */
+            
+            /* Build intersection table for the current scanbeam */
+            ItNodeTable it_table = new ItNodeTable();
+            it_table.build_intersection_table(aet, dy);
+            
+            /* Process each node in the intersection table */
+            for (ItNode intersect = it_table.top_node; (intersect != null); intersect = intersect.next)
               {
-                tr= ((in_clip!=0) || (in_subj!=0)) ? 1 : 0;
-                tl= (((in_clip ^ e1.bundle_above[CLIP])!=0) || ((in_subj ^ e1.bundle_above[SUBJ])!=0)) ? 1 : 0;
-                br= (((in_clip ^ e0.bundle_above[CLIP])!=0) || ((in_subj ^ e0.bundle_above[SUBJ])!=0)) ? 1 : 0;
-                bl= (((in_clip ^ e1.bundle_above[CLIP] ^ e0.bundle_above[CLIP])!=0) ||
-                  ((in_subj ^ e1.bundle_above[SUBJ] ^ e0.bundle_above[SUBJ])!=0)) ? 1 : 0;
-              }
-              else
+                e0= intersect.ie0;
+                e1= intersect.ie1;
+                
+                /* Only generate output for contributing intersections */
+                if ( ((e0.bundle_above[CLIP]!=0) || (e0.bundle_above[SUBJ]!=0)) &amp;&amp;
+                     ((e1.bundle_above[CLIP]!=0) || (e1.bundle_above[SUBJ]!=0)))
+                  {
+                    PolygonNode p = e0.outp_above;
+                    PolygonNode q = e1.outp_above;
+                    float ix = intersect.point_x;
+                    float iy = intersect.point_y + yb;
+                    
+                    int in_clip = ( ( (e0.bundle_above[CLIP]!=0) &amp;&amp; !(e0.bside_clip!=0)) ||
+                                    ( (e1.bundle_above[CLIP]!=0) &amp;&amp;  (e1.bside_clip!=0)) ||
+                                    (!(e0.bundle_above[CLIP]!=0) &amp;&amp; !(e1.bundle_above[CLIP]!=0) &amp;&amp;
+                                     (e0.bside_clip!=0) &amp;&amp; (e1.bside_clip!=0) ) ) ? 1 : 0;
+                    
+                    int in_subj = ( ( (e0.bundle_above[SUBJ]!=0) &amp;&amp; !(e0.bside_subj!=0)) ||
+                                    ( (e1.bundle_above[SUBJ]!=0) &amp;&amp;  (e1.bside_subj!=0)) ||
+                                    (!(e0.bundle_above[SUBJ]!=0) &amp;&amp; !(e1.bundle_above[SUBJ]!=0) &amp;&amp;
+                                     (e0.bside_subj!=0) &amp;&amp; (e1.bside_subj!=0) ) ) ? 1 : 0;
+                    
+                    int tr=0, tl=0, br=0, bl=0;
+                    /* Determine quadrant occupancies */
+                    if( (op == OperationType.GPC_DIFF) || (op == OperationType.GPC_INT) )
+                      {
+                        tr= ((in_clip!=0) &amp;&amp; (in_subj!=0)) ? 1 : 0;
+                        tl= (((in_clip ^ e1.bundle_above[CLIP])!=0) &amp;&amp; ((in_subj ^ e1.bundle_above[SUBJ])!=0))?1:0;
+                        br= (((in_clip ^ e0.bundle_above[CLIP])!=0) &amp;&amp; ((in_subj ^ e0.bundle_above[SUBJ])!=0))?1:0;
+                        bl= (((in_clip ^ e1.bundle_above[CLIP] ^ e0.bundle_above[CLIP])!=0) &amp;&amp;
+                             ((in_subj ^ e1.bundle_above[SUBJ] ^ e0.bundle_above[SUBJ])!=0) ) ? 1:0;
+                      }
+                    else if( op == OperationType.GPC_XOR )
+                      {
+                        tr= (in_clip)^ (in_subj);
+                        tl= (in_clip ^ e1.bundle_above[CLIP]) ^ (in_subj ^ e1.bundle_above[SUBJ]);
+                        br= (in_clip ^ e0.bundle_above[CLIP]) ^ (in_subj ^ e0.bundle_above[SUBJ]);
+                        bl= (in_clip ^ e1.bundle_above[CLIP] ^ e0.bundle_above[CLIP])
+                          ^ (in_subj ^ e1.bundle_above[SUBJ] ^ e0.bundle_above[SUBJ]);
+                      }
+                    else if( op == OperationType.GPC_UNION )
+                      {
+                        tr= ((in_clip!=0) || (in_subj!=0)) ? 1 : 0;
+                        tl= (((in_clip ^ e1.bundle_above[CLIP])!=0) || ((in_subj ^ e1.bundle_above[SUBJ])!=0)) ? 1 : 0;
+                        br= (((in_clip ^ e0.bundle_above[CLIP])!=0) || ((in_subj ^ e0.bundle_above[SUBJ])!=0)) ? 1 : 0;
+                        bl= (((in_clip ^ e1.bundle_above[CLIP] ^ e0.bundle_above[CLIP])!=0) ||
+                             ((in_subj ^ e1.bundle_above[SUBJ] ^ e0.bundle_above[SUBJ])!=0)) ? 1 : 0;
+                      }
+                    else
+                      {
+                        throw new IllegalStateException(&quot;Unknown op type, &quot;+op);
+                      }
+                    
+                    EdgeNode next_edge = e1.next;
+                    EdgeNode prev_edge = e0.prev;
+                    
+                    int vclass = VertexType.getType( tr, tl, br, bl );
+                    switch (vclass)
+                      {
+                      case VertexType.EMN:
+                        tlist=new_tristrip(tlist, e1, ix, iy);
+                        e1.outp_above = e0.outp_above;
+                        break;
+                      case VertexType.ERI:
+                        if (p != null)
+                          {
+                            px = P_EDGE(prev_edge, e0, ABOVE, px, iy);
+                            VERTEX(prev_edge, ABOVE, LEFT, px, iy);
+                            VERTEX(e0, ABOVE, RIGHT, ix, iy);
+                            e1.outp_above= e0.outp_above;
+                            e0.outp_above= null;
+                          }
+                        break;
+                      case VertexType.ELI:
+                        if (q != null)
+                          {
+                            nx = N_EDGE(next_edge, e1, ABOVE, nx, iy);
+                            VERTEX(e1, ABOVE, LEFT, ix, iy);
+                            VERTEX(next_edge, ABOVE, RIGHT, nx, iy);
+                            e0.outp_above= e1.outp_above;
+                            e1.outp_above= null;
+                          }
+                        break;
+                      case VertexType.EMX:
+                        if ((p!=null) &amp;&amp; (q!=null))
+                          {
+                            VERTEX(e0, ABOVE, LEFT, ix, iy);
+                            e0.outp_above= null;
+                            e1.outp_above= null;
+                          }
+                        break;
+                      case VertexType.IMN:
+                        px = P_EDGE(prev_edge, e0, ABOVE, px, iy);
+            		VERTEX(prev_edge, ABOVE, LEFT, px, iy);
+            		nx = N_EDGE(next_edge, e1, ABOVE, nx, iy);
+            		VERTEX(next_edge, ABOVE, RIGHT, nx, iy);
+            		tlist=new_tristrip(tlist, prev_edge, px, iy); 
+            		e1.outp_above= prev_edge.outp_above;
+            		VERTEX(e1, ABOVE, RIGHT, ix, iy);
+            		tlist=new_tristrip(tlist, e0, ix, iy);
+            		next_edge.outp_above= e0.outp_above;
+            		VERTEX(next_edge, ABOVE, RIGHT, nx, iy);
+            		break;
+                      case VertexType.ILI:
+                        if (p != null)
+                          {
+                            VERTEX(e0, ABOVE, LEFT, ix, iy);
+                            nx = N_EDGE(next_edge, e1, ABOVE, nx, iy);
+                            VERTEX(next_edge, ABOVE, RIGHT, nx, iy);
+                            e1.outp_above= e0.outp_above;
+                            e0.outp_above= null;
+                          }
+                        break;
+                      case VertexType.IRI:
+                        if (q!=null)
+                          {
+                            VERTEX(e1, ABOVE, RIGHT, ix, iy);
+                            px = P_EDGE(prev_edge, e0, ABOVE, px, iy);
+                            VERTEX(prev_edge, ABOVE, LEFT, px, iy);
+                            e0.outp_above= e1.outp_above;
+                            e1.outp_above= null;
+                          }
+                        break;
+                      case VertexType.IMX:
+                        if ((p!=null) &amp;&amp; (q!=null))
+                          {
+                            VERTEX(e0, ABOVE, RIGHT, ix, iy);
+                            VERTEX(e1, ABOVE, LEFT, ix, iy);
+                            e0.outp_above= null;
+                            e1.outp_above= null;
+                            px = P_EDGE(prev_edge, e0, ABOVE, px, iy);
+                            VERTEX(prev_edge, ABOVE, LEFT, px, iy);
+                            tlist=new_tristrip(tlist, prev_edge, px, iy);
+                            nx = N_EDGE(next_edge, e1, ABOVE, nx, iy);
+                            VERTEX(next_edge, ABOVE, RIGHT, nx, iy);
+                            next_edge.outp_above= prev_edge.outp_above;
+                            VERTEX(next_edge, ABOVE, RIGHT, nx, iy);
+                          }
+                        break;
+                      case VertexType.IMM:
+                        if ((p!=null) &amp;&amp; (q!=null))
+                          {
+                            VERTEX(e0, ABOVE, RIGHT, ix, iy);
+                            VERTEX(e1, ABOVE, LEFT, ix, iy);
+                            px = P_EDGE(prev_edge, e0, ABOVE, px, iy);
+                            VERTEX(prev_edge, ABOVE, LEFT, px, iy);
+                            tlist=new_tristrip(tlist, prev_edge, px, iy);
+                            nx = N_EDGE(next_edge, e1, ABOVE, nx, iy);
+                            VERTEX(next_edge, ABOVE, RIGHT, nx, iy);
+                            e1.outp_above= prev_edge.outp_above;
+                            VERTEX(e1, ABOVE, RIGHT, ix, iy);
+                            tlist=new_tristrip(tlist, e0, ix, iy);
+                            next_edge.outp_above= e0.outp_above;
+                            VERTEX(next_edge, ABOVE, RIGHT, nx, iy);
+                          }
+                        break;
+                      case VertexType.EMM:
+                        if ((p!=null) &amp;&amp; (q!=null))
+                          {
+                            VERTEX(e0, ABOVE, LEFT, ix, iy);
+                            tlist=new_tristrip(tlist, e1, ix, iy);
+                            e1.outp_above = e0.outp_above;
+                          }
+                        break;
+                      default:
+                        break;
+                      } /* End of switch */
+                  } /* End of contributing intersection conditional */                  
+                
+                /* Swap bundle sides in response to edge crossing */
+                if (e0.bundle_above[CLIP]!=0)
+                  e1.bside_clip = (e1.bside_clip==0)?1:0;
+                if (e1.bundle_above[CLIP]!=0)
+                  e0.bside_clip= (e0.bside_clip==0)?1:0;
+                if (e0.bundle_above[SUBJ]!=0)
+                  e1.bside_subj= (e1.bside_subj==0)?1:0;
+                if (e1.bundle_above[SUBJ]!=0)
+                  e0.bside_subj= (e0.bside_subj==0)?1:0;
+                
+                /* Swap e0 and e1 bundles in the AET */
+                EdgeNode prev_edge = e0.prev;
+                EdgeNode next_edge = e1.next;
+                if (next_edge != null)
+                  {
+                    next_edge.prev = e0;
+                  }
+                
+                if (e0.bstate_above == BundleState.BUNDLE_HEAD)
+                  {
+                    boolean search = true;
+                    while (search)
+                      {
+                        prev_edge= prev_edge.prev;
+                        if (prev_edge != null)
+                          {
+                            if (prev_edge.bundle_above[CLIP]!=0
+                                || prev_edge.bundle_above[SUBJ]!=0
+                                || (prev_edge.bstate_above == BundleState.BUNDLE_HEAD))
+                              {
+                                search= false;
+                              }
+                          }
+                        else
+                          {
+                            search= false;
+                          }
+                      }
+                  }
+                if (prev_edge == null)
+                  {
+                    e1.next           = aet.top_node;
+                    aet.top_node      = e0.next;
+                  }
+                else
+                  {
+                    e1.next             = prev_edge.next;
+                    prev_edge.next      = e0.next;
+                  }
+                e0.next.prev = prev_edge;
+                e1.next.prev = e1;
+                e0.next      = next_edge;
+              } /* End of IT loop*/
+            
+            /* Prepare for next scanbeam */
+            for ( EdgeNode edge = aet.top_node; (edge != null); edge = edge.next)
               {
-                throw new IllegalStateException(&quot;Unknown op type, &quot;+op);
+                EdgeNode next_edge = edge.next;
+                EdgeNode succ_edge = edge.succ;
+                if ((edge.top_y == yt) &amp;&amp; (succ_edge!=null))
+                  {
+                    /* Replace AET edge by its successor */
+                    succ_edge.outp_below= edge.outp_above;
+                    succ_edge.bstate_below= edge.bstate_above;
+                    succ_edge.bundle_below_clip= edge.bundle_above[CLIP];
+                    succ_edge.bundle_below_subj= edge.bundle_above[SUBJ];
+                    EdgeNode prev_edge = edge.prev;
+                    if ( prev_edge != null )
+                      prev_edge.next = succ_edge;
+                    else
+                      aet.top_node = succ_edge;
+                    if (next_edge != null)
+                      next_edge.prev= succ_edge;
+                    succ_edge.prev = prev_edge;
+                    succ_edge.next = next_edge;
+                  }
+                else
+                  {
+                    /* Update this edge */
+                    edge.outp_below= edge.outp_above;
+                    edge.bstate_below= edge.bstate_above;
+                    edge.bundle_below_clip= edge.bundle_above[CLIP];
+                    edge.bundle_below_subj= edge.bundle_above[SUBJ];
+                    edge.xb= edge.xt;
+                  }
+                edge.outp_above= null;
               }
-
-              next_edge = e1.next;
-              prev_edge = e0.prev;
-
-              int vclass = VertexType.getType( tr, tl, br, bl );
-              switch (vclass)
-              {
-                case VertexType.EMN:
-                tlist=new_tristrip(tlist, e1, ix, iy);
-                e1.outp_above = e0.outp_above;
-                break;
-                case VertexType.ERI:
-                if (p != null)
-                {
-                  px = P_EDGE(prev_edge, e0, ABOVE, px, iy);
-                  prev_edge.outp_above.v_left=add_vertex(prev_edge.outp_above.v_left,  px,  iy);
-                  prev_edge.outp_above.active++;
-                  e0.outp_above.v_right=add_vertex(e0.outp_above.v_right,  ix,  iy);
-                  e0.outp_above.active++;
-                  e1.outp_above= e0.outp_above;
-                  e0.outp_above= null;
-                }
-                break;
-                case VertexType.ELI:
-                if (q != null)
-                {
-                  nx = N_EDGE(next_edge, e1, ABOVE, nx, iy);
-                  e1.outp_above.v_left=add_vertex(e1.outp_above.v_left,  ix,  iy);
-                  e1.outp_above.active++;
-                  next_edge.outp_above.v_right=add_vertex(next_edge.outp_above.v_right,  nx,  iy);
-                  next_edge.outp_above.active++;
-                  e0.outp_above= e1.outp_above;
-                  e1.outp_above= null;
-                }
-                break;
-                case VertexType.EMX:
-                if ((p!=null) &amp;&amp; (q!=null))
-                {
-                  e0.outp_above.v_left=add_vertex(e0.outp_above.v_left,  ix,  iy);
-                  e0.outp_above.active++;
-                  e0.outp_above= null;
-                  e1.outp_above= null;
-                }
-                break;
-                case VertexType.IMN:
-                px = P_EDGE(prev_edge, e0, ABOVE, px, iy);
-                prev_edge.outp_above.v_left=add_vertex(prev_edge.outp_above.v_left,  px,  iy);
-                prev_edge.outp_above.active++;
-                nx = N_EDGE(next_edge, e1, ABOVE, nx, iy);
-                next_edge.outp_above.v_right=add_vertex(next_edge.outp_above.v_right,  nx,  iy);
-                next_edge.outp_above.active++;
-                tlist=new_tristrip(tlist, prev_edge, px, iy); 
-                e1.outp_above= prev_edge.outp_above;
-                e1.outp_above.v_right=add_vertex(e1.outp_above.v_right,  ix,  iy);
-                e1.outp_above.active++;
-                tlist=new_tristrip(tlist, e0, ix, iy);
-                next_edge.outp_above= e0.outp_above;
-                next_edge.outp_above.v_right=add_vertex(next_edge.outp_above.v_right,  nx,  iy);
-                next_edge.outp_above.active++;
-                break;
-                case VertexType.ILI:
-                if (p != null)
-                {
-                  e0.outp_above.v_left=add_vertex(e0.outp_above.v_left,  ix,  iy);
-                  e0.outp_above.active++;
-                  nx = N_EDGE(next_edge, e1, ABOVE, nx, iy);
-                  next_edge.outp_above.v_right=add_vertex(next_edge.outp_above.v_right,  nx,  iy);
-                  next_edge.outp_above.active++;
-                  e1.outp_above= e0.outp_above;
-                  e0.outp_above= null;
-                }
-                break;
-                case VertexType.IRI:
-                if (q!=null)
-                {
-                  e1.outp_above.v_right=add_vertex(e1.outp_above.v_right,  ix,  iy);
-                  e1.outp_above.active++;
-                  px = P_EDGE(prev_edge, e0, ABOVE, px, iy);
-                  prev_edge.outp_above.v_left=add_vertex(prev_edge.outp_above.v_left,  px,  iy);
-                  prev_edge.outp_above.active++;
-                  e0.outp_above= e1.outp_above;
-                  e1.outp_above= null;
-                }
-                break;
-                case VertexType.IMX:
-                if ((p!=null) &amp;&amp; (q!=null))
-                {
-                  e0.outp_above.v_right=add_vertex(e0.outp_above.v_right,  ix,  iy);
-                  e0.outp_above.active++;
-                  e1.outp_above.v_left=add_vertex(e1.outp_above.v_left,  ix,  iy);
-                  e1.outp_above.active++;
-                  e0.outp_above= null;
-                  e1.outp_above= null;
-                  px = P_EDGE(prev_edge, e0, ABOVE, px, iy);
-                  prev_edge.outp_above.v_left=add_vertex(prev_edge.outp_above.v_left,  px,  iy);
-                  prev_edge.outp_above.active++;
-                  tlist=new_tristrip(tlist, prev_edge, px, iy);
-                  nx = N_EDGE(next_edge, e1, ABOVE, nx, iy);
-                  next_edge.outp_above.v_right=add_vertex(next_edge.outp_above.v_right,  nx,  iy);
-                  next_edge.outp_above.active++;
-                  next_edge.outp_above= prev_edge.outp_above;
-                  next_edge.outp_above.v_right=add_vertex(next_edge.outp_above.v_right,  nx,  iy);
-                  next_edge.outp_above.active++;
-                }
-                break;
-                case VertexType.IMM:
-                if ((p!=null) &amp;&amp; (q!=null))
-                {
-                  e0.outp_above.v_right=add_vertex(e0.outp_above.v_right,  ix,  iy);
-                  e0.outp_above.active++;
-                  e1.outp_above.v_left=add_vertex(e1.outp_above.v_left,  ix,  iy);
-                  e1.outp_above.active++;
-                  px = P_EDGE(prev_edge, e0, ABOVE, px, iy);
-                  prev_edge.outp_above.v_left=add_vertex(prev_edge.outp_above.v_left,  px,  iy);
-                  prev_edge.outp_above.active++;
-                  tlist=new_tristrip(tlist, prev_edge, px, iy);
-                  nx = N_EDGE(next_edge, e1, ABOVE, nx, iy);
-                  next_edge.outp_above.v_right=add_vertex(next_edge.outp_above.v_right,  nx,  iy);
-                  next_edge.outp_above.active++;
-                  e1.outp_above= prev_edge.outp_above;
-                  e1.outp_above.v_right=add_vertex(e1.outp_above.v_right,  ix,  iy);
-                  e1.outp_above.active++;
-                  tlist=new_tristrip(tlist, e0, ix, iy);
-                  next_edge.outp_above= e0.outp_above;
-                  next_edge.outp_above.v_right=add_vertex(next_edge.outp_above.v_right,  nx,  iy);
-                  next_edge.outp_above.active++;
-                }
-                break;
-                case VertexType.EMM:
-                if ((p!=null) &amp;&amp; (q!=null))
-                {
-                  e0.outp_above.v_left=add_vertex(e0.outp_above.v_left,  ix,  iy);
-                  e0.outp_above.active++;
-                  tlist=new_tristrip(tlist, e1, ix, iy);
-                  e1.outp_above = e0.outp_above;
-                }
-                break;
-                default:
-                break;
-              } /* End of switch */
-            } /* End of contributing intersection conditional */                  
-
-            /* Swap bundle sides in response to edge crossing */
-            if (e0.bundle_above[CLIP]!=0)
-              e1.bside_clip = (e1.bside_clip==0)?1:0;
-            if (e1.bundle_above[CLIP]!=0)
-              e0.bside_clip= (e0.bside_clip==0)?1:0;
-            if (e0.bundle_above[SUBJ]!=0)
-              e1.bside_subj= (e1.bside_subj==0)?1:0;
-            if (e1.bundle_above[SUBJ]!=0)
-              e0.bside_subj= (e0.bside_subj==0)?1:0;
-
-            /* Swap e0 and e1 bundles in the AET */
-            prev_edge = e0.prev;
-            next_edge = e1.next;
-            if (next_edge != null)
-            {
-              next_edge.prev = e0;
-            }
-
-            if (e0.bstate_above == BundleState.BUNDLE_HEAD)
-            {
-              boolean search = true;
-              while (search)
+          }
+      } /* === END OF SCANBEAM PROCESSING ================================== */
+    
+    /* Generate result tristrip from tlist */
+    VertexNode lt, ltn, rt, rtn;
+    PolygonNode tnn, tn;
+    RMesh result = new RMesh();
+    if (count_tristrips(tlist) &gt; 0)
+      {
+      	int s, v;
+      	
+    	s= 0;
+    	for (tn= tlist; tn!=null; tn= tnn)
+          {
+            tnn= tn.next;
+            
+            if (tn.active &gt; 2)
               {
-                prev_edge= prev_edge.prev;
-                if (prev_edge != null)
-                {
-                  if (prev_edge.bundle_above[CLIP]!=0
-                    || prev_edge.bundle_above[SUBJ]!=0
-                    || (prev_edge.bstate_above == BundleState.BUNDLE_HEAD))
+                /* Valid tristrip: copy the vertices and free the heap */
+                RStrip strip = new RStrip();
+                v= 0;
+                if (INVERT_TRISTRIPS == true)
                   {
-                    search= false;
+                    lt= tn.v_right;
+                    rt= tn.v_left;
                   }
-                }
                 else
-                {
-                  search= false;
-                }
+                  {
+                    lt= tn.v_left;
+                    rt= tn.v_right;
+                  }
+                while (lt!=null || rt!=null)
+                  {
+                    if (lt!=null)
+                      {
+                        ltn= lt.next;
+                        strip.add(lt.x,lt.y);
+                        v++;
+                        lt= ltn;
+                      }
+                    if (rt!=null)
+                      {
+                        rtn= rt.next;
+                        strip.add(rt.x,rt.y);
+                        v++;
+                        rt= rtn;
+                      }
+                  }
+                result.addStrip(strip);
+                s++;
               }
-            }
-            if (prev_edge == null)
-            {
-              e1.next           = aet.top_node;
-              aet.top_node      = e0.next;
-            }
-            else
-            {
-              e1.next             = prev_edge.next;
-              prev_edge.next      = e0.next;
-            }
-            e0.next.prev = prev_edge;
-            e1.next.prev = e1;
-            e0.next      = next_edge;
-
-          } /* End of IT loop*/
-
-          /* Prepare for next scanbeam */
-          for ( edge = aet.top_node; (edge != null); edge = edge.next)
-          {
-            next_edge = edge.next;
-            succ_edge = edge.succ;
-            if ((edge.top_y == yt) &amp;&amp; (succ_edge!=null))
-            {
-              /* Replace AET edge by its successor */
-              succ_edge.outp_below= edge.outp_above;
-              succ_edge.bstate_below= edge.bstate_above;
-              succ_edge.bundle_below_clip= edge.bundle_above[CLIP];
-              succ_edge.bundle_below_subj= edge.bundle_above[SUBJ];
-              prev_edge = edge.prev;
-              if ( prev_edge != null )
-                prev_edge.next = succ_edge;
-              else
-                aet.top_node = succ_edge;
-              if (next_edge != null)
-                next_edge.prev= succ_edge;
-              succ_edge.prev = prev_edge;
-              succ_edge.next = next_edge;
-            }
             else
-            {
-              /* Update this edge */
-              edge.outp_below= edge.outp_above;
-              edge.bstate_below= edge.bstate_above;
-              edge.bundle_below_clip= edge.bundle_above[CLIP];
-              edge.bundle_below_subj= edge.bundle_above[SUBJ];
-              edge.xb= edge.xt;
-            }
-            edge.outp_above= null;
+              {
+                /* Invalid tristrip: just free the heap */
+                for (lt= tn.v_left; lt!=null; lt= ltn)
+                  {
+                    ltn= lt.next;
+                  }
+                for (rt= tn.v_right; rt!=null; rt= rtn)
+                  {
+                    rtn= rt.next;
+                  }
+              }
           }
-        }
       }
-      /* === END OF SCANBEAM PROCESSING ================================== */
-
-      return tlist;
+    return result;
   }
   
   public static RMesh polygonToMesh(RPolygon s)
   {
-    RPolygon empty = new RPolygon();
-    RPolygon s_clean = s.removeOpenContours();
-    PolygonNode very_clean = clip(OperationType.GPC_UNION, s_clean, empty);
-    if(very_clean == null) {
-      return new RMesh();
-    } else {
-      return polygonNodeToMesh(very_clean);
-    }
-  }
-
-  /*
-  public static RMesh polygonToTriMesh(RPolygon s)
-  {
-    RPolygon empty = new RPolygon();
+    RPolygon c = new RPolygon();
     RPolygon s_clean = s.removeOpenContours();
-    PolygonNode very_clean = clip(OperationType.GPC_UNION, s_clean, empty);
-    return polygonNodeToTriMesh(very_clean);
-  }
-  
-  private static RTriMesh polygonNodeToTriMesh(PolygonNode tlist) {
-      
-  }
-  */
-  
-  private static RMesh polygonNodeToMesh(PolygonNode tlist)
-  {
-      PolygonNode tn,tnn;
-      VertexNode rt,lt, ltn,rtn;
-      
-      /* Generate result tristrip from tlist */
-      RMesh result = new RMesh();
-      if (count_tristrips(tlist) &gt; 0)
-        {
-        	int s, v;
-
-      	s= 0;
-      	for (tn= tlist; tn!=null; tn= tnn)
-            {
-              tnn= tn.next;
-
-              if (tn.active &gt; 2)
-                {
-                  /* Valid tristrip: copy the vertices and free the heap */
-                  RStrip strip = new RStrip();
-                  v= 0;
-                  if (INVERT_TRISTRIPS == true)
-                    {
-                      lt= tn.v_right;
-                      rt= tn.v_left;
-                    }
-                  else
-                    {
-                      lt= tn.v_left;
-                      rt= tn.v_right;
-                    }
-                  while (lt!=null || rt!=null)
-                    {
-                      if (lt!=null)
-                        {
-                          ltn= lt.next;
-                          strip.add(lt.x,lt.y);
-                          v++;
-                          lt= ltn;
-                        }
-                      if (rt!=null)
-                        {
-                          rtn= rt.next;
-                          strip.add(rt.x,rt.y);
-                          v++;
-                          rt= rtn;
-                        }
-                    }
-                  result.addStrip(strip);
-                  s++;
-                }
-              else
-                {
-                  /* Invalid tristrip: just free the heap */
-                  for (lt= tn.v_left; lt!=null; lt= ltn)
-                    {
-                      ltn= lt.next;
-                    }
-                  for (rt= tn.v_right; rt!=null; rt= rtn)
-                    {
-                      rtn= rt.next;
-                    }
-                }
-            }
-        }
-      return result ;
+    /*
+    for(int i=0; i&lt;s_clean.countContours(); i++)
+      {
+        System.out.println(&quot;  &quot; + s_clean.contours[i]);
+        System.out.println(&quot;Contour &quot; + (i + 1) + &quot;/&quot; + s_clean.countContours() + &quot;:&quot;);
+        for(int j=0;j&lt;s_clean.contours[i].countPoints();j++)
+          {
+            System.out.println(&quot;  Point &quot; + (j + 1) + &quot;/&quot; + s_clean.contours[i].countPoints() + &quot;:&quot; + &quot;(&quot; + s_clean.contours[i].points[j].x + &quot;, &quot; + s_clean.contours[i].points[j].y + &quot;)&quot;);
+          }
+      }
+    */
+    return clip(OperationType.GPC_UNION, s_clean, c);
   }
   
   private static boolean EQ(float a, float b)
@@ -1663,42 +1441,96 @@ class FastRClip
     return (Math.abs(a - b) &lt;= GPC_EPSILON);
   }
   
-  private static int PREV_INDEX(int i, int n)
+  private static int PREV_INDEX( int i, int n)
   {
     return ((i - 1 + n) % n);
   }
   
   private static int NEXT_INDEX(int i, int n)
   {
-    return ((i + 1) % n);
+    return ((i + 1    ) % n);
   }
   
-  private static boolean OPTIMAL( RPoint[] p, int i )
+  private static boolean OPTIMAL( RPolygon p, int i )
   {
-    return p[PREV_INDEX(i, p.length)].y != p[i].y
-        || p[NEXT_INDEX(i, p.length)].y != p[i].y;
+    return (p.getY(PREV_INDEX(i, p.getNumPoints())) != p.getY(i)) || 
+      (p.getY(NEXT_INDEX(i, p.getNumPoints())) != p.getY(i));
   }
-    
-  private static float P_EDGE( EdgeNode d, EdgeNode e, int p, float i, float j)
+  
+  // TODO: demacro-ize this
+  private static void VERTEX( EdgeNode e, int p, int s, float x, float y )
   {
-    d= e;
-    do
-      {
-      	d= d.prev;
+    if(p == ABOVE) {
+      if(s == RIGHT) {
+        e.outp_above.v_right = add_vertex(e.outp_above.v_right, x, y);
+      } else if(s == LEFT) {
+        e.outp_above.v_left = add_vertex(e.outp_above.v_left, x, y);
+      } else {
+        throw new IllegalStateException(&quot;bogus s value&quot;);
+      }
+      
+      e.outp_above.active++;
+      
+    } else if (p == BELOW) {
+      if(s == RIGHT) {
+        e.outp_below.v_right = add_vertex(e.outp_below.v_right, x, y);
+      } else if(s == LEFT) {
+        e.outp_below.v_left = add_vertex(e.outp_below.v_left, x, y);
+      } else {
+        throw new IllegalStateException(&quot;bogus s value&quot;);
       }
-    while(d.outp_above == null);
-    return d.bot_x + d.dx*(j-d.bot_y);
+      
+      e.outp_below.active++;
+      
+    } else {
+      throw new IllegalStateException(&quot;bogus p value&quot;);
+    }
+  }
+  
+  private static float P_EDGE( EdgeNode d, EdgeNode e, int p, float i, float j)
+  {
+    if(p == ABOVE) {
+      
+      d = e;
+      do {
+        d = d.prev;
+      } while(d.outp_above == null);
+      return d.bot_x + d.dx*(j-d.bot_y);
+      
+    } else if (p == BELOW) {
+      
+      d = e;
+      do {
+        d = d.prev;
+      } while(d.outp_below == null);
+      return d.bot_x + d.dx*(j-d.bot_y);
+      
+    } else {
+      throw new IllegalStateException(&quot;bogus p value&quot;);
+    }
   }
   
   private static float N_EDGE( EdgeNode d, EdgeNode e, int p, float i, float j)
   {
-    d= e;
-    do
-      {
-      	d= d.next;
-      }
-    while(d.outp_above == null);
-    return d.bot_x + d.dx*(j-d.bot_y);
+    if(p == ABOVE) {
+
+      d = e;
+      do {
+        	d= d.next;
+      } while(d.outp_above == null);
+      return d.bot_x + d.dx*(j-d.bot_y);
+    
+    } else if(p == BELOW) {
+
+      d = e;
+      do {
+        	d= d.next;
+      } while(d.outp_below == null);
+      return d.bot_x + d.dx*(j-d.bot_y);
+    
+    } else {
+      throw new IllegalStateException(&quot;bogus p value&quot;);
+    }
   }
   
   private static RRectangle[] create_contour_bboxes( RPolygon p )
@@ -1726,7 +1558,7 @@ class FastRClip
     /* Check all subject contour bounding boxes against clip boxes */
     for( int s = 0; s &lt; subj_num_poly; s++ )
       {
-        for( int c= 0; c &lt; clip_num_poly ; c++ )
+        for( int c= 0; c &lt; clip_num_poly; c++ )
           {
             o_table[s][c] =
               (!((s_bbox[s].getMaxX() &lt; c_bbox[c].getMinX()) ||
@@ -1740,7 +1572,7 @@ class FastRClip
     for( int c = 0; c &lt; clip_num_poly; c++ )
       {
         boolean overlap = false;
-        for( int s = 0; !overlap &amp;&amp; (s &lt; subj_num_poly) ; s++)
+        for( int s = 0; !overlap &amp;&amp; (s &lt; subj_num_poly); s++)
           {
             overlap = o_table[s][c];
           }
@@ -1773,34 +1605,30 @@ class FastRClip
     if( lmt_table.top_node == null )
       {
         lmt_table.top_node = new LmtNode(y);
-        return lmt_table.top_node ;
+        return lmt_table.top_node;
       }
     else
       {
-        LmtNode prev = null ;
-        LmtNode node = lmt_table.top_node ;
-        boolean done = false ;
+        LmtNode prev = null;
+        LmtNode node = lmt_table.top_node;
+        boolean done = false;
         while( !done )
           {
             if( y &lt; node.y )
               {
                 /* Insert a new LMT node before the current node */
-                LmtNode existing_node = node ;
+                LmtNode existing_node = node;
                 node = new LmtNode(y);
-                node.next = existing_node ;
+                node.next = existing_node;
                 if( prev == null )
                   {
-                    lmt_table.top_node = node ;
+                    lmt_table.top_node = node;
                   }
                 else
                   {
-                    prev.next = node ;
+                    prev.next = node;
                   }
-                //               if( existing_node == lmt_table.top_node )
-                //               {
-                //                  lmt_table.top_node = node ;
-                //               }
-                done = true ;
+                done = true;
               }
             else if ( y &gt; node.y )
               {
@@ -1808,22 +1636,22 @@ class FastRClip
                 if( node.next == null )
                   {
                     node.next = new LmtNode(y);
-                    node = node.next ;
-                    done = true ;
+                    node = node.next;
+                    done = true;
                   }
                 else
                   {
-                    prev = node ;
-                    node = node.next ;
+                    prev = node;
+                    node = node.next;
                   }
               }
             else
               {
                 /* Use this existing LMT node */
-                done = true ;
+                done = true;
               }
           }
-        return node ;
+        return node;
       }
   }
   
@@ -1832,13 +1660,13 @@ class FastRClip
     if( lmt_node.first_bound == null )
       {
         /* Link node e to the tail of the list */
-        lmt_node.first_bound = e ;
+        lmt_node.first_bound = e;
       }
     else
       {
-        boolean done = false ;
-        EdgeNode prev_bound = null ;
-        EdgeNode current_bound = lmt_node.first_bound ;
+        boolean done = false;
+        EdgeNode prev_bound = null;
+        EdgeNode current_bound = lmt_node.first_bound;
         while( !done )
           {
             /* Do primary sort on the x field */
@@ -1847,22 +1675,15 @@ class FastRClip
                 /* Insert a new node mid-list */
                 if( prev_bound == null )
                   {
-                    lmt_node.first_bound = e ;
+                    lmt_node.first_bound = e;
                   }
                 else
                   {
-                    prev_bound.next_bound = e ;
+                    prev_bound.next_bound = e;
                   }
-                e.next_bound = current_bound ;
+                e.next_bound = current_bound;
                 
-                //               EdgeNode existing_bound = current_bound ;
-                //               current_bound = e ;
-                //               current_bound.next_bound = existing_bound ;
-                //               if( lmt_node.first_bound == existing_bound )
-                //               {
-                //                  lmt_node.first_bound = current_bound ;
-                //               }
-                done = true ;
+                done = true;
               }
             else if (e.bot_x == current_bound.bot_x)
               {
@@ -1872,34 +1693,27 @@ class FastRClip
                     /* Insert a new node mid-list */
                     if( prev_bound == null )
                       {
-                        lmt_node.first_bound = e ;
+                        lmt_node.first_bound = e;
                       }
                     else
                       {
-                        prev_bound.next_bound = e ;
+                        prev_bound.next_bound = e;
                       }
-                    e.next_bound = current_bound ;
-                    //                  EdgeNode existing_bound = current_bound ;
-                    //                  current_bound = e ;
-                    //                  current_bound.next_bound = existing_bound ;
-                    //                  if( lmt_node.first_bound == existing_bound )
-                    //                  {
-                    //                     lmt_node.first_bound = current_bound ;
-                    //                  }
-                    done = true ;
+                    e.next_bound = current_bound;
+                    done = true;
                   }
                 else
                   {
                     /* Head further down the list */
                     if( current_bound.next_bound == null )
                       {
-                        current_bound.next_bound = e ;
-                        done = true ;
+                        current_bound.next_bound = e;
+                        done = true;
                       }
                     else
                       {
-                        prev_bound = current_bound ;
-                        current_bound = current_bound.next_bound ;
+                        prev_bound = current_bound;
+                        current_bound = current_bound.next_bound;
                       }
                   }
               }
@@ -1908,13 +1722,13 @@ class FastRClip
                 /* Head further down the list */
                 if( current_bound.next_bound == null )
                   {
-                    current_bound.next_bound = e ;
-                    done = true ;
+                    current_bound.next_bound = e;
+                    done = true;
                   }
                 else
                   {
-                    prev_bound = current_bound ;
-                    current_bound = current_bound.next_bound ;
+                    prev_bound = current_bound;
+                    current_bound = current_bound.next_bound;
                   }
               }
           }
@@ -1927,14 +1741,14 @@ class FastRClip
       {
         /* Append edge onto the tail end of the AET */
         aet.top_node = edge;
-        edge.prev = null ;
+        edge.prev = null;
         edge.next= null;
       }
     else
       {
-        EdgeNode current_edge = aet.top_node ;
-        EdgeNode prev = null ;
-        boolean done = false ;
+        EdgeNode current_edge = aet.top_node;
+        EdgeNode prev = null;
+        boolean done = false;
         while( !done )
           {
             /* Do primary sort on the xb field */
@@ -1942,21 +1756,16 @@ class FastRClip
               {
                 /* Insert edge here (before the AET edge) */
                 edge.prev= prev;
-                edge.next= current_edge ;
-                current_edge.prev = edge ;
+                edge.next= current_edge;
+                current_edge.prev = edge;
                 if( prev == null )
                   {
-                    aet.top_node = edge ;
+                    aet.top_node = edge;
                   }
                 else
                   {
-                    prev.next = edge ;
+                    prev.next = edge;
                   }
-                //               if( current_edge == aet.top_node )
-                //               {
-                //                  aet.top_node = edge ;
-                //               }
-                //               current_edge = edge ;
                 done = true;
               }
             else if (edge.xb == current_edge.xb)
@@ -1966,54 +1775,49 @@ class FastRClip
                   {
                     /* Insert edge here (before the AET edge) */
                     edge.prev= prev;
-                    edge.next= current_edge ;
-                    current_edge.prev = edge ;
+                    edge.next= current_edge;
+                    current_edge.prev = edge;
                     if( prev == null )
                       {
-                        aet.top_node = edge ;
+                        aet.top_node = edge;
                       }
                     else
                       {
-                        prev.next = edge ;
+                        prev.next = edge;
                       }
-                    //                  if( current_edge == aet.top_node )
-                    //                  {
-                    //                     aet.top_node = edge ;
-                    //                  }
-                    //                  current_edge = edge ;
                     done = true;
                   }
                 else
                   {
                     /* Head further into the AET */
-                    prev = current_edge ;
+                    prev = current_edge;
                     if( current_edge.next == null )
                       {
-                        current_edge.next = edge ;
-                        edge.prev = current_edge ;
-                        edge.next = null ;
-                        done = true ;
+                        current_edge.next = edge;
+                        edge.prev = current_edge;
+                        edge.next = null;
+                        done = true;
                       }
                     else
                       {
-                        current_edge = current_edge.next ;
+                        current_edge = current_edge.next;
                       }
                   }
               }
             else
               {
                 /* Head further into the AET */
-                prev = current_edge ;
+                prev = current_edge;
                 if( current_edge.next == null )
                   {
-                    current_edge.next = edge ;
-                    edge.prev = current_edge ;
-                    edge.next = null ;
-                    done = true ;
+                    current_edge.next = edge;
+                    edge.prev = current_edge;
+                    edge.next = null;
+                    done = true;
                   }
                 else
                   {
-                    current_edge = current_edge.next ;
+                    current_edge = current_edge.next;
                   }
               }
           }
@@ -2026,11 +1830,11 @@ class FastRClip
       {
         /* Add a new tree node here */
         sbte.sb_tree = new ScanBeamTree( y );
-        sbte.sbt_entries++ ;
-        return ;
+        sbte.sbt_entries++;
+        return;
       }
-    ScanBeamTree tree_node = sbte.sb_tree ;
-    boolean done = false ;
+    ScanBeamTree tree_node = sbte.sb_tree;
+    boolean done = false;
     while( !done )
       {
         if ( tree_node.y &gt; y)
@@ -2038,12 +1842,12 @@ class FastRClip
             if( tree_node.less == null )
               {
                 tree_node.less = new ScanBeamTree(y);
-                sbte.sbt_entries++ ;
-                done = true ;
+                sbte.sbt_entries++;
+                done = true;
               }
             else
               {
-                tree_node = tree_node.less ;
+                tree_node = tree_node.less;
               }
           }
         else if ( tree_node.y &lt; y)
@@ -2051,17 +1855,17 @@ class FastRClip
             if( tree_node.more == null )
               {
                 tree_node.more = new ScanBeamTree(y);
-                sbte.sbt_entries++ ;
-                done = true ;
+                sbte.sbt_entries++;
+                done = true;
               }
             else
               {
-                tree_node = tree_node.more ;
+                tree_node = tree_node.more;
               }
           }
         else
           {
-            done = true ;
+            done = true;
           }
       }
   }
@@ -2073,12 +1877,11 @@ class FastRClip
                                       OperationType op)
   {
     /* Create the entire input polygon edge table in one go */
-    EdgeTable edge_table = new EdgeTable(0);
+    EdgeTable edge_table = new EdgeTable();
     
     for ( int c= 0; c &lt; p.getNumInnerPoly(); c++)
       {
         RPolygon ip = p.getInnerPoly(c);
-        RPoint[] ipp = ip.contours[0].points;
         if( !ip.isContributing(0) )
           {
             /* Ignore the non-contributing contour */
@@ -2088,15 +1891,14 @@ class FastRClip
           {
             /* Perform contour optimisation */
             int num_vertices= 0;
-            int numPoints = ip.getNumPoints();
-            int e_index = 0 ;
-            edge_table = new EdgeTable(numPoints);
-            for ( int i= 0; i &lt; numPoints; i++)
+            int e_index = 0;
+            edge_table = new EdgeTable();
+            for ( int i= 0; i &lt; ip.getNumPoints(); i++)
               {
-                if( OPTIMAL(ipp, i) )
+                if( OPTIMAL(ip, i) )
                   {
-                    float x = ipp[i].x;
-                    float y = ipp[i].y;
+                    float x = ip.getX(i);
+                    float y = ip.getY(i);
                     edge_table.addNode( x, y );
                     
                     /* Record vertex in the scanbeam table */
@@ -2144,22 +1946,17 @@ class FastRClip
                         ei.top_y= ev.vertex_y;
                         ei.dx= (ev.vertex_x - ei.bot_x) / (ei.top_y - ei.bot_y);
                         ei.type = type;
-                        ei.outp_above = null ;
+                        ei.outp_above = null;
                         ei.outp_below = null;
                         ei.next = null;
                         ei.prev = null;
                         ei.succ = ((num_edges &gt; 1) &amp;&amp; (i &lt; (num_edges - 1))) ? edge_table.getNode(e_index+i+1) : null;
-                        ei.pred = ((num_edges &gt; 1) &amp;&amp; (i &gt; 0)) ? edge_table.getNode(e_index+i-1) : null ;
-                        ei.next_bound = null ;
+                        ei.pred = ((num_edges &gt; 1) &amp;&amp; (i &gt; 0)) ? edge_table.getNode(e_index+i-1) : null;
+                        ei.next_bound = null;
                         ei.bside_clip = (op == OperationType.GPC_DIFF) ? RIGHT : LEFT;
-                        ei.bside_subj = LEFT ;
+                        ei.bside_subj = LEFT;
                       }
                     insert_bound( bound_list(lmt_table, edge_table.getNode(min).vertex_y), e);
-                    if( DEBUG )
-                      {
-                        System.out.println(&quot;fwd&quot;);
-                        lmt_table.print();
-                      }
                     e_index += num_edges;
                   }
               }
@@ -2204,20 +2001,15 @@ class FastRClip
                         ei.type = type;
                         ei.outp_above = null;
                         ei.outp_below = null;
-                        ei.next = null ;
+                        ei.next = null;
                         ei.prev = null;
                         ei.succ = ((num_edges &gt; 1) &amp;&amp; (i &lt; (num_edges - 1))) ? edge_table.getNode(e_index+i+1) : null;
-                        ei.pred = ((num_edges &gt; 1) &amp;&amp; (i &gt; 0)) ? edge_table.getNode(e_index+i-1) : null ;
-                        ei.next_bound = null ;
+                        ei.pred = ((num_edges &gt; 1) &amp;&amp; (i &gt; 0)) ? edge_table.getNode(e_index+i-1) : null;
+                        ei.next_bound = null;
                         ei.bside_clip = (op == OperationType.GPC_DIFF) ? RIGHT : LEFT;
                         ei.bside_subj = LEFT;
                       }
                     insert_bound( bound_list(lmt_table, edge_table.getNode(min).vertex_y), e);
-                    if( DEBUG )
-                      {
-                        System.out.println(&quot;rev&quot;);
-                        lmt_table.print();
-                      }
                     e_index+= num_edges;
                   }
               }
@@ -2258,7 +2050,7 @@ class FastRClip
             st.prev = add_st_edge(st.prev, it, edge, dy);
           }
       }
-    return st ;
+    return st;
   }
   
   private static ItNode add_intersection( ItNode it_node, 
@@ -2274,10 +2066,10 @@ class FastRClip
       }
     else
       {
-        if ( it_node.point.y &gt; y)
+        if ( it_node.point_y &gt; y)
           {
             /* Insert a new node mid-list */
-            ItNode existing_node = it_node ;
+            ItNode existing_node = it_node;
             it_node = new ItNode( edge0, edge1, x, y, existing_node );
           }
         else
@@ -2286,7 +2078,7 @@ class FastRClip
             it_node.next = add_intersection( it_node.next, edge0, edge1, x, y);
           }
       }
-    return it_node ;
+    return it_node;
   }
   
   private static int count_tristrips(PolygonNode tn)
@@ -2338,40 +2130,28 @@ class FastRClip
   // ---------------------
   // --- Inner Classes ---
   // ---------------------
-  private static class OperationType
-  {
-    private String m_Type ;
-    private OperationType( String type ) { m_Type = type; }
-    
-    public static final OperationType GPC_DIFF  = new OperationType( &quot;Difference&quot; );
-    public static final OperationType GPC_INT   = new OperationType( &quot;Intersection&quot; );
-    public static final OperationType GPC_XOR   = new OperationType( &quot;Exclusive or&quot; );
-    public static final OperationType GPC_UNION = new OperationType( &quot;Union&quot; );
-    
-    public String toString() { return m_Type; }
-  }
   
   /**
    * Edge intersection classes
    */
   private static class VertexType
   {
-    public static final int NUL =  0 ; /* Empty non-intersection            */
-    public static final int EMX =  1 ; /* External maximum                  */
-    public static final int ELI =  2 ; /* External left intermediate        */
-    public static final int TED =  3 ; /* Top edge                          */
-    public static final int ERI =  4 ; /* External right intermediate       */
-    public static final int RED =  5 ; /* Right edge                        */
-    public static final int IMM =  6 ; /* Internal maximum and minimum      */
-    public static final int IMN =  7 ; /* Internal minimum                  */
-    public static final int EMN =  8 ; /* External minimum                  */
-    public static final int EMM =  9 ; /* External maximum and minimum      */
-    public static final int LED = 10 ; /* Left edge                         */
-    public static final int ILI = 11 ; /* Internal left intermediate        */
-    public static final int BED = 12 ; /* Bottom edge                       */
-    public static final int IRI = 13 ; /* Internal right intermediate       */
-    public static final int IMX = 14 ; /* Internal maximum                  */
-    public static final int FUL = 15 ; /* Full non-intersection             */
+    public static final int NUL =  0; /* Empty non-intersection            */
+    public static final int EMX =  1; /* External maximum                  */
+    public static final int ELI =  2; /* External left intermediate        */
+    public static final int TED =  3; /* Top edge                          */
+    public static final int ERI =  4; /* External right intermediate       */
+    public static final int RED =  5; /* Right edge                        */
+    public static final int IMM =  6; /* Internal maximum and minimum      */
+    public static final int IMN =  7; /* Internal minimum                  */
+    public static final int EMN =  8; /* External minimum                  */
+    public static final int EMM =  9; /* External maximum and minimum      */
+    public static final int LED = 10; /* Left edge                         */
+    public static final int ILI = 11; /* Internal left intermediate        */
+    public static final int BED = 12; /* Bottom edge                       */
+    public static final int IRI = 13; /* Internal right intermediate       */
+    public static final int IMX = 14; /* Internal maximum                  */
+    public static final int FUL = 15; /* Full non-intersection             */
     
     public static int getType( int tr, int tl, int br, int bl )
     {
@@ -2384,9 +2164,9 @@ class FastRClip
    */
   private static class HState
   {
-    public static final int NH = 0 ; /* No horizontal edge                */
-    public static final int BH = 1 ; /* Bottom horizontal edge            */
-    public static final int TH = 2 ; /* Top horizontal edge               */
+    public static final int NH = 0; /* No horizontal edge                */
+    public static final int BH = 1; /* Bottom horizontal edge            */
+    public static final int TH = 2; /* Top horizontal edge               */
     
     /* Horizontal edge state transitions within scanbeam boundary */
     public static final int[][] next_h_state =
@@ -2404,14 +2184,14 @@ class FastRClip
    */
   private static class BundleState
   {
-    private String m_State ;
-    private BundleState( String state ) { m_State = state ; }
+    private String state;
+    private BundleState( String state ) { state = state; }
     
     public static final BundleState UNBUNDLED   = new BundleState( &quot;UNBUNDLED&quot;   ); // Isolated edge not within a bundle
     public static final BundleState BUNDLE_HEAD = new BundleState( &quot;BUNDLE_HEAD&quot; ); // Bundle head node
     public static final BundleState BUNDLE_TAIL = new BundleState( &quot;BUNDLE_TAIL&quot; ); // Passive bundle tail node
     
-    public String toString() { return m_State; }
+    public String toString() { return state; }
   }
   
   /**
@@ -2425,9 +2205,9 @@ class FastRClip
     
     public VertexNode( float x, float y )
     {
-      this.x = x ;
-      this.y = y ;
-      this.next = null ;
+      this.x = x;
+      this.y = y;
+      this.next = null;
     }
   }
   
@@ -2438,30 +2218,28 @@ class FastRClip
   {
     int          active;                 /* Active flag / vertex count        */
     boolean      hole;                   /* Hole / external contour flag      */
-    VertexNode   v_left,v_right; /* Left and right vertex list ptrs   */
+    VertexNode v_right, v_left;          /* Left and right vertex list ptrs   */
     PolygonNode  next;                   /* Pointer to next polygon contour   */
     PolygonNode  proxy;                  /* Pointer to actual structure used  */
     
     public PolygonNode()
     {
-      /* Make v[LEFT] and v[RIGHT] point to new vertex */
-      this.v_left = null ;
-      this.v_right = null ;
-      this.next = null ;
-      this.proxy = this ; /* Initialise proxy to point to p itself */
-      this.active = 1 ; //TRUE
+      this.v_left = null;
+      this.v_right = null;
+      this.next = null;
+      this.proxy = this; /* Initialise proxy to point to p itself */
+      this.active = 1; //TRUE
     }
     
     public PolygonNode( PolygonNode next, float x, float y )
     {
-      /* Make v[LEFT] and v[RIGHT] point to new vertex */
       VertexNode vn = new VertexNode( x, y );
-      this.v_left = vn ;
-      this.v_right = vn ;
+      this.v_left = vn;
+      this.v_right = vn;
       
-      this.next = next ;
-      this.proxy = this ; /* Initialise proxy to point to p itself */
-      this.active = 1 ; //TRUE
+      this.next = next;
+      this.proxy = this; /* Initialise proxy to point to p itself */
+      this.active = 1; //TRUE
     }
     
     public void add_right( float x, float y )
@@ -2490,7 +2268,7 @@ class FastRClip
   
   private static class TopPolygonNode
   {
-    PolygonNode top_node = null ;
+    PolygonNode top_node = null;
     
     public PolygonNode add_local_min( float x, float y )
     {
@@ -2498,13 +2276,13 @@ class FastRClip
       
       top_node = new PolygonNode( existing_min, x, y );
       
-      return top_node ;
+      return top_node;
     }
     
     public void merge_left( PolygonNode p, PolygonNode q )
     {
       /* Label contour as a hole */
-      q.proxy.hole = true ;
+      q.proxy.hole = true;
       
       if (p.proxy != q.proxy)
         {
@@ -2513,7 +2291,7 @@ class FastRClip
           q.proxy.v_left= p.proxy.v_left;
           
           /* Redirect any p.proxy references to q.proxy */
-          PolygonNode target = p.proxy ;
+          PolygonNode target = p.proxy;
           for(PolygonNode node = top_node; (node != null); node = node.next)
             {
               if (node.proxy == target)
@@ -2528,7 +2306,7 @@ class FastRClip
     public void merge_right( PolygonNode p, PolygonNode q )
     {
       /* Label contour as external */
-      q.proxy.hole = false ;
+      q.proxy.hole = false;
       
       if (p.proxy != q.proxy)
         {
@@ -2537,8 +2315,8 @@ class FastRClip
           q.proxy.v_right= p.proxy.v_right;
           
           /* Redirect any p-&gt;proxy references to q-&gt;proxy */
-          PolygonNode target = p.proxy ;
-          for (PolygonNode node = top_node ; (node != null ); node = node.next)
+          PolygonNode target = p.proxy;
+          for (PolygonNode node = top_node; (node != null ); node = node.next)
             {
               if (node.proxy == target)
                 {
@@ -2551,8 +2329,8 @@ class FastRClip
     
     public int count_contours()
     {
-      int nc = 0 ;
-      for ( PolygonNode polygon = top_node; (polygon != null) ; polygon = polygon.next)
+      int nc = 0;
+      for ( PolygonNode polygon = top_node; (polygon != null); polygon = polygon.next)
         {
           if (polygon.active != 0)
             {
@@ -2572,11 +2350,11 @@ class FastRClip
               else
                 {
                   /* Invalid contour: just free the heap */
-                  //                  VertexNode nextv = null ;
+                  //                  VertexNode nextv = null;
                   //                  for (VertexNode v= polygon.proxy.v_left; (v != null); v = nextv)
                   //                  {
                   //                     nextv= v.next;
-                  //                     v = null ;
+                  //                     v = null;
                   //                  }
                   polygon.active= 0;
                 }
@@ -2591,96 +2369,94 @@ class FastRClip
       RPolygon result = new RPolygon();
       int num_contours = count_contours();
       if (num_contours &gt; 0)
-      {
-        int c= 0;
-        PolygonNode npoly_node = null ;
-        for (PolygonNode poly_node= top_node; (poly_node != null); poly_node = npoly_node)
         {
-          npoly_node = poly_node.next;
-          if (poly_node.active != 0)
-          {
-            RContour contour;     
-            if(result.countContours()&gt;0){
-              contour = result.contours[0];
-            }else{
-              contour = new RContour();
-            }
-            //RPolygon poly = result ;
-            if( num_contours &gt; 0 )
+          int c= 0;
+          PolygonNode npoly_node = null;
+          for (PolygonNode poly_node= top_node; (poly_node != null); poly_node = npoly_node)
             {
-              contour = new RContour();
-              //poly = createNewPoly( polyClass );
-            }
-            if( poly_node.proxy.hole )
-            {
-              contour.isHole = poly_node.proxy.hole;
-              //poly.setIsHole( poly_node.proxy.hole );
+              npoly_node = poly_node.next;
+              if (poly_node.active != 0)
+                {
+		  RContour contour;     
+		  if(result.countContours()&gt;0){
+                    contour = result.contours[0];
+	          }else{
+                    contour = new RContour();
+		  }
+                  //RPolygon poly = result;
+                  if( num_contours &gt; 0 )
+                    {
+                      contour = new RContour();
+                      //poly = createNewPoly( polyClass );
+                    }
+                  if( poly_node.proxy.hole )
+                    {
+                      contour.isHole = poly_node.proxy.hole;
+                      //poly.setIsHole( poly_node.proxy.hole );
+                    }
+                  
+                  // ------------------------------------------------------------------------
+                  // --- This algorithm puts the verticies into the poly in reverse order ---
+                  // ------------------------------------------------------------------------
+                  for (VertexNode vtx = poly_node.proxy.v_left; (vtx != null); vtx = vtx.next )
+                    {
+                      contour.addPoint(vtx.x, vtx.y);
+                      //poly.add( vtx.x, vtx.y );
+                    }
+                  if( num_contours &gt; 0 )
+                    {
+                      result.addContour(contour);
+                      //result.add( poly );
+                    }
+                  c++;
+                }
             }
-
-            // ------------------------------------------------------------------------
-            // --- This algorithm puts the verticies into the poly in reverse order ---
-            // ------------------------------------------------------------------------
-            ArrayList points = new ArrayList();
-            for (VertexNode vtx = poly_node.proxy.v_left; vtx != null; vtx = vtx.next )
+          
+          // -----------------------------------------
+          // --- Sort holes to the end of the list ---
+          // -----------------------------------------
+          RPolygon orig = new RPolygon(result);
+          result = new RPolygon();
+          //result = createNewPoly( polyClass );
+          for( int i = 0; i &lt; orig.countContours(); i++ )
+            //for( int i = 0; i &lt; orig.getNumInnerPoly(); i++ )
             {
-              points.add(new RPoint(vtx.x, vtx.y));
+              RContour inner = orig.contours[i];
+              //RPolygon inner = orig.getInnerPoly(i);
+              if( !inner.isHole() )
+                {
+		  result.addContour(inner);
+                  //result.add(inner);
+                }
             }
-            contour.addPoints(points);
-            
-            if( num_contours &gt; 0 )
+          
+          for( int i = 0; i &lt; orig.countContours(); i++ )
+            //for( int i = 0; i &lt; orig.getNumInnerPoly(); i++ )
             {
-              result.addContour(contour);
-              //result.add( poly );
+              RContour inner = orig.contours[i];
+              //RPolygon inner = orig.getInnerPoly(i);
+              if( inner.isHole() )
+                {
+                  result.addContour(inner);
+                }
             }
-            c++;
-          }
         }
-
-        // -----------------------------------------
-        // --- Sort holes to the end of the list ---
-        // -----------------------------------------
-        RPolygon orig = new RPolygon(result) ;
-        result = new RPolygon();
-        //result = createNewPoly( polyClass );
-        for( int i = 0 ; i &lt; orig.countContours() ; i++ )
-          //for( int i = 0 ; i &lt; orig.getNumInnerPoly() ; i++ )
-        {
-          RContour inner = orig.contours[i];
-          //RPolygon inner = orig.getInnerPoly(i);
-          if( !inner.isHole() )
-          {
-            result.addContour(inner);
-            //result.add(inner);
-          }
-        }
-
-        for( int i = 0 ; i &lt; orig.countContours() ; i++ )
-          //for( int i = 0 ; i &lt; orig.getNumInnerPoly() ; i++ )
-        {
-          RContour inner = orig.contours[i];
-          //RPolygon inner = orig.getInnerPoly(i);
-          if( inner.isHole() )
-          {
-            result.addContour(inner);
-          }
-        }
-      }
-      return result ;
+      return result;
     }
     
     public void print()
     {
       System.out.println(&quot;---- out_poly ----&quot;);
       int c= 0;
-      PolygonNode npoly_node = null ;
+      PolygonNode npoly_node = null;
       for (PolygonNode poly_node= top_node; (poly_node != null); poly_node = npoly_node)
         {
           System.out.println(&quot;contour=&quot;+c+&quot;  active=&quot;+poly_node.active+&quot;  hole=&quot;+poly_node.proxy.hole);
           npoly_node = poly_node.next;
           if (poly_node.active != 0)
             {
-              int v=0 ;
-              for (VertexNode vtx = poly_node.proxy.v_left; (vtx != null) ; vtx = vtx.next )
+              int v=0;
+              for (VertexNode vtx = poly_node.proxy.v_left; (vtx != null); vtx = vtx.next )
                 {
                   System.out.println(&quot;v=&quot;+v+&quot;  vtx.x=&quot;+vtx.x+&quot;  vtx.y=&quot;+vtx.y);
                 }
@@ -2692,23 +2468,22 @@ class FastRClip
   
   private static class EdgeNode
   {
-    float vertex_x,vertex_y;      /* Piggy-backed contour vertex data  */
-    float bot_x,bot_y;            /* Edge upper (x, y) coordinate      */
-    float top_x,top_y;            /* Edge upper (x, y) coordinate      */
+    float vertex_x, vertex_y;    /* Piggy-backed contour vertex data  */
+    float bot_x, bot_y;          /* Edge lower (x, y) coordinate      */
+    float top_x, top_y;         /* Edge upper (x, y) coordinate      */
     float         xb;           /* Scanbeam bottom x coordinate      */
     float         xt;           /* Scanbeam top x coordinate         */
     float         dx;           /* Change in x for a unit y increase */
     int            type;         /* Clip / subject edge flag          */
+    //int[][]        bundle = new int[2][2];      /* Bundle edge flags                 */
     int[] bundle_above = new int[2];
-    int bundle_below_clip;
-    int bundle_below_subj;
-    int bside_clip;
-    int bside_subj;
-    
-    BundleState  bstate_above;
-    BundleState  bstate_below;
-    PolygonNode outp_above;
-    PolygonNode outp_below;
+    int bundle_below_clip, bundle_below_subj;
+    
+    //int[]          bside  = new int[2];         /* Bundle left / right indicators    */
+    int bside_clip, bside_subj;  /* Bundle left / right indicators    */
+    //BundleState[]  bstate = new BundleState[2]; /* Edge bundle state                 */
+    BundleState bstate_above, bstate_below;
+    PolygonNode outp_above, outp_below; /* Output polygon / tristrip pointer */
     EdgeNode       prev;         /* Previous edge in the AET          */
     EdgeNode       next;         /* Next edge in the AET              */
     EdgeNode       pred;         /* Edge connected at the lower end   */
@@ -2718,13 +2493,13 @@ class FastRClip
   
   private static class AetTree
   {
-    EdgeNode top_node ;
+    EdgeNode top_node;
     
     public void print()
     {
       System.out.println(&quot;&quot;);
       System.out.println(&quot;aet&quot;);
-      for( EdgeNode edge = top_node ; (edge != null) ; edge = edge.next )
+      for( EdgeNode edge = top_node; (edge != null); edge = edge.next )
         {
           System.out.println(&quot;edge.vertex_x=&quot;+edge.vertex_x+&quot;  edge.vertex_y=&quot;+edge.vertex_y);
         }
@@ -2733,58 +2508,51 @@ class FastRClip
   
   private static class EdgeTable
   {
-    private EdgeNode[] m_List;
-    private int len;
-    
-    public EdgeTable(int maxSize) {
-      m_List = new EdgeNode[maxSize];
-      len = 0;
-    }
+    private List edges = new ArrayList();
     
     public void addNode( float x, float y )
     {
       EdgeNode node = new EdgeNode();
       node.vertex_x = x;
       node.vertex_y = y;
-      m_List[len] = node;
-      len++;
+      edges.add( node );
     }
     
     public EdgeNode getNode( int index )
     {
-      return m_List[index];
+      return (EdgeNode)edges.get(index);
     }
     
     public boolean FWD_MIN( int i )
     {
-      EdgeNode prev = m_List[PREV_INDEX(i, len)];
-      EdgeNode next = m_List[NEXT_INDEX(i, len)];
-      EdgeNode ith  = m_List[i];
+      EdgeNode prev = (EdgeNode)edges.get(PREV_INDEX(i, edges.size()));
+      EdgeNode next = (EdgeNode)edges.get(NEXT_INDEX(i, edges.size()));
+      EdgeNode ith  = (EdgeNode)edges.get(i);
       return ((prev.vertex_y &gt;= ith.vertex_y) &amp;&amp;
               (next.vertex_y &gt;  ith.vertex_y));
     }
     
     public boolean NOT_FMAX( int i )
     {
-      EdgeNode next = m_List[NEXT_INDEX(i, len)];
-      EdgeNode ith  = m_List[i];
+      EdgeNode next = (EdgeNode)edges.get(NEXT_INDEX(i, edges.size()));
+      EdgeNode ith  = (EdgeNode)edges.get(i);
       return(next.vertex_y &gt; ith.vertex_y);
     }
     
     public boolean REV_MIN( int i )
     {
-      EdgeNode prev = m_List[PREV_INDEX(i, len)];
-      EdgeNode next = m_List[NEXT_INDEX(i, len)];
-      EdgeNode ith  = m_List[i];
+      EdgeNode prev = (EdgeNode)edges.get(PREV_INDEX(i, edges.size()));
+      EdgeNode next = (EdgeNode)edges.get(NEXT_INDEX(i, edges.size()));
+      EdgeNode ith  = (EdgeNode)edges.get(i);
       return ((prev.vertex_y &gt;  ith.vertex_y) &amp;&amp;
               (next.vertex_y &gt;= ith.vertex_y));
     }
     
     public boolean NOT_RMAX( int i )
     {
-      EdgeNode prev = m_List[PREV_INDEX(i, len)];
-      EdgeNode ith  = m_List[i];
-      return (prev.vertex_y &gt; ith.vertex_y) ;
+      EdgeNode prev = (EdgeNode)edges.get(PREV_INDEX(i, edges.size()));
+      EdgeNode ith  = (EdgeNode)edges.get(i);
+      return (prev.vertex_y &gt; ith.vertex_y);
     }
   }
   
@@ -2799,27 +2567,27 @@ class FastRClip
     
     public LmtNode( float yvalue )
     {
-      y = yvalue ;
+      y = yvalue;
     }
   }
   
   private static class LmtTable
   {
-    LmtNode top_node ;
+    LmtNode top_node;
     
     public void print()
     {
-      int n = 0 ;
-      LmtNode lmt = top_node ;
+      int n = 0;
+      LmtNode lmt = top_node;
       while( lmt != null )
         {
           System.out.println(&quot;lmt(&quot;+n+&quot;)&quot;);
-          for( EdgeNode edge = lmt.first_bound ; (edge != null) ; edge = edge.next_bound )
+          for( EdgeNode edge = lmt.first_bound; (edge != null); edge = edge.next_bound )
             {
               System.out.println(&quot;edge.vertex_x=&quot;+edge.vertex_x+&quot;  edge.vertex_y=&quot;+edge.vertex_y);
             }
-          n++ ;
-          lmt = lmt.next ;
+          n++;
+          lmt = lmt.next;
         }
     }
   }
@@ -2835,7 +2603,7 @@ class FastRClip
     
     public ScanBeamTree( float yvalue )
     {
-      y = yvalue ;
+      y = yvalue;
     }
   }
   
@@ -2844,20 +2612,20 @@ class FastRClip
    */
   private static class ScanBeamTreeEntries
   {
-    int sbt_entries ;
-    ScanBeamTree sb_tree ;
+    int sbt_entries;
+    ScanBeamTree sb_tree;
     
     public float[] build_sbt()
     {
       float[] sbt = new float[sbt_entries];
       
-      int entries = 0 ;
+      int entries = 0;
       entries = inner_build_sbt( entries, sbt, sb_tree );
       if( entries != sbt_entries )
         {
           throw new IllegalStateException(&quot;Something went wrong buildign sbt from tree.&quot;);
         }
-      return sbt ;
+      return sbt;
     }
     
     private int inner_build_sbt( int entries, float[] sbt, ScanBeamTree sbt_node )
@@ -2872,7 +2640,7 @@ class FastRClip
         {
           entries = inner_build_sbt(entries, sbt, sbt_node.more );
         }
-      return entries ;
+      return entries;
     }
   }
   
@@ -2881,30 +2649,30 @@ class FastRClip
    */
   private static class ItNode
   {
-    EdgeNode ie0,ie1;      /* Intersecting edge (bundle) pair   */
-    RPoint point = new RPoint(); /* Point of intersection             */
-    ItNode next;                         /* The next intersection table node  */
+    EdgeNode ie0, ie1;                           /* Intersecting edge (bundle) pair   */
+    float point_x, point_y;                      /* Point of intersection             */
+    ItNode next;                                 /* The next intersection table node  */
     
     public ItNode( EdgeNode edge0, EdgeNode edge1, float x, float y, ItNode next )
     {
       this.ie0 = edge0;
       this.ie1 = edge1;
-      this.point.x = x;
-      this.point.y = y;
+      this.point_x = x;
+      this.point_y = y;
       this.next = next;
     }
   }
   
   private static class ItNodeTable
   {
-    ItNode top_node ;
+    ItNode top_node;
     
     public void build_intersection_table(AetTree aet, float dy)
     {
-      StNode st = null ;
+      StNode st = null;
       
       /* Process each AET edge */
-      for (EdgeNode edge = aet.top_node ; (edge != null); edge = edge.next)
+      for (EdgeNode edge = aet.top_node; (edge != null); edge = edge.next)
         {
           if( (edge.bstate_above == BundleState.BUNDLE_HEAD) ||
               (edge.bundle_above[CLIP] != 0) ||
@@ -2922,18 +2690,18 @@ class FastRClip
   private static class StNode
   {
     EdgeNode edge;         /* Pointer to AET edge               */
-    float   xb;           /* Scanbeam bottom x coordinate      */
-    float   xt;           /* Scanbeam top x coordinate         */
-    float   dx;           /* Change in x for a unit y increase */
-    StNode   prev;         /* Previous edge in sorted list      */
+    float xb;              /* Scanbeam bottom x coordinate      */
+    float xt;              /* Scanbeam top x coordinate         */
+    float dx;              /* Change in x for a unit y increase */
+    StNode prev;           /* Previous edge in sorted list      */
     
     public StNode( EdgeNode edge, StNode prev )
     {
-      this.edge = edge ;
-      this.xb = edge.xb ;
-      this.xt = edge.xt ;
-      this.dx = edge.dx ;
-      this.prev = prev ;
+      this.edge = edge;
+      this.xb = edge.xb;
+      this.xt = edge.xt;
+      this.dx = edge.dx;
+      this.prev = prev;
     }      
   }
   
@@ -2944,7 +2712,7 @@ class FastRClip
   {
     System.out.println(&quot;&quot;);
     System.out.println(&quot;sbt.length=&quot;+sbt.length);
-    for( int i = 0 ; i &lt; sbt.length ; i++ )
+    for( int i = 0; i &lt; sbt.length; i++ )
       {
         System.out.println(&quot;sbt[&quot;+i+&quot;]=&quot;+sbt[i]);
       }</diff>
      <filename>src/geomerative/FastRClip.java</filename>
    </modified>
    <modified>
      <diff>@@ -97,7 +97,7 @@ class RClip
   private RClip()
   {
   }
-  
+    
   // ----------------------
   // --- Static Methods ---
   // ----------------------
@@ -241,6 +241,10 @@ class RClip
    */
   private static RPolygon clip( OperationType op, RPolygon subj, RPolygon clip, Class polyClass )
   {
+    if(RGeomerative.useFastClip) {
+      return FastRClip.clip(op, subj, clip, polyClass);
+    }
+    
     RPolygon result = createNewPoly( polyClass ) ;
     
     /* Test for trivial NULL result cases */
@@ -866,6 +870,10 @@ class RClip
    */
   private static RMesh clip( OperationType op, RPolygon subj, RPolygon clip )
   {
+    if(RGeomerative.useFastClip) {
+      return FastRClip.clip(op, subj, clip);
+    }
+    
     PolygonNode tlist=null, tnn, tn;
     EdgeNode prev_edge, next_edge, edge, cf=null, succ_edge, e0, e1;
     VertexNode lt, ltn, rt, rtn;
@@ -2288,7 +2296,7 @@ class RClip
   // ---------------------
   // --- Inner Classes ---
   // ---------------------
-  private static class OperationType
+  public static class OperationType
   {
     private String m_Type ;
     private OperationType( String type ) { m_Type = type; }</diff>
      <filename>src/geomerative/RClip.java</filename>
    </modified>
    <modified>
      <diff>@@ -34,6 +34,11 @@ public class RGeomerative implements PConstants{
 
   /**
    * @invisible
+   */  
+  public static boolean useFastClip = true;
+
+  /**
+   * @invisible
    */
   public final static int BYPOINT = 0;
   </diff>
      <filename>src/geomerative/RGeomerative.java</filename>
    </modified>
    <modified>
      <diff>@@ -47,6 +47,7 @@ public class ClipTest extends TestCase {
     RPolygon slow_int=null,slow_union=null,slow_xor=null,slow_diff=null;
     RPolygon fast_int=null,fast_union=null,fast_xor=null,fast_diff=null;
     
+    RGeomerative.useFastClip = false;
     f.record(&quot;slow intersection&quot;);
     for(int i = 0; i &lt; n; i++) { slow_int   = RClip.intersection(a,b); }
     f.record(&quot;slow union&quot;);
@@ -56,14 +57,15 @@ public class ClipTest extends TestCase {
     f.record(&quot;slow diff&quot;);
     for(int i = 0; i &lt; n; i++) { slow_diff  = RClip.diff(a,b); }
     
+    RGeomerative.useFastClip = true;
     f.record(&quot;fast int&quot;);
-    for(int i = 0; i &lt; n; i++) { fast_int   = FastRClip.intersection(a,b); }
+    for(int i = 0; i &lt; n; i++) { fast_int   = RClip.intersection(a,b); }
     f.record(&quot;fast union&quot;);
-    for(int i = 0; i &lt; n; i++) { fast_union = FastRClip.union(a,b); }
+    for(int i = 0; i &lt; n; i++) { fast_union = RClip.union(a,b); }
     f.record(&quot;fast xor&quot;);
-    for(int i = 0; i &lt; n; i++) { fast_xor   = FastRClip.xor(a,b); }
+    for(int i = 0; i &lt; n; i++) { fast_xor   = RClip.xor(a,b); }
     f.record(&quot;fast diff&quot;);
-    for(int i = 0; i &lt; n; i++) { fast_diff  = FastRClip.diff(a,b); }
+    for(int i = 0; i &lt; n; i++) { fast_diff  = RClip.diff(a,b); }
     f.stop();
     f.print();
     </diff>
      <filename>test/geomerative/ClipTest.java</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>433783ffaafc98d270653f56145ff82fc244e02d</id>
    </parent>
  </parents>
  <author>
    <name>Mark Luffel</name>
    <email>markluffel@gmail.com</email>
  </author>
  <url>http://github.com/markluffel/geomerative/commit/b5f91bf59ab35f498695c30ba10f0d6861bc74e4</url>
  <id>b5f91bf59ab35f498695c30ba10f0d6861bc74e4</id>
  <committed-date>2008-07-27T13:50:42-07:00</committed-date>
  <authored-date>2008-07-27T13:50:42-07:00</authored-date>
  <message>fixing issue with FastRClip, using it by default (both RClip and FastRClip will remain available), new test, eclipse project files</message>
  <tree>93cf2fe76c5e9838d3f43251818152e462b46f74</tree>
  <committer>
    <name>Mark Luffel</name>
    <email>markluffel@gmail.com</email>
  </committer>
</commit>
