INNER CODE UNIT · C++
TOP_LEFT_SCALE
novelrt/NovelRT · Maths/QuadTree.cpp:13
const GeoVector2F TOP_LEFT_SCALE = GeoVector2F(-0.5f, +0.5f);
const GeoVector2F TOP_RIGHT_SCALE = GeoVector2F(+0.5f, +0.5f);
const GeoVector2F BOTTOM_LEFT_SCALE = GeoVector2F(-0.5f, -0.5f);
const GeoVector2F BOTTOM_RIGHT_SCALE = GeoVector2F(+0.5f, -0.5f);
GeoVector2F size = GetBounds().size / 2;
GeoVector2F position = GetBounds().position;
_children[TOP_LEFT] =
std::make_unique<QuadTree>(GeoBounds(position + (size * TOP_LEFT_SCALE), size, 0), weak_from_this());
_children[TOP_RIGHT] =
std::make_unique<QuadTree>(GeoBounds(position + (size * TOP_RIGHT_SCALE), size, 0), weak_from_this());
_children[BOTTOM_LEFT] =
std::make_unique<QuadTree>(GeoBounds(position + (size * BOTTOM_LEFT_SCALE), size, 0), weak_from_this());
_children[BOTTOM_RIGHT] =
std::make_unique<QuadTree>(GeoBounds(position + (size * BOTTOM_RIGHT_SCALE), size, 0), weak_from_this());
for (size_t i = 0; i < GetPointCount(); i++)