         if result.found
           result.transform = inverseTfm tfm
           break
+          
     #reverse-transform position
     [x,y,t] = result.pos
     #console.log "#### Original pos: #{JSON.stringify result.pos}"
     [x,y] = Cells.transformVector [x,y], result.transform, false #no normalize!
     #console.log "#### after inverse rotate: #{JSON.stringify [x,y,t]}"
     result.pos = [x,y,t]
+    result.delta = [dx,dy,period]
     return result
 
   _classifyNormalizedPattern: (pattern, time, dx, dy, period) ->

  if parts.length is 1
    console.log "#### only one part, try more time"
    return finishCollision rule, field, time
  for part, i in parts
    console.log "####   #{i}. #{normalizedRle part}"
    #now analyze this part
    res = analyzeFragment rule, part, time

    

analyzeFragment = (rule, pattern, time, options={})->
  analysys = determinePeriod rule, pattern, time, options
  if analysys.cycle
    console.log "####      Pattern analysys: #{JSON.stringify analysys}"
    res = library.classifyPattern pattern, time, analysys.delta...
    console.log "####      Classification: #{JSON.stringify res}"
    
#detect periodicity in pattern
# Returns :
#   cycle::bool - is cycle found


#2-block
pattern2 = Cells.from_rle "$2o2$2o"
pattern1 = Cells.from_rle "2o"

v2 = (determinePeriod rule, pattern2, 0).delta
v1 = (determinePeriod rule, pattern1, 0).delta
