Loading src/mesh/vdb/tnlIterator2D.h +7 −1 Original line number Diff line number Diff line Loading @@ -3,8 +3,11 @@ #include "tnlBitmaskArray.h" #include "tnlCircle2D.h" #include "tnlNode.h" template< unsigned size > template< unsigned size, int LogX, int LogY = LogX > class tnlIterator2D { public: Loading @@ -18,6 +21,9 @@ public: void computeBitmaskArray( tnlBitmaskArray< size >* bitmaskArray, tnlCircle2D* circle ); void setChildren( tnlNode< LogX, LogY >* children, tnlBitmaskArray< size >* bitmaskArray ); ~tnlIterator2D(){}; private: Loading src/mesh/vdb/tnlIterator2D_impl.h +23 −4 Original line number Diff line number Diff line Loading @@ -6,8 +6,10 @@ #include "tnlBitmask.h" #include "tnlCircle2D.h" template< unsigned size > tnlIterator2D< size >::tnlIterator2D( unsigned cellsX, template< unsigned size, int LogX, int LogY = LogX > tnlIterator2D< size, LogX, LogY >::tnlIterator2D( unsigned cellsX, unsigned cellsY, float stepX, float stepY, Loading @@ -22,8 +24,10 @@ tnlIterator2D< size >::tnlIterator2D( unsigned cellsX, this->startY = startY; } template< unsigned size > void tnlIterator2D< size >::computeBitmaskArray( tnlBitmaskArray< size >* bitmaskArray, template< unsigned size, int LogX, int LogY = LogX > void tnlIterator2D< size, LogX, LogY >::computeBitmaskArray( tnlBitmaskArray< size >* bitmaskArray, tnlCircle2D* circle ) { // yeah, in matrix, i like to iterate over rows first Loading @@ -40,5 +44,20 @@ void tnlIterator2D< size >::computeBitmaskArray( tnlBitmaskArray< size >* bitmas } } template< unsigned size, int LogX, int LogY = LogX > void tnlIterator2D< size, LogX, LogY >::setChildren( tnlNode< LogX, LogY >* children, tnlBitmaskArray< size >* bitmaskArray ) { for( int i = 0, i < size, i++ ) { if( bitmaskArray->getIthBitmask( i )->getState() ) children[ i ] = new tnlNode< LogX, LogY >(); // TODO pridat parametry children[ i ]->setChildren() // TODO pridat parametry level + depth else children[ i ] = NULL; } } #endif // _TNLITERATOR2D_IMPL_H_INCLUDED_ src/mesh/vdb/tnlNode.h +2 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,8 @@ class tnlNode public: tnlNode(){}; virtual void setChildren(); ~tnlNode(){}; private: Loading src/mesh/vdb/tnlRootNode.h +13 −2 Original line number Diff line number Diff line Loading @@ -4,18 +4,26 @@ #include "tnlBitmaskArray.h" #include "tnlArea2D.h" #include "tnlCircle2D.h" #include "tnlNode.h" template< unsigned size > template< unsigned size, int LogX, int LogY = LogX > class tnlRootNode { public: tnlRootNode( tnlArea2D* area, tnlCircle2D* circle, unsigned nodesX, unsigned nodesY ); unsigned nodesY, unsigned childSplitX, unsigned childSplitY, unsigned treeDepth ); void setNode(); void createTree(); void printStates(); ~tnlRootNode(); Loading @@ -26,6 +34,9 @@ private: unsigned nodesY; tnlCircle2D* circle; tnlBitmaskArray< size >* bitmaskArray; tnlNode< LogX, LogY >* children[ LogX * LogY ]; unsigned level; unsigned treeDepth; }; #include "tnlRootNode_impl.h" Loading src/mesh/vdb/tnlRootNode_impl.h +29 −11 Original line number Diff line number Diff line Loading @@ -7,25 +7,31 @@ #include "tnlRootNode.h" #include "tnlCircle2D.h" template< unsigned size > tnlRootNode< size >::tnlRootNode( tnlArea2D* area, template< unsigned size, int LogX, int LogY = LogX > tnlRootNode< size, LogX, LogY >::tnlRootNode( tnlArea2D* area, tnlCircle2D* circle, unsigned nodesX, unsigned nodesY ) unsigned nodesY, unsigned treeDepth ) { this->area = area; this->circle = circle; this->nodesX = nodesX; this->nodesY = nodesY; this->bitmaskArray = new tnlBitmaskArray< size >(); this->bitmaskArray = new tnlBitmaskArray< size, LogX, LogY >(); this->level = 0; } template< unsigned size > void tnlRootNode< size >::setNode() template< unsigned size, int LogX, int LogY = LogX > void tnlRootNode< size, LogX, LogY >::setNode() { float stepX = ( this->area->getEndX() - this->area->getStartX() ) / this->nodesX; float stepY = ( this->area->getEndY() - this->area->getStartY() ) / this->nodesY; tnlIterator2D< size >* iter = new tnlIterator2D< size >( this->nodesX, tnlIterator2D< size, LogX, LogY >* iter = new tnlIterator2D< size, LogX, LogY >( this->nodesX, this->nodesY, stepX, stepY, Loading @@ -34,15 +40,27 @@ void tnlRootNode< size >::setNode() iter->computeBitmaskArray( this->bitmaskArray, this->circle ); } template< unsigned size > void tnlRootNode< size >::printStates() template< unsigned size, int LogX, int LogY = LogX > void tnlRootNode< size, LogX, LogY >::createTree() { this->setNode(); // first we need to create root node } template< unsigned size, int LogX, int LogY = LogX > void tnlRootNode< size, LogX, LogY >::printStates() { for( int i = 0; i < size; i++ ) std::cout << this->bitmaskArray->getIthBitmask( i )->getState() << std::endl; } template< unsigned size > tnlRootNode< size >::~tnlRootNode() template< unsigned size, int LogX, int LogY = LogX > tnlRootNode< size, LogX, LogY >::~tnlRootNode() { delete this->area; delete this->circle; Loading Loading
src/mesh/vdb/tnlIterator2D.h +7 −1 Original line number Diff line number Diff line Loading @@ -3,8 +3,11 @@ #include "tnlBitmaskArray.h" #include "tnlCircle2D.h" #include "tnlNode.h" template< unsigned size > template< unsigned size, int LogX, int LogY = LogX > class tnlIterator2D { public: Loading @@ -18,6 +21,9 @@ public: void computeBitmaskArray( tnlBitmaskArray< size >* bitmaskArray, tnlCircle2D* circle ); void setChildren( tnlNode< LogX, LogY >* children, tnlBitmaskArray< size >* bitmaskArray ); ~tnlIterator2D(){}; private: Loading
src/mesh/vdb/tnlIterator2D_impl.h +23 −4 Original line number Diff line number Diff line Loading @@ -6,8 +6,10 @@ #include "tnlBitmask.h" #include "tnlCircle2D.h" template< unsigned size > tnlIterator2D< size >::tnlIterator2D( unsigned cellsX, template< unsigned size, int LogX, int LogY = LogX > tnlIterator2D< size, LogX, LogY >::tnlIterator2D( unsigned cellsX, unsigned cellsY, float stepX, float stepY, Loading @@ -22,8 +24,10 @@ tnlIterator2D< size >::tnlIterator2D( unsigned cellsX, this->startY = startY; } template< unsigned size > void tnlIterator2D< size >::computeBitmaskArray( tnlBitmaskArray< size >* bitmaskArray, template< unsigned size, int LogX, int LogY = LogX > void tnlIterator2D< size, LogX, LogY >::computeBitmaskArray( tnlBitmaskArray< size >* bitmaskArray, tnlCircle2D* circle ) { // yeah, in matrix, i like to iterate over rows first Loading @@ -40,5 +44,20 @@ void tnlIterator2D< size >::computeBitmaskArray( tnlBitmaskArray< size >* bitmas } } template< unsigned size, int LogX, int LogY = LogX > void tnlIterator2D< size, LogX, LogY >::setChildren( tnlNode< LogX, LogY >* children, tnlBitmaskArray< size >* bitmaskArray ) { for( int i = 0, i < size, i++ ) { if( bitmaskArray->getIthBitmask( i )->getState() ) children[ i ] = new tnlNode< LogX, LogY >(); // TODO pridat parametry children[ i ]->setChildren() // TODO pridat parametry level + depth else children[ i ] = NULL; } } #endif // _TNLITERATOR2D_IMPL_H_INCLUDED_
src/mesh/vdb/tnlNode.h +2 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,8 @@ class tnlNode public: tnlNode(){}; virtual void setChildren(); ~tnlNode(){}; private: Loading
src/mesh/vdb/tnlRootNode.h +13 −2 Original line number Diff line number Diff line Loading @@ -4,18 +4,26 @@ #include "tnlBitmaskArray.h" #include "tnlArea2D.h" #include "tnlCircle2D.h" #include "tnlNode.h" template< unsigned size > template< unsigned size, int LogX, int LogY = LogX > class tnlRootNode { public: tnlRootNode( tnlArea2D* area, tnlCircle2D* circle, unsigned nodesX, unsigned nodesY ); unsigned nodesY, unsigned childSplitX, unsigned childSplitY, unsigned treeDepth ); void setNode(); void createTree(); void printStates(); ~tnlRootNode(); Loading @@ -26,6 +34,9 @@ private: unsigned nodesY; tnlCircle2D* circle; tnlBitmaskArray< size >* bitmaskArray; tnlNode< LogX, LogY >* children[ LogX * LogY ]; unsigned level; unsigned treeDepth; }; #include "tnlRootNode_impl.h" Loading
src/mesh/vdb/tnlRootNode_impl.h +29 −11 Original line number Diff line number Diff line Loading @@ -7,25 +7,31 @@ #include "tnlRootNode.h" #include "tnlCircle2D.h" template< unsigned size > tnlRootNode< size >::tnlRootNode( tnlArea2D* area, template< unsigned size, int LogX, int LogY = LogX > tnlRootNode< size, LogX, LogY >::tnlRootNode( tnlArea2D* area, tnlCircle2D* circle, unsigned nodesX, unsigned nodesY ) unsigned nodesY, unsigned treeDepth ) { this->area = area; this->circle = circle; this->nodesX = nodesX; this->nodesY = nodesY; this->bitmaskArray = new tnlBitmaskArray< size >(); this->bitmaskArray = new tnlBitmaskArray< size, LogX, LogY >(); this->level = 0; } template< unsigned size > void tnlRootNode< size >::setNode() template< unsigned size, int LogX, int LogY = LogX > void tnlRootNode< size, LogX, LogY >::setNode() { float stepX = ( this->area->getEndX() - this->area->getStartX() ) / this->nodesX; float stepY = ( this->area->getEndY() - this->area->getStartY() ) / this->nodesY; tnlIterator2D< size >* iter = new tnlIterator2D< size >( this->nodesX, tnlIterator2D< size, LogX, LogY >* iter = new tnlIterator2D< size, LogX, LogY >( this->nodesX, this->nodesY, stepX, stepY, Loading @@ -34,15 +40,27 @@ void tnlRootNode< size >::setNode() iter->computeBitmaskArray( this->bitmaskArray, this->circle ); } template< unsigned size > void tnlRootNode< size >::printStates() template< unsigned size, int LogX, int LogY = LogX > void tnlRootNode< size, LogX, LogY >::createTree() { this->setNode(); // first we need to create root node } template< unsigned size, int LogX, int LogY = LogX > void tnlRootNode< size, LogX, LogY >::printStates() { for( int i = 0; i < size; i++ ) std::cout << this->bitmaskArray->getIthBitmask( i )->getState() << std::endl; } template< unsigned size > tnlRootNode< size >::~tnlRootNode() template< unsigned size, int LogX, int LogY = LogX > tnlRootNode< size, LogX, LogY >::~tnlRootNode() { delete this->area; delete this->circle; Loading