complated quadrangle_counter, made faster algorithm of triangle_counter.