2D and 3D Segment Trees