#include <NTreeHelper.h>
Public Member Functions | |
| NTreeScope () | |
| NTreeScope (const Vector2D &_origin, double _size) | |
| void | resize (const Vector2D &_origin, double _size) |
| bool | contains (const Vector2D &) const |
| NTreeScope | getSubScope (unsigned int quadrant) const |
| bool | isValid () const |
Public Attributes | |
| Vector2D | origin |
| double | size |
Friends | |
| bool | operator== (const NTreeScope &a, const NTreeScope &b) |
| bool | operator< (const NTreeScope &a, const NTreeScope &b) |
| std::ostream & | operator<< (std::ostream &Stream, const NTreeScope &scope) |
Definition at line 30 of file NTreeHelper.h.
| NTreeScope::NTreeScope | ( | ) |
| NTreeScope::NTreeScope | ( | const Vector2D & | _origin, | |
| double | _size | |||
| ) |
Definition at line 8 of file NTreeHelper.cc.
| bool NTreeScope::contains | ( | const Vector2D & | point | ) | const |
Definition at line 20 of file NTreeHelper.cc.
Referenced by NTree::handleMove(), NTreeNode::isInScope(), and NTreeGroup::isInScope().
{
if( !isValid() ) return false;
return origin.xyMaxDistance(point)*2.0 <= size;
}
| NTreeScope NTreeScope::getSubScope | ( | unsigned int | quadrant | ) | const |
Definition at line 26 of file NTreeHelper.cc.
Referenced by NTree::handlePingCallTimeout().
{
if( !isValid() ) return NTreeScope();
Vector2D newOrigin = origin;
double newSize = size/2.0;
if( quadrant < 2 ) {
// right half
newOrigin.x += newSize / 2.0;
} else {
newOrigin.x -= newSize / 2.0;
}
if( quadrant == 0 || quadrant == 3 ) {
// upper half
newOrigin.y += newSize / 2.0;
} else {
newOrigin.y -= newSize / 2.0;
}
return NTreeScope( newOrigin, newSize );
}
| bool NTreeScope::isValid | ( | ) | const [inline] |
Definition at line 39 of file NTreeHelper.h.
Referenced by contains(), and getSubScope().
{ return size >= 0; }
| void NTreeScope::resize | ( | const Vector2D & | _origin, | |
| double | _size | |||
| ) |
Definition at line 14 of file NTreeHelper.cc.
| bool operator< | ( | const NTreeScope & | a, | |
| const NTreeScope & | b | |||
| ) | [friend] |
| std::ostream& operator<< | ( | std::ostream & | Stream, | |
| const NTreeScope & | scope | |||
| ) | [friend] |
Definition at line 61 of file NTreeHelper.cc.
| bool operator== | ( | const NTreeScope & | a, | |
| const NTreeScope & | b | |||
| ) | [friend] |
Definition at line 40 of file NTreeHelper.h.
Referenced by contains(), NTree::divideNode(), NTreeNode::getChildForPos(), getSubScope(), NTree::handleMove(), NTree::handlePingCallTimeout(), operator<(), operator<<(), operator==(), resize(), and NTree::sendToGroup().
| double NTreeScope::size |
Definition at line 41 of file NTreeHelper.h.
Referenced by contains(), NTree::divideNode(), getSubScope(), NTree::handleJoinCall(), NTree::handleMove(), NTree::handlePingCallTimeout(), isValid(), NTreeScope(), operator<(), operator<<(), operator==(), and resize().
1.7.1