32#include "DGtal/base/Common.h"
33#include "DGtal/kernel/PointVector.h"
34#include "DGtal/images/Morton.h"
35#include "DGtal/base/Bits.h"
51 unsigned int nbok = 0;
54 trace.beginBlock (
"Testing Morton codes ..." );
70 nbok += (h == 0) ? 1 : 0;
74 trace.info() <<
"Point from code= "<<pbis<<endl;
75 nbok += (p == pbis) ? 1 : 0;
84 nbok += (h == 14) ? 1 : 0;
88 trace.info() <<
"Point from code= "<<pbis<<endl;
89 nbok += (p2 == pbis) ? 1 : 0;
92 trace.beginBlock(
"Testing children...");
95 for(
unsigned int k=0; k<4;k++)
99 trace.beginBlock(
"getKey Benchmark");
103 for(
unsigned int k=0; k < 1000000 ;k++)
111 trace.info() <<
"Compiler trick"<<endl;
113 trace.info() <<
"(" << nbok <<
"/" << nb <<
") "
114 <<
"true == true" << std::endl;
118 trace.warning() <<
"Log2(1)=" <<
LOG2<
sizeof(int)>::VALUE<<endl;
126int main(
int argc,
char** argv )
128 trace.beginBlock (
"Testing class Morton" );
129 trace.info() <<
"Args:";
130 for (
int i = 0; i < argc; ++i )
131 trace.info() <<
" " << argv[ i ];
132 trace.info() << endl;
135 trace.emphase() << ( res ?
"Passed." :
"Error." ) << endl;
126int main(
int argc,
char** argv ) {
…}
Aim: Implements the binary Morton code construction in nD.
void interleaveBits(const Point &aPoint, HashKey &output) const
void childrenKeys(const HashKey key, HashKey *result) const
void coordinatesFromKey(const HashKey key, Point &coordinates) const
HashKey keyFromCoordinates(const std::size_t treeDepth, const Point &coordinates) const
Aim: Implements basic operations that will be used in Point and Vector classes.
DGtal is the top-level namespace which contains all DGtal functions and types.
std::uint64_t uint64_t
unsigned 64-bit integer.
static std::string bitString(T value, unsigned nbBits=0)
Bits Structs grouping all the functions of this tiny library for bitwise calculation.