Example #1
0
Table tablePrune( Table table, int window, int pos, int *numbits )
{
	int curbits;
	int maxcode;
	int code;
	int swp;
	Table newTable;
	int i;
	newTable = tableMake(table->maxbits);
	curbits = STARTING_BITS;
	maxcode = 1 << curbits;
	for (i = 0; i < table->size; i++)
	{
		if (table->entries[i] && 
			(pos - table->entries[i]->accessed < window || i <= NUM_SPECIALS + UCHAR_MAX))
		{
			code = i;
			while (code >= 0 && table->entries[code])
			{
				tableInsert(table->entries[code], newTable);
				if (maxcode <= getSize(newTable))
				{
					curbits++;
					maxcode *= 2;
				}

				swp = table->entries[code]->prefix;
				table->entries[code] = 0;
				code = swp;
			}
		}
	}
	*numbits = curbits;
	freeTable(table);
	// printf("Table Size: %d\n", newTable->size);
	// tableDump(newTable);
	return newTable;
}
Example #2
0
//--------------------------------------------------------------
void ofApp::lineFigureDrawing() {
    // Line
    ofPushMatrix();
    ofRotateX(180);
    ofTranslate(-ofGetWidth()/2, -ofGetHeight()/2);
    
	ofPushStyle();
    ofScale(1, 1, 1);
    ofSetColor(200, 200);
    
    // 	tweencirc.setParameters(3,easingcirc,ofxTween::easeOut,0,ofGetWidth()-100,duration,delay);
    
    ofPushMatrix();
    ofTranslate(0, 0);

    ofPushStyle();
    ofSetColor(ofColor::fromHsb(0, 0, 255, 120));
    bellLinedance->first_x1 = (((sequence.bellPointPos[0]-sequence.bellPointPos[1])/bellTempoChange)/10 + sequence.bellPointPos[1]) * xRatio;
    bellLinedance->second_x1 = belltweenelastic1.update() * xRatio;
    bellLinedance->third_x1 = belltweenelastic2.update() * xRatio;
    bellLinedance->fourth_x1 = belltweenelastic3.update() * xRatio;
    bellLinedance->fifth_x1 = belltweenelastic4.update() * xRatio;
    bellLinedance->sixth_x1 = belltweenelastic5.update() * xRatio;
    //    bellLinedance->second_x1 = (((sequence.bellPointPos[1]-sequence.bellPointPos[2])/bellTempoChange)/8 * bellFrameTempo + sequence.bellPointPos[2]) * xRatio;
    //    bellLinedance->third_x1 = (((sequence.bellPointPos[2]-sequence.bellPointPos[3])/bellTempoChange)/6 * bellFrameTempo + sequence.bellPointPos[3]) * xRatio;
    //    bellLinedance->fourth_x1 = (((sequence.bellPointPos[3]-sequence.bellPointPos[4])/bellTempoChange)/4 * bellFrameTempo + sequence.bellPointPos[4]) * xRatio;
    //    bellLinedance->fifth_x1 = (((sequence.bellPointPos[4]-sequence.bellPointPos[5])/bellTempoChange)/2 * bellFrameTempo + sequence.bellPointPos[5]) * xRatio;
    //    bellLinedance->sixth_x1 = (((sequence.bellPointPos[5]-sequence.bellPointPos[6])/bellTempoChange) * bellFrameTempo + sequence.bellPointPos[6]) * xRatio;
    //    bellLinedance->xPosition = 0;
    bellLinedance->xPosition = 0;
    bellLinedance->zPosition = 0;
    bellLinedance->drawFigure();
    ofPopStyle();


    ofPushStyle();
    ofSetColor(ofColor::fromHsb(0, 0, 255, 120));
    synthLinedance->first_x1 = (((sequence.synthPointPos[0]-sequence.synthPointPos[1])/synthTempoChange)/10 + sequence.synthPointPos[1]) * xRatio;
    synthLinedance->second_x1 = synthtweenelastic1.update() * xRatio;
    synthLinedance->third_x1 = synthtweenelastic2.update() * xRatio;
    synthLinedance->fourth_x1 = synthtweenelastic3.update() * xRatio;
    synthLinedance->fifth_x1 = synthtweenelastic4.update() * xRatio;
    synthLinedance->sixth_x1 = synthtweenelastic5.update() * xRatio;
    //    synthLinedance->second_x1 = (((sequence.synthPointPos[1]-sequence.synthPointPos[2])/synthTempoChange)/8 * synthFrameTempo + sequence.synthPointPos[2]) * xRatio;
    //    synthLinedance->third_x1 = (((sequence.synthPointPos[2]-sequence.synthPointPos[3])/synthTempoChange)/6 * synthFrameTempo + sequence.synthPointPos[3]) * xRatio;
    //    synthLinedance->fourth_x1 = (((sequence.synthPointPos[3]-sequence.synthPointPos[4])/synthTempoChange)/4 * synthFrameTempo + sequence.synthPointPos[4]) * xRatio;
    //    synthLinedance->fifth_x1 = (((sequence.synthPointPos[4]-sequence.synthPointPos[5])/synthTempoChange)/2 * synthFrameTempo + sequence.synthPointPos[5]) * xRatio;
    //    synthLinedance->sixth_x1 = (((sequence.synthPointPos[5]-sequence.synthPointPos[6])/synthTempoChange) * synthFrameTempo + sequence.synthPointPos[6]) * xRatio;
    //    synthLinedance->xPosition = 250;
    synthLinedance->xPosition = 200;
    synthLinedance->zPosition = 0;
    synthLinedance->drawFigure();
    ofPopStyle();

    
    ofPushStyle();
    ofSetColor(ofColor::fromHsb(0, 0, 255, 120));
    bassLinedance->first_x1 = (((sequence.bassPointPos[0]-sequence.bassPointPos[1])/bassTempoChange)/10 + sequence.bassPointPos[1]) * xRatio;
    bassLinedance->second_x1 = basstweenelastic1.update() * xRatio;
    bassLinedance->third_x1 = basstweenelastic2.update() * xRatio;
    bassLinedance->fourth_x1 = basstweenelastic3.update() * xRatio;
    bassLinedance->fifth_x1 = basstweenelastic4.update() * xRatio;
    bassLinedance->sixth_x1 = basstweenelastic5.update() * xRatio;
    //    bassLinedance->second_x1 = (((sequence.bassPointPos[1]-sequence.bassPointPos[2])/bassTempoChange)/8 * bassFrameTempo + sequence.bassPointPos[2]) * xRatio;
    //    bassLinedance->third_x1 = (((sequence.bassPointPos[2]-sequence.bassPointPos[3])/bassTempoChange)/6 * bassFrameTempo + sequence.bassPointPos[3]) * xRatio;
    //    bassLinedance->fourth_x1 = (((sequence.bassPointPos[3]-sequence.bassPointPos[4])/bassTempoChange)/4 * bassFrameTempo + sequence.bassPointPos[4]) * xRatio;
    //    bassLinedance->fifth_x1 = (((sequence.bassPointPos[4]-sequence.bassPointPos[5])/bassTempoChange)/2 * bassFrameTempo + sequence.bassPointPos[5]) * xRatio;
    //    bassLinedance->sixth_x1 = (((sequence.bassPointPos[5]-sequence.bassPointPos[6])/bassTempoChange) * bassFrameTempo + sequence.bassPointPos[6]) * xRatio;
    //    bassLinedance->xPosition = 500;
    bassLinedance->xPosition = 400;
    bassLinedance->zPosition = 0;
    bassLinedance->drawFigure();
    ofPopStyle();

    
    
    ofPushStyle();
    ofSetColor(ofColor::fromHsb(0, 0, 255, 120));
    padLinedance->first_x1 = (((sequence.padPointPos[0]-sequence.padPointPos[1])/padTempoChange)/10 + sequence.padPointPos[1]) * xRatio;
    padLinedance->second_x1 = padtweenelastic1.update() * xRatio;
    padLinedance->third_x1 = padtweenelastic2.update() * xRatio;
    padLinedance->fourth_x1 = padtweenelastic3.update() * xRatio;
    padLinedance->fifth_x1 = padtweenelastic4.update() * xRatio;
    padLinedance->sixth_x1 = padtweenelastic5.update() * xRatio;
    //    padLinedance->second_x1 = (((sequence.padPointPos[1]-sequence.padPointPos[2])/padTempoChange)/8 * padFrameTempo + sequence.padPointPos[2]) * xRatio;
    //    padLinedance->third_x1 = (((sequence.padPointPos[2]-sequence.padPointPos[3])/padTempoChange)/6 * padFrameTempo + sequence.padPointPos[3]) * xRatio;
    //    padLinedance->fourth_x1 = (((sequence.padPointPos[3]-sequence.padPointPos[4])/padTempoChange)/4 * padFrameTempo + sequence.padPointPos[4]) * xRatio;
    //    padLinedance->fifth_x1 = (((sequence.padPointPos[4]-sequence.padPointPos[5])/padTempoChange)/2 * padFrameTempo + sequence.padPointPos[5]) * xRatio;
    //    padLinedance->sixth_x1 = (((sequence.padPointPos[5]-sequence.padPointPos[6])/padTempoChange) * padFrameTempo + sequence.padPointPos[6]) * xRatio;
    //    padLinedance->xPosition = 750;
    padLinedance->xPosition = 600;
    padLinedance->zPosition = 0;
    padLinedance->drawFigure();
    ofPopStyle();

    
    tableMake();
    
    if(tableViewOnOff) {
        tableMake();
    } else {
        
    }
    
    ofPopMatrix();
}