QtCraft API C++ classes QML types Handbook

QcBoxGrid Class

Boxes sorted into the columns of a horizontal grid (decision E-920), so a box is compared only with the boxes in the columns it covers instead of with every other: the boats that push each other and the creatures a boat picks up. More...

Header: #include <server/boats/QcBoxGrid.h>

Public Functions

void add(qsizetype index, const QcAabb &box)
bool isEmpty() const
QList<qsizetype> near(const QcAabb &box) const

Static Public Members

const double columnSize

Detailed Description

Each box is kept under its index in the caller's list.

Member Function Documentation

void QcBoxGrid::add(qsizetype index, const QcAabb &box)

Adds box under the caller's index.

bool QcBoxGrid::isEmpty() const

Returns whether it holds no box.

QList<qsizetype> QcBoxGrid::near(const QcAabb &box) const

Returns the indices of the boxes in the columns box covers, ascending and each once: every box that overlaps box is among them (and some that do not).

Member Variable Documentation

const double QcBoxGrid::columnSize

Width of a column in metres: wider than a boat, so a boat's box covers at most 2 x 2 columns.