anchor.diff:                      if polygons.Count > 0 then Some polygons.[polygons.Count-1]
                       else None
   
  -                let w = polygon.ComputeWindingNumber()
  -
  -
  -                match last with
  -                    | Some last when polygon.IsFullyContainedInside last ->
  -                        polygons.[polygons.Count-1] <- mergePolys last polygon
  +                let containing =
  +                    polygons 
  +                        |> Seq.indexed 
  +                        |> Seq.tryFind (fun (i,p) -> p.IsFullyContainedInside polygon || polygon.IsFullyContainedInside p)
  +      
  +
  +
  +                // p0, p1, p2, p3
  +
  +
  +                // p0*(1-t)^3 + 3*p1*(1-t)^2*t + 3*p2*(1-t)*t^2 + p3*t^3 - p0*(1-t)^2 - 2*t*pc - p3*t^2 = 0
  +
  +                // t = 0.5 :
  +                // p0*0.5^3 + 3*p1*0.5^3 + 3*p2*0.5^3 + p3*0.5^3 - p0*0.5^2 - 2*0.5*pc - p3*0.5^2 = 0  
  +                // p0*0.5^2 + 3*p1*0.5^2 + 3*p2*0.5^2 + p3*0.5^2 - p0*0.5 - 2*pc - p3*0.5 = 0  
  +                //-p0/4 + p1*(3/4) + p2*(3/4) - p3/4 = 2*pc
  +                //-p0/8 + p1*(3/8) + p2*(3/8) - p3/8 = pc
  +
  +                match containing with
  +                    | Some (i, other) ->
  +                        polygons.[i] <- mergePolys other polygon
   
                       
  -                    | Some last when last.IsFullyContainedInside polygon ->
  -                        polygons.[polygons.Count-1] <- mergePolys polygon last
  +//                    | Some last when polygon.IsFullyContainedInside last ->
  +//                        polygons.[polygons.Count-1] <- mergePolys last polygon
  +//
  +//                    
  +//                    | Some last when last.IsFullyContainedInside polygon ->
  +//                        polygons.[polygons.Count-1] <- mergePolys polygon last
   
                       | _ ->
                           polygons.Add polygon
  
positive.code:             else 
                  Bezier2Seg(p0, p1, p2)
  
          let bezier3 p0 p1 p2 p3 = 
              // TODO: check if the segment is actually cubic
              Bezier3Seg(p0, p1, p2, p3)
  
          let point (t : float) (seg : PathSegment) =
              let t = clamp 0.0 1.0 t
  
negative.code:                |> Sg.trafo (Trafo3d.FromOrthoNormalBasis(V3d.IOO, V3d.OOI, V3d.OIO)  |> Mod.constant)
                 |> Sg.viewTrafo (viewTrafo   |> Mod.map CameraView.viewTrafo )
                 |> Sg.projTrafo (perspective |> Mod.map Frustum.projTrafo    )
           
                 |> Sg.fillMode fillMode
  
                 |> Sg.trafo (Trafo3d.FromOrthoNormalBasis(V3d.IOO, -V3d.OIO, -V3d.OOI)  |> Mod.constant)
  