| 51 | } |
| 52 | |
| 53 | StaticList<RectF, 2> WorldGeometry::splitRect(RectF const& bbox) const { |
| 54 | if (bbox.isNull() || m_size[0] == 0) |
| 55 | return {bbox}; |
| 56 | |
| 57 | Vec2F minWrap = xwrap(bbox.min()); |
| 58 | RectF bboxWrap = RectF(minWrap, minWrap + bbox.size()); |
| 59 | |
| 60 | // This does not work for ranges greater than m_size[0] wide! |
| 61 | starAssert(bbox.xMax() - bbox.xMin() <= (float)m_size[0]); |
| 62 | |
| 63 | // Since min is wrapped, we're only checking to see if max is on the other |
| 64 | // side of the wrap point |
| 65 | if (bboxWrap.xMax() > m_size[0]) { |
| 66 | return {RectF(bboxWrap.xMin(), bboxWrap.yMin(), m_size[0], bboxWrap.yMax()), |
| 67 | RectF(0, bboxWrap.yMin(), bboxWrap.xMax() - m_size[0], bboxWrap.yMax())}; |
| 68 | } else { |
| 69 | return {bboxWrap}; |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | StaticList<RectF, 2> WorldGeometry::splitRect(RectF bbox, Vec2F const& position) const { |
| 74 | bbox.translate(position); |