#include <HilbertCoordinateMapper.h>
Public Member Functions | |
HilbertCoordinateMapper () | |
Static Public Member Functions | |
static double | toHilbert2D (const vector< double > *coordinates) |
static double | toHilbert3D (const vector< double > *coordinates) |
Protected Types | |
typedef boost::multi_array< double, 2 > | array_type |
Static Protected Member Functions | |
static array_type | makePattern () |
Static Protected Attributes | |
static array_type | Box_3D = HilbertCoordinateMapper::pattern |
static array_type | Box_3Dtemp = HilbertCoordinateMapper::pattern |
static array_type | pattern = HilbertCoordinateMapper::makePattern() |
Static Private Member Functions | |
static void | makeVec (const double x, const double y, vector< double > *where) |
static void | makeVec (const double x, const double y, const double z, vector< double > *where) |
static void | mid (const vector< double > *x, const vector< double > *y, vector< double > *to) |
static void | mid3D (unsigned int pos, unsigned int i, unsigned int j) |
static double | dist (const vector< double > *x, const vector< double > *y, const unsigned int dim) |
static double | dist3D (const vector< double > *x, const unsigned int i) |
static unsigned int | closestTo (const vector< double > *coor, const vector< vector< double > > *corners, const unsigned int dim) |
static unsigned int | closestTo3D (const vector< double > *coor) |
static void | refineCoors2D (vector< vector< double > > *corners, const unsigned int cell) |
static void | refineCoors3D (const unsigned int cell) |
static double | base8_to_base10 (const vector< unsigned int > *digits) |
static double | base4_to_base10 (const vector< unsigned int > *digits) |
template<const unsigned int base> | |
static double | base_n_to_base10 (const vector< unsigned int > *digits) |
Definition at line 32 of file HilbertCoordinateMapper.h.
typedef boost::multi_array<double, 2 > HilbertCoordinateMapper::array_type [protected] |
Definition at line 103 of file HilbertCoordinateMapper.h.
HilbertCoordinateMapper::HilbertCoordinateMapper | ( | ) | [inline] |
Base constructor. Does nothing.
Definition at line 35 of file HilbertCoordinateMapper.h.
void HilbertCoordinateMapper::makeVec | ( | const double | x, | |
const double | y, | |||
vector< double > * | where | |||
) | [static, private] |
Conveniance 2D vector creation function.
Definition at line 21 of file HilbertCoordinateMapper.cpp.
Referenced by toHilbert2D().
void HilbertCoordinateMapper::makeVec | ( | const double | x, | |
const double | y, | |||
const double | z, | |||
vector< double > * | where | |||
) | [static, private] |
Convenience 3D vector creation function.
Definition at line 34 of file HilbertCoordinateMapper.cpp.
void HilbertCoordinateMapper::mid | ( | const vector< double > * | x, | |
const vector< double > * | y, | |||
vector< double > * | to | |||
) | [static, private] |
Calculates the midpoint of two vectors.
x | The first vector. | |
y | The second vector. | |
to | Pointer to where the mid-point vector should be stored in. |
Definition at line 96 of file HilbertCoordinateMapper.cpp.
Referenced by refineCoors2D().
void HilbertCoordinateMapper::mid3D | ( | unsigned int | pos, | |
unsigned int | i, | |||
unsigned int | j | |||
) | [inline, static, private] |
Calculates the mid-point of two 3D vectors in the matrix Box_3D.
pos | Position where to store the resulting mid-point vector in Box_3Dtemp. | |
i | Index of the first vector to use in the matrix. | |
j | Index of the second vector to use in the matrix. |
Definition at line 113 of file HilbertCoordinateMapper.cpp.
References Box_3D, and Box_3Dtemp.
Referenced by refineCoors3D().
double HilbertCoordinateMapper::dist | ( | const vector< double > * | vx, | |
const vector< double > * | vy, | |||
const unsigned int | dim | |||
) | [static, private] |
Function returning the euclidian distance between two vectors.
vx | Pointer to the first vector | |
vy | Pointer to the second vector | |
dim | The number of dimensions |
Definition at line 48 of file HilbertCoordinateMapper.cpp.
Referenced by closestTo(), and toHilbert2D().
double HilbertCoordinateMapper::dist3D | ( | const vector< double > * | vx, | |
const unsigned int | num | |||
) | [inline, static, private] |
Function returning the euclidian distance between two vectors.
vx | Pointer to the first vector | |
vy | Pointer to the second vector | |
dim | The number of dimensions |
Definition at line 396 of file HilbertCoordinateMapper.cpp.
References Box_3D.
Referenced by closestTo3D().
unsigned int HilbertCoordinateMapper::closestTo | ( | const vector< double > * | coor, | |
const vector< vector< double > > * | corners, | |||
const unsigned int | dim | |||
) | [static, private] |
Determines the closest vector from a set to a given vector, in terms of euclidian distance.
corners | The set of coordinates we wish to select the closest from | |
coor | The coordinate we wish to check against | |
dim | The number of dimensions |
Definition at line 68 of file HilbertCoordinateMapper.cpp.
References dist().
Referenced by toHilbert2D().
unsigned int HilbertCoordinateMapper::closestTo3D | ( | const vector< double > * | coor | ) | [static, private] |
Determines the closest vector from a set to a given vector, in terms of euclidian distance.
corners | The set of coordinates we wish to select the closest from | |
coor | The coordinate we wish to check against | |
dim | The number of dimensions |
Definition at line 372 of file HilbertCoordinateMapper.cpp.
References dist3D().
Referenced by toHilbert3D().
void HilbertCoordinateMapper::refineCoors2D | ( | vector< vector< double > > * | corners, | |
const unsigned int | cell | |||
) | [static, private] |
Function which refines a given section of a rectangle.
corners | A vector containing the 4 cornerpoints of a rectangle. At the end of the function call, this contains the 4 corners of the refined rectangle at the given cell. | |
cell | A number [0,1,..,4] indicating which cell we are refining (refer to the paper for more information). |
Definition at line 126 of file HilbertCoordinateMapper.cpp.
References mid().
Referenced by toHilbert2D().
void HilbertCoordinateMapper::refineCoors3D | ( | const unsigned int | cell | ) | [static, private] |
Function which refines a given section of a cube.
corners | A vector containing the 8 cornerpoints of a cube. At the end of the function call, this contains the 8 corners of the refined cube at the given cell. | |
cell | A number [1,2,..,8] indicating which cell we are refining (refer to the paper for more information). |
Definition at line 184 of file HilbertCoordinateMapper.cpp.
References Box_3D, Box_3Dtemp, and mid3D().
Referenced by toHilbert3D().
static double HilbertCoordinateMapper::base8_to_base10 | ( | const vector< unsigned int > * | digits | ) | [inline, static, private] |
static double HilbertCoordinateMapper::base4_to_base10 | ( | const vector< unsigned int > * | digits | ) | [inline, static, private] |
static double HilbertCoordinateMapper::base_n_to_base10 | ( | const vector< unsigned int > * | digits | ) | [inline, static, private] |
Definition at line 85 of file HilbertCoordinateMapper.h.
static array_type HilbertCoordinateMapper::makePattern | ( | ) | [inline, static, protected] |
double HilbertCoordinateMapper::toHilbert2D | ( | const vector< double > * | coordinates | ) | [static] |
Maps a 2D coordinate to a real number in [0,1] using the distance on a sufficiently refined Hilbert curve.
coordinates | Pointer to where the 2D coordinate is stored |
Warning: the coordinates vector is assumed to be normalised!
Definition at line 289 of file HilbertCoordinateMapper.cpp.
References base4_to_base10(), closestTo(), dist(), makeVec(), RECURSE_LEVEL, and refineCoors2D().
Referenced by HilbertOrdering2D< cur_type >::getVal().
double HilbertCoordinateMapper::toHilbert3D | ( | const vector< double > * | coordinates | ) | [static] |
Maps a 3D coordinate to a real number in [0,1] using the distance on a sufficiently refined Hilbert curve.
coordinates | Pointer to where the 3D coordinate is stored |
Warning: the coordinates vector is assumed to be normalised!
Definition at line 333 of file HilbertCoordinateMapper.cpp.
References base8_to_base10(), Box_3D, closestTo3D(), pattern, RECURSE_LEVEL, and refineCoors3D().
Referenced by Hilbert_R_tree::insert(), Hilbert_TGSinsert_tree< base_tree >::insertionSort(), HilbertOrdering3D< Cubic_Bounding_Box_Container >::sort(), and Hilbert_R_tree::updateLHVLocal().
array_type HilbertCoordinateMapper::Box_3D = HilbertCoordinateMapper::pattern [static, protected] |
Definition at line 104 of file HilbertCoordinateMapper.h.
Referenced by dist3D(), mid3D(), refineCoors3D(), and toHilbert3D().
array_type HilbertCoordinateMapper::Box_3Dtemp = HilbertCoordinateMapper::pattern [static, protected] |
Definition at line 105 of file HilbertCoordinateMapper.h.
Referenced by mid3D(), and refineCoors3D().
array_type HilbertCoordinateMapper::pattern = HilbertCoordinateMapper::makePattern() [static, protected] |
Definition at line 106 of file HilbertCoordinateMapper.h.
Referenced by makePattern(), and toHilbert3D().