PhoenixGraph  01.0.0
Set of tools to simplify graph manipulation
Loading...
Searching...
No Matches
PNTreeLightNode_impl.h File Reference
#include <string.h>
#include <math.h>
#include "pstatic_computation.h"
#include "PNTreeLightNode.h"
+ Include dependency graph for PNTreeLightNode_impl.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<typename T, unsigned char N>
bool checkSizeLimitLight (const T halfSizeChild[N], T sizeLimit)
 Check the size of the childs of a N Tree.
 
template<typename T, unsigned char N>
getDistanceFromData (const T posA[N], const T posB[N])
 Get the distance between two points.
 
template<unsigned char N>
unsigned int getNeighbourCellIndex (unsigned char indexChild[N], unsigned char currentChildIndex[N])
 Get the index of the check neighbours tab.
 
template<typename T, unsigned char N>
void makeHalfSize (T childSize[N], const T parentSize[N])
 Get the size of the child.
 

Function Documentation

◆ checkSizeLimitLight()

template<typename T, unsigned char N>
bool checkSizeLimitLight ( const T halfSizeChild[N],
T sizeLimit )

Check the size of the childs of a N Tree.

Parameters
halfSizeChild: table of half size of the current N Tree
sizeLimit: limit of the cell size
Returns
true if everything is OK, false if the childs are too small

Definition at line 54 of file PNTreeLightNode_impl.h.

54 {
55 for(unsigned char i(0); i < N; ++i){
56 if(halfSizeChild[i] < sizeLimit) return false;
57 }
58 return true;
59}

Referenced by PNTreeLightNode< T, U, N >::addElement(), and PNTreeLightNode< T, U, N >::split().

+ Here is the caller graph for this function:

◆ getDistanceFromData()

template<typename T, unsigned char N>
T getDistanceFromData ( const T posA[N],
const T posB[N] )

Get the distance between two points.

Parameters
posA: first position
posB: second position
Returns
distance between posA and posB

Definition at line 217 of file PNTreeLightNode_impl.h.

217 {
218 T res = 0.0, x;
219 for(unsigned char i(0); i < N; ++i){
220 x = posA[i] - posB[i];
221 res += x*x;
222 }
223 return sqrt(res);
224}

Referenced by PNTreeLightNode< T, U, N >::getCloserData().

+ Here is the caller graph for this function:

◆ getNeighbourCellIndex()

template<unsigned char N>
unsigned int getNeighbourCellIndex ( unsigned char indexChild[N],
unsigned char currentChildIndex[N] )

Get the index of the check neighbours tab.

Parameters
indexChild: index of the reference cell
currentChildIndex: index of the current node to be checked
Returns
index of the neighbours to be checked in the neighbours table

Definition at line 232 of file PNTreeLightNode_impl.h.

232 {
233 unsigned int index(0u), base(1u), tmp;
234 for(unsigned char i(N); i < N; ++i){
235 tmp = 0u;
236 if(indexChild[i] > currentChildIndex[i]){
237 tmp = 2u;
238 }else if(indexChild[i] == currentChildIndex[i]){
239 tmp = 1u;
240 }
241 index += base*tmp;
242 base *= 3u;
243 }
244 return index;
245}

Referenced by PNTreeLightNode< T, U, N >::getCloserData().

+ Here is the caller graph for this function:

◆ makeHalfSize()

template<typename T, unsigned char N>
void makeHalfSize ( T childSize[N],
const T parentSize[N] )

Get the size of the child.

Parameters
[out]childSize: child size
parentSize: parent size

Definition at line 42 of file PNTreeLightNode_impl.h.

42 {
43 for(unsigned char i(0lu); i < N; ++i){
44 childSize[i] = parentSize[i]/2.f;
45 }
46}

Referenced by PNTreeLightNode< T, U, N >::addElement(), PNTreeLightNode< T, U, N >::getCloserData(), PNTreeLightNode< T, U, N >::getLastData(), PNTreeLightNode< T, U, N >::saveGnuplotData(), and PNTreeLightNode< T, U, N >::split().

+ Here is the caller graph for this function: