Loading src/mesh/vdb/make +1 −1 Original line number Diff line number Diff line g++ -O1 -g -Wall -std=c++11 -Werror tnlInternalNode.h tnlInternalNode_impl.h tnlLeafNode.h tnlLeafNode_impl.h tnlNode.h tnlNode_impl.h tnlVDBMath.h tnlRootNode_test.cpp tnlRootNode.h tnlRootNode_impl.h tnlArea2D.h tnlArea2D_impl.h tnlCircle2D.h tnlCircle2D_impl.h tnlIterator2D.h tnlIterator2D_impl.h tnlBitmaskArray.h tnlBitmaskArray_impl.h tnlBitmask.h tnlBitmask_impl.h -o test g++ -O1 -g -Wall -std=c++11 -Werror tnlInternalNode.h tnlInternalNode_impl.h tnlLeafNode.h tnlLeafNode_impl.h tnlNode.h tnlNode_impl.h tnlVDBMath.h tnlRootNode_test.cpp tnlRootNode.h tnlRootNode_impl.h tnlArea2D.h tnlArea2D_impl.h tnlCircle2D.h tnlCircle2D_impl.h tnlBitmaskArray.h tnlBitmaskArray_impl.h tnlBitmask.h tnlBitmask_impl.h -o test src/mesh/vdb/tnlInternalNode.h +0 −5 Original line number Diff line number Diff line Loading @@ -22,11 +22,6 @@ public: int splitY, int depth ); void print( int splitX, int splitY, int depth, fstream& file ); void write( fstream& f, int level ); Loading src/mesh/vdb/tnlInternalNode_impl.h +0 −30 Original line number Diff line number Diff line Loading @@ -88,36 +88,6 @@ void tnlInternalNode< LogX, LogY >::write( fstream& file, } } template< int LogX, int LogY > void tnlInternalNode< LogX, LogY >::print( int splitX, int splitY, int depth, fstream& file ) { int depthX = splitX * tnlVDBMath::power( LogX, this->level ); int depthY = splitY * tnlVDBMath::power( LogY, this->level ); float stepX = ( float ) this->area->getLengthX() / depthX; float stepY = ( float ) this->area->getLengthY() / depthY; float startX = this->X * stepX; float endX = ( this->X + 1 ) * stepX; float startY = this->Y * stepY; float endY = ( this->Y + 1 ) * stepY; tnlIterator2D< LogX * LogY, LogX, LogY >* iter = new tnlIterator2D< LogX * LogY, LogX, LogY >( LogX, LogY, ( float ) ( endX - startX ) / LogX, ( float ) ( endY - startY ) / LogY, startX, startY ); iter->dumpIntoFile( this->bitmaskArray, file, this->level ); for( int i = 0; i < LogX * LogY; i++ ) if( this->children[ i ] == NULL ) continue; else this->children[ i ]->print( splitX, splitY, depth, file ); } template< int LogX, int LogY > tnlInternalNode< LogX, LogY >::~tnlInternalNode() Loading src/mesh/vdb/tnlIterator2D.hdeleted 100644 → 0 +0 −42 Original line number Diff line number Diff line #ifndef _TNLITERATOR2D_H_INCLUDED_ #define _TNLITERATOR2D_H_INCLUDED_ #include "tnlBitmaskArray.h" #include "tnlCircle2D.h" #include <fstream> template< unsigned size, int LogX, int LogY = LogX > class tnlIterator2D { public: tnlIterator2D( unsigned cellsX, unsigned cellsY, float stepX, float stepY, float startX, float startY ); void computeBitmaskArray( tnlBitmaskArray< size >* bitmaskArray, tnlCircle2D* circle, int posX = 0, int posY = 0 ); void dumpIntoFile( tnlBitmaskArray< size >* bitmaskArray, fstream& file, int level = 0 ); ~tnlIterator2D(){}; private: unsigned cellsX; unsigned cellsY; float stepX; float stepY; float startX; float startY; }; #include "tnlIterator2D_impl.h" #endif // _TNLITERATOR2D_H_INCLUDED_ src/mesh/vdb/tnlIterator2D_impl.hdeleted 100644 → 0 +0 −76 Original line number Diff line number Diff line #ifndef _TNLITERATOR2D_IMPL_H_INCLUDED_ #define _TNLITERATOR2D_IMPL_H_INCLUDED_ #include "tnlIterator2D.h" #include "tnlBitmaskArray.h" #include "tnlBitmask.h" #include "tnlCircle2D.h" #include <fstream> template< unsigned size, int LogX, int LogY > tnlIterator2D< size, LogX, LogY >::tnlIterator2D( unsigned cellsX, unsigned cellsY, float stepX, float stepY, float startX, float startY ) { this->cellsX = cellsX; this->cellsY = cellsY; this->stepX = stepX; this->stepY = stepY; this->startX = startX; this->startY = startY; } template< unsigned size, int LogX, int LogY > void tnlIterator2D< size, LogX, LogY >::computeBitmaskArray( tnlBitmaskArray< size >* bitmaskArray, tnlCircle2D* circle, int posX, int posY ) { // yeah, in matrix, i like to iterate over rows first for( int i = 0; i < this->cellsY; i++ ) for( int j = 0; j < this->cellsX; j++ ) { float x1 = this->startX + j * this->stepX; float x2 = this->startX + ( j + 1 ) * this->stepX; float y1 = this->startY + i * this->stepY; float y2 = this->startY + ( i + 1 ) * this->stepY; bool state = circle->isIntercept( x1, x2, y1, y2 ); int X = posX * cellsX + j; int Y = posY * cellsY + i; tnlBitmask* bitmask = new tnlBitmask( state, X, Y ); bitmaskArray->setIthBitmask( i * this->cellsX + j, bitmask ); } } template< unsigned size, int LogX, int LogY > void tnlIterator2D< size, LogX, LogY >::dumpIntoFile( tnlBitmaskArray< size >* bitmaskArray, fstream& file, int level ) { for( int i = 0; i < this->cellsY; i++ ) for( int j = 0; j < this->cellsX; j++ ) { //float x1 = this->startX + j * this->stepX; //float x2 = this->startX + ( j + 1 ) * this->stepX; //float y1 = this->startY + i * this->stepY; //float y2 = this->startY + ( i + 1 ) * this->stepY; int x = bitmaskArray->getIthBitmask( i * this->cellsX + j )->getX(); int y = bitmaskArray->getIthBitmask( i * this->cellsX + j )->getY(); bool state = bitmaskArray->getIthBitmask( i * this->cellsX + j )->getState(); file << "x = " << x << ", y = " << y << ", state = " << state << ", level = " << level << std::endl; } } #endif // _TNLITERATOR2D_IMPL_H_INCLUDED_ Loading
src/mesh/vdb/make +1 −1 Original line number Diff line number Diff line g++ -O1 -g -Wall -std=c++11 -Werror tnlInternalNode.h tnlInternalNode_impl.h tnlLeafNode.h tnlLeafNode_impl.h tnlNode.h tnlNode_impl.h tnlVDBMath.h tnlRootNode_test.cpp tnlRootNode.h tnlRootNode_impl.h tnlArea2D.h tnlArea2D_impl.h tnlCircle2D.h tnlCircle2D_impl.h tnlIterator2D.h tnlIterator2D_impl.h tnlBitmaskArray.h tnlBitmaskArray_impl.h tnlBitmask.h tnlBitmask_impl.h -o test g++ -O1 -g -Wall -std=c++11 -Werror tnlInternalNode.h tnlInternalNode_impl.h tnlLeafNode.h tnlLeafNode_impl.h tnlNode.h tnlNode_impl.h tnlVDBMath.h tnlRootNode_test.cpp tnlRootNode.h tnlRootNode_impl.h tnlArea2D.h tnlArea2D_impl.h tnlCircle2D.h tnlCircle2D_impl.h tnlBitmaskArray.h tnlBitmaskArray_impl.h tnlBitmask.h tnlBitmask_impl.h -o test
src/mesh/vdb/tnlInternalNode.h +0 −5 Original line number Diff line number Diff line Loading @@ -22,11 +22,6 @@ public: int splitY, int depth ); void print( int splitX, int splitY, int depth, fstream& file ); void write( fstream& f, int level ); Loading
src/mesh/vdb/tnlInternalNode_impl.h +0 −30 Original line number Diff line number Diff line Loading @@ -88,36 +88,6 @@ void tnlInternalNode< LogX, LogY >::write( fstream& file, } } template< int LogX, int LogY > void tnlInternalNode< LogX, LogY >::print( int splitX, int splitY, int depth, fstream& file ) { int depthX = splitX * tnlVDBMath::power( LogX, this->level ); int depthY = splitY * tnlVDBMath::power( LogY, this->level ); float stepX = ( float ) this->area->getLengthX() / depthX; float stepY = ( float ) this->area->getLengthY() / depthY; float startX = this->X * stepX; float endX = ( this->X + 1 ) * stepX; float startY = this->Y * stepY; float endY = ( this->Y + 1 ) * stepY; tnlIterator2D< LogX * LogY, LogX, LogY >* iter = new tnlIterator2D< LogX * LogY, LogX, LogY >( LogX, LogY, ( float ) ( endX - startX ) / LogX, ( float ) ( endY - startY ) / LogY, startX, startY ); iter->dumpIntoFile( this->bitmaskArray, file, this->level ); for( int i = 0; i < LogX * LogY; i++ ) if( this->children[ i ] == NULL ) continue; else this->children[ i ]->print( splitX, splitY, depth, file ); } template< int LogX, int LogY > tnlInternalNode< LogX, LogY >::~tnlInternalNode() Loading
src/mesh/vdb/tnlIterator2D.hdeleted 100644 → 0 +0 −42 Original line number Diff line number Diff line #ifndef _TNLITERATOR2D_H_INCLUDED_ #define _TNLITERATOR2D_H_INCLUDED_ #include "tnlBitmaskArray.h" #include "tnlCircle2D.h" #include <fstream> template< unsigned size, int LogX, int LogY = LogX > class tnlIterator2D { public: tnlIterator2D( unsigned cellsX, unsigned cellsY, float stepX, float stepY, float startX, float startY ); void computeBitmaskArray( tnlBitmaskArray< size >* bitmaskArray, tnlCircle2D* circle, int posX = 0, int posY = 0 ); void dumpIntoFile( tnlBitmaskArray< size >* bitmaskArray, fstream& file, int level = 0 ); ~tnlIterator2D(){}; private: unsigned cellsX; unsigned cellsY; float stepX; float stepY; float startX; float startY; }; #include "tnlIterator2D_impl.h" #endif // _TNLITERATOR2D_H_INCLUDED_
src/mesh/vdb/tnlIterator2D_impl.hdeleted 100644 → 0 +0 −76 Original line number Diff line number Diff line #ifndef _TNLITERATOR2D_IMPL_H_INCLUDED_ #define _TNLITERATOR2D_IMPL_H_INCLUDED_ #include "tnlIterator2D.h" #include "tnlBitmaskArray.h" #include "tnlBitmask.h" #include "tnlCircle2D.h" #include <fstream> template< unsigned size, int LogX, int LogY > tnlIterator2D< size, LogX, LogY >::tnlIterator2D( unsigned cellsX, unsigned cellsY, float stepX, float stepY, float startX, float startY ) { this->cellsX = cellsX; this->cellsY = cellsY; this->stepX = stepX; this->stepY = stepY; this->startX = startX; this->startY = startY; } template< unsigned size, int LogX, int LogY > void tnlIterator2D< size, LogX, LogY >::computeBitmaskArray( tnlBitmaskArray< size >* bitmaskArray, tnlCircle2D* circle, int posX, int posY ) { // yeah, in matrix, i like to iterate over rows first for( int i = 0; i < this->cellsY; i++ ) for( int j = 0; j < this->cellsX; j++ ) { float x1 = this->startX + j * this->stepX; float x2 = this->startX + ( j + 1 ) * this->stepX; float y1 = this->startY + i * this->stepY; float y2 = this->startY + ( i + 1 ) * this->stepY; bool state = circle->isIntercept( x1, x2, y1, y2 ); int X = posX * cellsX + j; int Y = posY * cellsY + i; tnlBitmask* bitmask = new tnlBitmask( state, X, Y ); bitmaskArray->setIthBitmask( i * this->cellsX + j, bitmask ); } } template< unsigned size, int LogX, int LogY > void tnlIterator2D< size, LogX, LogY >::dumpIntoFile( tnlBitmaskArray< size >* bitmaskArray, fstream& file, int level ) { for( int i = 0; i < this->cellsY; i++ ) for( int j = 0; j < this->cellsX; j++ ) { //float x1 = this->startX + j * this->stepX; //float x2 = this->startX + ( j + 1 ) * this->stepX; //float y1 = this->startY + i * this->stepY; //float y2 = this->startY + ( i + 1 ) * this->stepY; int x = bitmaskArray->getIthBitmask( i * this->cellsX + j )->getX(); int y = bitmaskArray->getIthBitmask( i * this->cellsX + j )->getY(); bool state = bitmaskArray->getIthBitmask( i * this->cellsX + j )->getState(); file << "x = " << x << ", y = " << y << ", state = " << state << ", level = " << level << std::endl; } } #endif // _TNLITERATOR2D_IMPL_H_INCLUDED_