#include <poly_Quadtree.h>
|
static mobiusPoly_EXPORT bool | IsValidCornerId (const size_t id) |
|
static mobiusPoly_EXPORT size_t | GetCornerID (const size_t nx, const size_t ny) |
|
static mobiusPoly_EXPORT void | GetCornerLocation (const size_t id, size_t &nx, size_t &ny) |
|
A single node in our quadtree data structure.
◆ poly_QuadtreeNode()
mobiusPoly_EXPORT mobius::poly_QuadtreeNode::poly_QuadtreeNode |
( |
const t_uv & |
cornerMin, |
|
|
const t_uv & |
cornerMax |
|
) |
| |
Ctor accepting corners.
- Parameters
-
[in] | cornerMin | min corner point. |
[in] | cornerMax | max corner point. |
◆ GetCornerID()
static mobiusPoly_EXPORT size_t mobius::poly_QuadtreeNode::GetCornerID |
( |
const size_t |
nx, |
|
|
const size_t |
ny |
|
) |
| |
|
static |
Returns the ID of one of the 4 cell corners. This ID is determined by the passed locations of the corresponding x
and y
coordinates. The passed arguments may have values 0 and 1, hence there are 4 combinations (4 corners).
The returned ID is derived with the following rule:
//! ID = nx | (ny << 1)
//!
So it gives:
\verbatim
//! nx | ny || id //! ====+====++=== //! 0 | 0 || 0 //! -—+-—++— //! 1 | 0 || 1 //! -—+-—++— //! 0 | 1 || 2 //! -—+-—++— //! 1 | 1 || 3 //! -—+-—++— //!
\param[in] nx X location (0 for min, 1 for max).
\param[in] ny Y location (0 for min, 1 for max).
\return ID of the corner in range [0,3].
◆ GetCornerLocation()
static mobiusPoly_EXPORT void mobius::poly_QuadtreeNode::GetCornerLocation |
( |
const size_t |
id, |
|
|
size_t & |
nx, |
|
|
size_t & |
ny |
|
) |
| |
|
static |
Given the corner ID in range [0,3], this static function returns the location of the corner in a cell.
The location is derived with the following rule (opposite to the rule which is used to derive the ID by location):
//! nx = (id >> 0) & 1
//! ny = (id >> 1) & 1
//!
\verbatim
//! id || nx | ny //! ====++====+==== //! 0 || 0 | 0 //! -—++-—+-— //! 1 || 1 | 0 //! -—++-—+-— //! 2 || 0 | 1 //! -—++-—+-— //! 3 || 1 | 1 //! -—++-—+-— //!
\param[in] id ID of the corner.
\param[out] nx location along OX world axis.
\param[out] ny location along OY world axis.
◆ IsValidCornerId()
static mobiusPoly_EXPORT bool mobius::poly_QuadtreeNode::IsValidCornerId |
( |
const size_t |
id | ) |
|
|
static |
Checks if the passed corner ID is valid.
- Parameters
-
- Returns
- true/false.
The documentation for this class was generated from the following file: