2D Primitive Detection and Manipulation