Beispiel #1
0
void getCellsFromContainer(voro::container &_con, vector<ofVboMesh>& cells, float _maxRadius, bool bWireframe){
    cells.clear();
	
    voro::c_loop_all vl( _con );
    int i = 0;
	if( vl.start() ){
        
        do {
            voro::voronoicell c;
            if( !_con.compute_cell(c, vl) ) {
                return;
            } else {
                if(getCellRadius(c)<_maxRadius){
                    double *pp = _con.p[vl.ijk] + _con.ps * vl.q;
                    ofVboMesh cellMesh;
                    getCellMesh(c, cellMesh, bWireframe);
                    cells.push_back( cellMesh );
                }
                i++;
            }
        } while( vl.inc() );
    }
}
vector<float> getCellsRadius(voro::container &_con){
    vector<float> radius;
    
    voro::c_loop_all vl( _con );
    int i = 0;
	if( vl.start() ){
        
        do {
            voro::voronoicell c;
            if( !_con.compute_cell(c, vl) ) {
                return radius;
            } else {
                double *pp = _con.p[vl.ijk] + _con.ps * vl.q;
                float rad = getCellRadius(c);
                radius.push_back( rad );
                i++;
            }
            
        } while( vl.inc() );
    }
    
    return radius;
}
Beispiel #3
0
void getCellsFromContainer(voro::container &_con, float _wallsThikness, vector<ofVboMesh>& cells, bool bWireframe){
    
	cells.clear();
	
    voro::c_loop_all vl( _con );
    int i = 0;
	if( vl.start() ){
        
        do {
            voro::voronoicell c;
            if( !_con.compute_cell(c, vl) ) {
                return;
            } else {
                double *pp = _con.p[vl.ijk] + _con.ps * vl.q;
				ofVboMesh cellMesh;
                getCellMesh(c, ofPoint(pp[0],pp[1],pp[2])*(float)(1.0+_wallsThikness), cellMesh, bWireframe);
                cells.push_back( cellMesh );
                i++;
            }
            
        } while( vl.inc() );
    }
}
Beispiel #4
0
vector<ofVboMesh>  getCellsFromContainer(voro::container &_con, float _wallsThikness, float _maxRadius, bool bWireframe){
    vector<ofVboMesh> cells;
    
    voro::c_loop_all vl( _con );
    int i = 0;
	if( vl.start() ){
        do {
            voro::voronoicell c;
            if( !_con.compute_cell(c, vl) ) {
                return cells;
            } else {
                if(getCellRadius(c)<_maxRadius){
                    double *pp = _con.p[vl.ijk] + _con.ps * vl.q;
                    ofVboMesh cellMesh = getCellMesh(c, ofPoint(pp[0],pp[1],pp[2])*(float)(1.0+_wallsThikness), bWireframe);
                    cells.push_back( cellMesh );
                }
                i++;
            }
            
        } while( vl.inc() );
    }
    
    return cells;
}
void VoroNode::getCellsFromContainerParallel(voro::container &_con, float _wallsThikness, vector<ofVboMesh>& cells, bool bWireframe){
    
    cells.clear();
    
    voro::c_loop_all vl( _con );
    if( vl.start() ){
        
        do {
            //                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
            voro::voronoicell c;
            if( !_con.compute_cell(c, vl) ) {
                return;
            } else {
                double *pp = _con.p[vl.ijk] + _con.ps * vl.q;
                ofVboMesh cellMesh;
                getCellMesh(c, ofPoint(pp[0],pp[1],pp[2])*(float)(1.0+_wallsThikness), cellMesh, bWireframe);
                cells.push_back( cellMesh );
            }
            
            //                });
            
        } while( vl.inc() );
    }
}