code: function( tolerance ){
              //if tolerance is 0, it will be faster to just use 'equals' method
              var equals = tolerance ? 'equalsWithTolerance' : 'equals';
              var p, prev, i = 0, num = this.vertices.length;
              var last;
              for( ; i<num; i++ ){
                  p = this.vertices[i];
                  //if its the 'equals' method tolerance will just be ingored
                  if( p[equals]( prev, tolerance ) ){
                      //remove from array, step back counter
                      this.vertices.splice( i, 1 );
                      i--;
                      num--;
                  } else {
                      prev = p;
                  }
              }
              num = this.vertices.length;
              if( num >  0 ){
                  last = this.vertices[num-1];
                  if( last[equals]( this.vertices[0], tolerance ) ){
                      this.vertices.splice( num-1, 1 );
                  }
              }
              return this;
          }
docs: Removes duplicate vertices from the polygon. Only successive points are
  recognized as duplicates.
  @param {Number} tolerance snap distance for finding duplicates
  @return itself