MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / splitRect

Method splitRect

source/base/StarWorldGeometry.cpp:53–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53StaticList<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
73StaticList<RectF, 2> WorldGeometry::splitRect(RectF bbox, Vec2F const& position) const {
74 bbox.translate(position);

Callers

nothing calls this directly

Calls 8

xMaxMethod · 0.80
xMinMethod · 0.80
yMinMethod · 0.80
yMaxMethod · 0.80
isNullMethod · 0.45
minMethod · 0.45
sizeMethod · 0.45
translateMethod · 0.45

Tested by

no test coverage detected