<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -73,13 +73,20 @@ module CelticKnot
           # curve doubles back on itself). If such a self-intersection
           # exists, remove the intersection by reducing all lines between
           # the intersection to the point of intersection.
+          #
+          # intersections near the beginning or end of the list are ignored,
+          # since they represent overlaps caused by a segment that intersects
+          # itself at the same midpoint (e.g. a loop around a single node).
+          # such intersections will be taken care of when the over/under
+          # intersections are subtracted later in the process.
           def cull_overlap_for_list(list)
-            i = 0
+            offset = list.length/4
+            i = offset
             while i &lt; list.length-2
               line1 = Curves::LineSegment.new(list[i], list[i+1])
 
               j = i+1
-              while j &lt; list.length-1
+              while j &lt; list.length-offset
                 line2 = Curves::LineSegment.new(list[j], list[j+1])
 
                 if (intersection = line1.intersection(line2))
@@ -153,6 +160,7 @@ module CelticKnot
       end
 
       def subtract_intersection_between(segment, boundary, from)
+
         operation = from == :start ? :shift : :pop
         reverseop = from == :start ? :unshift : :push
 </diff>
      <filename>lib/celtic_knot/knot_shape.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>57aa7cd291d3be32e14733e90e6c90603ec292c7</id>
    </parent>
  </parents>
  <author>
    <name>Jamis Buck</name>
    <email>jamis@37signals.com</email>
  </author>
  <url>http://github.com/jamis/celtic_knot/commit/7bb27773579cf14b4146645f33a2f384149b7ac1</url>
  <id>7bb27773579cf14b4146645f33a2f384149b7ac1</id>
  <committed-date>2009-06-15T07:21:33-07:00</committed-date>
  <authored-date>2009-06-15T07:21:33-07:00</authored-date>
  <message>only cull interior overlaps for the middle of thread segments

this prevents overlaps in self-intersecting segment loops from
being culled incorrectly.</message>
  <tree>ab1e0a37382c140b24daa1ca7526489cd0fc06e1</tree>
  <committer>
    <name>Jamis Buck</name>
    <email>jamis@37signals.com</email>
  </committer>
</commit>
