str << [geometry.length, geometry.reduce(0) { |a, e| a + e.length }].pack('V2')
          str << geometry.reduce([0]) do |a, e|
            a << (a.last + e.length) # last element of the previous array is dropped
          end.pack("V#{geometry.length}")
          geometry.each do |ls|