Decomposition of two-dimensional shapes for efficient retrieval