# File rbSnack/tkSnackUtil.rb, line 115
  def doubleSeg(startPos=0, endPos=nil, minPower=nil, minPower2=nil, minDuration=nil, minDuration2=nil) 
    firstPass=singleSeg(startPos, endPos, minPower, minDuration)
    rtnArry=[]
    firstPass.each do |interval|
      s=interval[0]
      e=interval[1]
      secondPass=singleSeg(s, e, minPower2, minDuration2)
      #next we build intervals of the low pieces
      lftPt=s
      lowIntervals=[]
      secondPass.each do |subinterval|
        rgtPt=subinterval[0]
        lowIntervals<<[lftPt, rgtPt]
        lftPt=subinterval[1]
      end
      rgtPt=e
      lowIntervals<<[lftPt, rgtPt]
      partition=[]
      #now extract min of each low piece
      lowIntervals.each do |lowinterval|
        minX = lowinterval[0]
        lowinterval[0].upto(lowinterval[1]){ |x|
          minX=x if @power[x]<@power[minX]
        }
        partition<<minX
      end
      #now create intervals from the partition and add them to the
      #final set
      l=nil
      partition.each{ |x| rtnArry<<[l,x] if l!=nil; l=x }
   end
   rtnArry
  end