示例#1
0
void Blob::drawShape() {
    ofNoFill();
    for(int k = 0; k < 10; k ++) {
        ofBeginShape();
    
    
        float ang0 = ofRandom(PI * 2);
        float dist0 = ofRandom(2) * radius / 50;
    
        ofCurveVertex(contour[0] * ccos[0] + x + cos(ang0) * dist0, contour[0] * csin[0] + y + sin(ang0) * dist0);
        ofCurveVertex(contour[0] * ccos[0] + x + cos(ang0) * dist0, contour[0] * csin[0] + y + sin(ang0) * dist0);
        for (int i = 1; i < NUM_CONTOUR; i ++) {
            float ang = ofRandom(PI * 2);
            float dist = ofRandom(2) * radius / 50;
            ofCurveVertex(contour[i] * ccos[i] + x + cos(ang) * dist, contour[i] * csin[i] + y + sin(ang) * dist);
        }
        ofCurveVertex(contour[0] * ccos[0] + x + cos(ang0) * dist0, contour[0] * csin[0] + y + sin(ang0) * dist0);
        ofEndShape();
    }
    
    
    ofBeginShape();
    
    for(int k = 0; k < 450 * radius / 50; k ++) {
        float ang = ofRandom(PI * 2);
        float dist = ofRandom(2) * radius / 50;
        int i = ofRandom(NUM_CONTOUR);
        ofVertex(contour[i] * ccos[i] + x + cos(ang) * dist, contour[i] * csin[i] + y + sin(ang) * dist);
    }
    ofEndShape();
}
//--------------------------------------------------------------
void MovingLine::display(){
	ofBeginShape();
	ofCurveVertex(ptrOfApp->minX, vertices[0].y);
	for(int i = 0; i < vertices.size(); i++){
		ofCurveVertex(vertices[i].x, vertices[i].y);
	}
	ofCurveVertex(ptrOfApp->maxX, vertices.back().y);
	ofEndShape();
}
示例#3
0
//--------------------------------------------------------------
void ofApp::draw() {
	ofPushMatrix();
	ofTranslate(0,height/2);

	ofSetLineWidth(4);
		// ofSetColor(255,255,255,96*averageVol);
		if (tracker.getAccuracy() < 0.5)
			ofSetColor(0,255,0,96*averageVol);
		else if (tracker.getAccuracy() < 1)
			ofSetColor(255,255,0,96*averageVol);
		else if (tracker.getAccuracy() < 3)
			ofSetColor(255,0,0,96*averageVol);
		else
			ofSetColor(255,255,255,96*averageVol);
		ofFill();
		ofBeginShape();
		for (unsigned int i=0; i < curveVertecies.size(); i++)
			ofCurveVertex(i*width/curveVertecies.size(), curveVertecies[i]*96);
		for (unsigned int i=curveVertecies.size()-1; i > 3; i-= 4)
			ofCurveVertex(i*width/curveVertecies.size(), curveVertecies[i]*32);
		ofCurveVertex(0,0);
		ofEndShape(true);

	ofPopMatrix();

	level.draw(metronome);
	tracker.draw(level.getTarget(), averageFreq);

	ofSetColor(255,255,0,(int) 128 * (count[2]/10.) );
	ofNoFill();
	// ofLine(ofGetWidth()/3,0,ofGetWidth()/3,ofGetHeight());
	ofRect(2,2,width-4,height-4);

	// Counter
	ofFill();
	ofSetCircleResolution(32);
	for (int i=0; i < metronome.getUpper(); i++) {
		if (i+1 == count[0]) {
			ofSetColor(255,0,0);
			ofCircle(24 + 16*i,height-24,6);
		} else {
			ofSetColor(255,0,0,128);
			ofCircle(24 + 16*i,height-24,3);
		}
	}

	ofSetColor(128);
	ofDrawBitmapString("volume: " + ofToString(averageVol*100., 3), width-164, height-40);
	ofDrawBitmapString("Frequency: " + notelookup.lookup(averageFreq) + " " + ofToString(averageFreq, 0)  + "Hz", width-256, height-20);
	ofDrawBitmapString("BPM: " + ofToString(metronome.getBPM(), 0), width/2 - 40, 12);
}
示例#4
0
void testApp::drawTmpZone()
{
    if(marks.size()==1)
    {
        fboZones.begin();
        ofClear(0,0);
        ofSetColor(255);
        zones.draw(0,0);
        ofSetColor(255-zoneID);
        ofPoint p0=marks.front();
        ofLine(p0.x,p0.y,p0.x,p0.y);
        fboZones.end();

    }
    if(marks.size()==2)
    {
        fboZones.begin();
        ofClear(0,0);
        ofSetColor(255);
        zones.draw(0,0);
        ofSetColor(255-zoneID);
        ofPoint p0=marks.front();
        ofPoint p1=marks.back();
        ofLine(p0.x,p0.y,p1.x,p1.y);
        fboZones.end();

    }
    if(marks.size()>=3)
    {
        fboZones.begin();
        ofClear(0,0);
        ofSetColor(255);
        zones.draw(0,0);
        ofSetColor(255-zoneID);
        ofPoint p0=marks.front();
        ofBeginShape();
        ofCurveVertex(p0.x,p0.y);
        ofCurveVertex(p0.x,p0.y);
        for(int i=1;i<(marks.size()-1);i++)
        {
            ofPoint p=marks[i];
            ofCurveVertex(p.x,p.y);
        }
        ofPoint p1=marks.back();
        ofCurveVertex(p1.x,p1.y);
        ofCurveVertex(p1.x,p1.y);
        ofEndShape();
        fboZones.end();
    }
}
示例#5
0
//--------------------------------------------------------------
void testApp::draw() {
	
    ofBackground(255);
    
	ofSetHexColor(0xf2ab01);
	anchor.draw();
    
    
	for(int i=0; i<circles.size(); i++) {
		ofFill();
		ofSetColor(100,100);
		circles[i].draw();
    }
    
    
    
    
    ofBeginShape();
    
    ofNoFill();
    ofSetLineWidth(3);
    ofSetColor(0,100);
    ofVertex(anchor.getPosition().x, anchor.getPosition().y);
    ofCurveVertex(anchor.getPosition().x, anchor.getPosition().y);
	for(int i=0; i<circles.size(); i++) {
        if (i == circles.size()-1) {
            ofCurveVertex(circles[i].getPosition().x, circles[i].getPosition().y);
            ofVertex(circles[i].getPosition().x, circles[i].getPosition().y);
        }
        
        else ofCurveVertex(circles[i].getPosition().x, circles[i].getPosition().y);
    }
    
    ofEndShape();
    
    ofSetLineWidth(1);
	ofSetColor(220,100);
	for(int i=0; i<joints.size(); i++) {
		joints[i].draw();
	}
	
	string info = "";
	info += "Press [n] to add a new joint\n";
	info += "click and pull the chain around\n";
	info += "FPS: "+ofToString(ofGetFrameRate(), 1)+"\n";
	ofSetHexColor(0x444342);
	ofDrawBitmapString(info, 30, 30);
}
示例#6
0
// Update Classic With Sketch Lines
void ofxSketch::updateClassic(float xL, float yL, float zL, int redL, int greenL, int blueL, int alphaL) {
    ofFill();
    ofSetColor(redL, greenL, blueL, alphaL);
    ofBeginShape();
    for (int i=0; i<stoixeia; i++) {
        if (i==0) {
            deltaX[i] = (xL - xi[i]);
            deltaY[i] = (yL - yi[i]);
        }
        else {
            deltaX[i] = (xi[i-1]-xi[i]);
            deltaY[i] = (yi[i-1]-yi[i]);
        }
        deltaX[i] *= elastikotita[i];    // create elastikotita effect
        deltaY[i] *= elastikotita[i];
        epitaxinsiX[i] += deltaX[i];
        epitaxinsiY[i] += deltaY[i];
        xi[i] += epitaxinsiX[i];// move it
        yi[i] += epitaxinsiY[i];
        ofCurveVertex(xi[i], yi[i]);
        epitaxinsiX[i] *= aposbesi[i];    // slow down elastikotita
        epitaxinsiY[i] *= aposbesi[i];
    }
    ofEndShape();

}
示例#7
0
void Ribbon::draw()
{
    ofPushStyle();
    ofNoFill();
    ofSetLineWidth(lineWidth);
    ofSetColor(contour->color, ofMap(abs(age - maxAge * 0.5), 0, maxAge * 0.5, maxAlpha, 0));
    ofBeginShape();
    for (int i = 0; i < points.size(); i++)
    {
        if (match)
        {
            idxMatched  = floor(contour->points.size() * lookupMatched[i]);
            points[i].x = ofLerp(points[i].x, contour->points[idxMatched].x +
                                 margin * ofSignedNoise(i * noiseFactor, ageFactor * age, 5), lerpRate);
            points[i].y = ofLerp(points[i].y, contour->points[idxMatched].y +
                                 margin * ofSignedNoise(i * noiseFactor, ageFactor * age, 10), lerpRate);
        }
        else
        {
            points[i].x = ofLerp(points[i].x, contour->points[lookup[i]].x +
                                 margin * ofSignedNoise(i * noiseFactor, ageFactor * age, 5), lerpRate);
            points[i].y = ofLerp(points[i].y, contour->points[lookup[i]].y +
                                 margin * ofSignedNoise(i * noiseFactor, ageFactor * age, 10), lerpRate);
        }
        
        curved ? ofCurveVertex(points[i].x, points[i].y) : ofVertex(points[i].x, points[i].y);
    }
    ofEndShape();
    ofPopStyle();
}
示例#8
0
文件: Blobs02.cpp 项目: MrMdR/julapy
void Blobs02 :: drawBlobs ()
{
	ofBeginShape();
	
	for( int i=0; i<blobs.size(); i++ )
	{
		for( int j=1; j<blobs[ i ].nodes.size() + 3; j++)		// plus 3 to complete the curve.
		{
			int k = j;
			if( k >= blobs[ i ].nodes.size() )
				k -= blobs[ i ].nodes.size() - 1;
			
			ofPoint p;
			p = blobs[ i ].nodes[ k ].getPosition();
			
			if( bDrawCurves )
			{
				ofCurveVertex( p.x, p.y );
			}
			else
			{
				if( j < blobs[ i ].nodes.size() )
				{
					ofVertex( p.x, p.y );
				}
			}
			
		}
	}
	
	ofEndShape( true );
}
示例#9
0
void testApp:: circleFFT(){
    if(fftData.size() > 0){
        ofBeginShape();
        for (int i = 0; i <fftData.size(); i++){
            float val =fftMax - fftData[i] * 128;
        }
        
        float x,y;
        float radius = 100;
        float centX = ofGetWidth()/2;
        float centY = -ofGetHeight()/2;
        
        for(int i =0; i< 360; i++){
            int index = ofMap(i, 0, 360, 0, fftData.size());
            
            float radVariance =ofMap(fftData[index], 0, fftMax, 0, 1);
            float thisRadius = radCurve + radVariance*100;
            float rad = ofDegToRad(i);
            x = centX + (thisRadius * cos(rad));
            y = centY + (thisRadius * sin(rad));
            ofCurveVertex(x, y);
            
            
        }
        
        ofEndShape();
        
    }
    
}
示例#10
0
void testApp::superShape(){
    temp.clear();
    ofBeginShape();
    
    for(float theta = 0; theta <TWO_PI+0.001f; theta+=0.003f)
    {
        float raux  = pow(abs(1.0f/a.value)*abs(cos((m.value*theta/4.0f))),n2.value) + pow(abs(1.0f/b.value)*abs(sin(m.value*theta/4.0f)),n3.value);
        float r = iRadius.value*pow(abs(raux),(-1.0f/n1.value));
        if(bFFT){
            
            int index = ofMap(theta, 0, TWO_PI+0.001f, 0, fftData.size());
            float hue = ofMap(index, 0, fftData.size(), 0, 255);
            float radVariance =ofMap(fftData[index], 0, fftMax, 0, 1);
            r+=  radVariance*100;
        }
        
        float x=ofGetWidth()*.5f+r*cos(theta);
        float y=ofGetHeight()*.5f+r*sin(theta);
        
        temp.push_back(ofVec3f(x,y,0));
        ofCurveVertex(x,y);
    }
    
    ofEndShape();
}
示例#11
0
//--------------------------------------------------------------
void testApp::draw(){

	ofSetColor(0x000000);
	ofNoFill();
	
	ofBeginShape();
	for (int i = 0; i < particles.size(); i++){
		ofCurveVertex(particles[i].pos.x, particles[i].pos.y);
	}
	ofEndShape();
	
	
	ofSetColor(255,0,0);
	ofFill();
	//ofCircle(smoothedMouseX, smoothedMouseY,20);
	
	
	// filled line style
//	glLineWidth(8);
//	
//	ofBeginShape();
//	for (int i = 0; i < particles.size(); i++){
//		ofVertex(particles[i].pos.x, particles[i].pos.y);
//	}
//	ofEndShape();
//	
//	ofFill();
//	
//	for (int i = 0; i < particles.size(); i++){
//		ofCircle(particles[i].pos.x, particles[i].pos.y, 4.0);
//	}
	

}
示例#12
0
void	ofSuperformula::draw(float xf, float yf) {	
	
	ofNoFill();
	ofSetColor(redF, greenF, blueF, alphaF);
	//ofSetPolyMode(OF_POLY_WINDING_ABS_GEQ_TWO);//OF_POLY_WINDING_NONZERO);
	ofBeginShape();
	for(int i=1; i < num; i++) {
		r = epi *	( ( ( powf( labs( cos( (mi*th)/4 ) /alpha ), n2 ) ) + ( powf( labs( sin( mi*th/4) /bita), n3) ) ),(-1/n1));  
		th = th + step;
		x = xf + r*cos(th);
		y = yf + r*sin(th);
		ofCurveVertex(x,y);
		//ofVertex(x,y);		
	}
	//ofEndShape();
	ofEndShape(true);	

	
//	ofBeginShape();
//	for(int i=1; i < 10; i++) {
//		ofCurveVertex(ofRandom(200),ofRandom(200));
//	}
//	ofEndShape();
	if	(th > 10*360)	{
		th = 0;
	}
	//cout << num;
	//ofRect(0, 0, xf, yf);
}
示例#13
0
//--------------------------------------------------------------
void Calligraphy::drawElement(float _xPos, float _yPos, int _h) {

    ofPushStyle();

    ofNoFill();

    ofBeginShape();

    for (int i=0; i<calliSize; i++) {

        ofSetColor( 255 );
        ofSetColor( ofColor::fromHsb( _h, 255, 255) );


        float _fftFactor1 = ofMap(captureFFTSmoothed[i], 0, 1, 0, 25);
        float _x1 = captureFFTIndex[i];

        float _xCircle = cos( captureFFTIndex[i] * 36 / 127.0 ) * _fftFactor1;
        float _yCircle = sin( captureFFTIndex[i] * 36 / 127.0 ) * _fftFactor1;

        ofCurveVertex(_xCircle + _xPos, _yCircle + _yPos);

    }

    ofEndShape();



    ofPopStyle();

}
示例#14
0
void Water::draw() {
    ofEnableBlendMode(OF_BLENDMODE_ADD);
    
    // 水面と水中の描写
    ofSetLineWidth(0);
    ofSetColor(0, 100, 155, 150);
    ofBeginShape();
    ofVertex(waterWidth, border+waterLevel);
    ofVertex(waterWidth, waterHeight+100);
    ofVertex(0, waterHeight+100);
    ofVertex(0, border+waterLevel);
    for (int i=0; i<borderCircles.size(); i++) {
        ofVec2f pos = borderCircles[i].get()->getPosition();
        ofCurveVertex(pos.x, pos.y);
    }
    ofEndShape();
    
    ofSetColor(255, 255);
    // 泡の描写
    for (int i=0; i<bubbles.size(); i++) {
        ofVec2f pos = bubbles[i].get()->getPosition();
        float size = bubbles[i].get()->getRadius();
        img.draw(pos, size*2, size*2);
    }
    
    ofSetColor(255, 150);
    //fbo.draw(0, border + waterLevel);
    
    ofDisableBlendMode();
}
void InputHistory::draw()
{
	ofSetHexColor( 0x808080 );
	ofNoFill();
	if ( history.size() > 0 ) 
	{
		ofBeginShape();
		ofCurveVertex( history[0].pos.x, history[0].pos.y );
		for ( int i=0;i <history.size(); i++ )
		{
			ofCurveVertex(history[i].pos.x, history[i].pos.y );
		}
		ofCurveVertex( history.back().pos.x, history.back().pos.y );
		ofCurveVertex( history.back().pos.x, history.back().pos.y );
		ofEndShape();
	}
}
示例#16
0
void ofApp::drawLine(uint nth) {

    vector<Particle*> nthParticles;

    if (isTabletInPortrait()) {
        if (modules[moduleActive]->getNumberOfParticles() > nth)
            nthParticles.push_back(modules[moduleActive]->getParticle(nth));
    } else {
        for (unsigned int i = 0; i < modules.size(); i++) {
            if (modules[i]->getNumberOfParticles() > nth) {
                nthParticles.push_back(modules[i]->getParticle(nth));
            }
        }
    }

    if (nthParticles.size() == 0)
        return;

    ofPushStyle();

    ofNoFill();
    ofSetLineWidth(POLY_WIDTH);
    ofSetColor(POLY_COLOR);

    ofBeginShape();

    // Need four points at least otherwise the shape doesn't 'close' and therefore doesn't draw

    int middleY = round((ofGetHeight() - CONSOLE_HEIGHT*ofGetHeight())/2.0 + CONSOLE_HEIGHT*ofGetHeight());

    ofCurveVertex(0, middleY);
    ofCurveVertex(0, middleY);

    for (unsigned int i = 0; i < nthParticles.size(); i++) {
        ofCurveVertex(nthParticles[i]->getX(), nthParticles[i]->getY());
    }

    ofCurveVertex(ofGetWidth(), middleY);
    ofCurveVertex(ofGetWidth(), middleY);

    ofEndShape();

    ofPopStyle();
}
void StringPixelFactory::draw(){	
	ofPushStyle();

	bool bActive = panel.getValueB("VIS_COLORED_BACKGROUND");
	bool bInvert = panel.getValueB("VIS_INVERT");
	bool bTrails = panel.getValueB("VIS_TRAILS"); 
	
	if (bActive){
		
		if (bInvert) {	
			ofSetColor(fgColor.x, fgColor.y, fgColor.z, bTrails ? 100 : 255);
		} else {
			ofSetColor(bgColor.x, bgColor.y, bgColor.z, bTrails ? 100 : 255);
		}
		ofRect(0,0,settings.OUTPUT_CROP_W, settings.OUTPUT_CROP_H);
	}
	
	glPushMatrix();
	
	ofSetColor(0xffffff);
	
	if (bInvert) {	
		ofSetColor(bgColor.x, bgColor.y, bgColor.z, bTrails ? 190 : 255);
	} else {
		ofSetColor(fgColor.x, fgColor.y, fgColor.z, bTrails ? 190 : 255);
	}
	
	ofFill();
	ofBeginShape();
	ofVertex(particles[0].pos.x, particles[0].pos.y);
	for (int i = 0; i < particles.size(); i++){
			//particles[i].draw();
		ofCurveVertex(particles[i].pos.x, particles[i].pos.y);
	}
	ofCurveVertex(particles[particles.size()-1].pos.x, particles[particles.size()-1].pos.y);
	ofEndShape(true);
	
	glPopMatrix();
	
	ofPopStyle();	
	
	drawTrails();	
}
//-------------------------------------------------
void timePointRecorder::draw(){
	
	ofSetColor(255);
	ofNoFill();
    ofSetLineWidth(1.5);
	ofBeginShape();
	for (int i = 0; i < pts.size();i++){
		ofCurveVertex(pts[i].x, pts[i].y);
	}
	ofEndShape();	
}
示例#19
0
void drawingLayer::drawLayer()
{
    ofSetColor(lineColor);
    ofNoFill();
    ofEnableSmoothing();
    ofPushMatrix();
    ofTranslate(ofGetWidth()/2, ofGetHeight()/2);
    if (vertexArray.size() > 0){
        
        for (int j = 0; j < SLICES; j++){
            ofPushMatrix();
            ofBeginShape();
            float r = ofDegToRad(360/SLICES);
            ofRotate(360/SLICES*j);
            for (int i = 0; i < vertexArray.size(); i++){
                ofCurveVertex(vertexArray[i]);
            }
            ofEndShape();
            ofPopMatrix();   
        }
        
        ofPushMatrix();
        ofScale(-1,1);
        
        for (int j = 0; j < SLICES; j++){
            ofPushMatrix();
            ofBeginShape();
            float r = ofDegToRad(360/SLICES);
            ofRotate(360/SLICES*j);
            for (int i = 0; i < vertexArray.size(); i++){
                ofCurveVertex(vertexArray[i]);
            }
            ofEndShape();
            ofPopMatrix();
        }
        ofPopMatrix();
    }
    
    ofPopMatrix();
    ofDisableSmoothing();
}
示例#20
0
void testApp:: drawSine(float spacing){
    ofSetBackgroundAuto(true);
    
    ofSetColor(ofRandom(255), ofRandom( 255), ofRandom( 255));

    //ofNoFill(); could do no fill and you would have a different output/less chunky 
    ofBeginShape();
    for(int x=0; x<ofGetWidth(); x+= spacing) {
        ofCurveVertex(x, ofGetHeight()/2 + ofGetHeight() * 0.3f * sin(x*0.01f + ofGetFrameNum() * 100));
    }
    ofEndShape(false);
}
示例#21
0
//--------------------------------------------------------------
void ofApp::draw(){
    
    
    ofBackground(200);
    
     if(recLoop){
         temp.setLoop(true);
     }else{
         temp.setLoop(false);
     }

    
    recFrameRate = float(1/float(frameRate)*1000);
    recFrames = float(frames*recFrameRate);
    
    if(ofGetElapsedTimeMillis() > recTimer + recFrames && recording){
        cout<<"Stop recording\n";
        recording=false;
        audioRecorder.finalize();
        audioRecorder.close();
        temp.loadSound(tempAudio);
        
        
        //recPlay = true;
        temp.play();
        temp.setVolume(1.0f);
    }else if(!recording){
        recTimer = ofGetElapsedTimeMillis();
    }
    
    if(recording){
        ofSetColor(255,0,0);
    }else{
        ofSetColor(255,255,255);
    }
    
    ofPushMatrix();
    ofTranslate(0, ofGetHeight()*.75);
    ofNoFill();
    ofSetLineWidth(2);
    ofBeginShape();
    for(int i = 0; i < bufferSize/2; i++){
        float x = ofMap(i,0,bufferSize/2,0,ofGetWidth());
        //float x = left[i]*audioAmp;
        float y = left[i]*audioAmp;
        
        ofCurveVertex(x, y);
    }
    ofEndShape();
    ofPopMatrix();

    gui.draw();
    }
示例#22
0
//--------------------------------------------------------------
void testApp::draw(){

    //draw the background colour
    ofBackground(bgR, bgG, bgB);

    //colorImg.draw(0,0,1440,960); //draws the colour video on screen twice as big
    //colorImg.draw(0,0); //draws colour video
    //grayDiff.draw(0,0);

    //make blobbly shape
	ofSetColor(sbgR, sbgG, sbgB);
	ofBeginShape();
		for(int i = 0; i < totalNumberOfNodes; i++){
			if(i == 0){
				ofCurveVertex(subStain[0].centerX, subStain[0].centerY); // we need to duplicate 0 for the curve to start at point 0
				ofCurveVertex(subStain[0].centerX, subStain[0].centerY); // we need to duplicate 0 for the curve to start at point 0
			}else if (i == totalNumberOfNodes - 1){
				ofCurveVertex(subStain[i].centerX, subStain[i].centerY);
				ofCurveVertex(subStain[0].centerX, subStain[0].centerY);	// to draw a curve from pt 6 to pt 0
				ofCurveVertex(subStain[0].centerX, subStain[0].centerY);	// we duplicate the first point twice
			}else {
				ofCurveVertex(subStain[i].centerX, subStain[i].centerY);
			}
		}
	ofEndShape();

/*
	// show a faint the non-curve version of the same polygon:
	ofEnableAlphaBlending();
		ofNoFill();
		ofSetColor(0,0,0,40);
		ofBeginShape();
			for(int i = 0; i < totalNumberOfNodes; i++){
				ofVertex(subStain[i].centerX, subStain[i].centerY);
			}
		ofEndShape(true);

		ofSetColor(0,0,0,80);
		for(int i = 0; i < totalNumberOfNodes; i++){
			if (subStain[i].status.isOvertaken == true) ofFill();
			else ofNoFill();
			ofCircle(subStain[i].centerX, subStain[i].centerY, subStain[i].radius);
		}
	ofDisableAlphaBlending();
	//-------------------------------------
*/


    //draw blobs
	ofFill();
	ofSetColor(0x333333);
	for (int i=0; i<contourFinder.nBlobs; i++){
        ofCircle(blobCenter[0][i],blobCenter[1][i],30.00);
	}

    // then draw the contours:
	ofSetColor(0xffffff);

}
示例#23
0
//--------------------------------------------------------------
void ofApp::draw(){
    //------(f)--------------------------------------
    //
    // 		ofCurveVertex
    //
    // 		because it uses catmul rom splines, we need to repeat the first and last
    // 		items so the curve actually goes through those points
    //
    
    ofSetColor(170, 255, 199, 220);
    ofBeginShape();
    
    for (int i = 0; i < nCurveVertices; i++){
        
        
        // sorry about all the if/states here, but to do catmull rom curves
        // we need to duplicate the start and end points so the curve acutally
        // goes through them.
        
        // for i == 0, we just call the vertex twice
        // for i == nCurveVertices-1 (last point) we call vertex 0 twice
        // otherwise just normal ofCurveVertex call
        
        if (i == 0){
            ofCurveVertex(curveVertices[i].x, curveVertices[0].y, curveVertices[0].z); // we need to duplicate 0 for the curve to start at point 0
            ofCurveVertex(curveVertices[2].x, curveVertices[i].y, curveVertices[6].z); // we need to duplicate 0 for the curve to start at point 0
        } else if (i == nCurveVertices-1){
            ofCurveVertex(curveVertices[i].x, curveVertices[i].y, curveVertices[i].z);
            ofCurveVertex(curveVertices[3].x, curveVertices[5].y, curveVertices[i].z);	// to draw a curve from pt 6 to pt 0
            ofCurveVertex(curveVertices[i].x, curveVertices[i].y, curveVertices[i].z);	// we duplicate the first point twice
        } else {
            ofCurveVertex(curveVertices[i].x, curveVertices[i].y, curveVertices[i].z);
        }
    }
    
    ofEndShape();
    
    
    // show a faint the non-curve version of the same polygon:
    ofEnableAlphaBlending();
    //    ofNoFill();
    ofSetColor(0,0,200,40);
    ofBeginShape();
    for (int i = 0; i < nCurveVertices; i++){
        ofVertex(curveVertices[i].x, curveVertices[i].y, curveVertices[i].z);
    }
    ofEndShape(true);
    
    
    ofSetColor(100,0,0,80);
    for (int i = 0; i < nCurveVertices; i++){
        if (curveVertices[i].bOver == true) ofFill();
        //        else ofNoFill();
//        ofCircle(curveVertices[i].x, curveVertices[i].y,4);
    }
    ofDisableAlphaBlending();
    
}
示例#24
0
文件: shLine.cpp 项目: imclab/dtool
void shLine::draw( )
{


    if( linePoints.size( ) > 0 )
    {
        ofNoFill( );
        ofBeginShape( );
        for( int i = 0; i < linePoints.size( ); i++ )
        {
            ofCurveVertex(linePoints[ i ].getPositionInX( ), linePoints[ i ].getPositionInY( ) );
        }
        ofEndShape( false );
    }
}
//--------------------------------------------------------------
void testApp::draw(){
	ofSetColor(127, 127, 127, 200);
	ofNoFill();
	ofEnableSmoothing();
	ofBeginShape();
	for (int i = 0; i < particles.size(); i++){
		ofCurveVertex(particles[i].pos.x, particles[i].pos.y);
	}
	ofEndShape();
	ofDisableSmoothing();
	
	ofSetColor(255, 255, 255);
	ofFill();
	for (int i = 0; i < particles.size(); i++){
		pimg.draw(particles[i].pos.x - 16, particles[i].pos.y - 16);
	}
}
示例#26
0
//--------------------------------------------------------------
void testApp::draw(){
	
	ofDrawBitmapString(status, 10, 30);
	
	if (line.size() == 0)
		return;
	
	ofEnableSmoothing();
	
	ofNoFill();
	ofSetLineWidth(3);
	ofBeginShape();
	
	for (int i=0; i<line.size(); i++)
		ofCurveVertex(line[i].x, line[i].y);
	
	ofEndShape(false);
	
	ofCircle(line.back().x, line.back().y, 10);
	
}
示例#27
0
 void draw(){
     //update
     for(int i=0; i<splash.getVertices().size(); i++){
         nowPosition[i] += (splash.getVertices()[i]-nowPosition[i])/late;
     }
     
     //draw
     ofPushMatrix();
     
     ofTranslate(position);
     ofRotateZ(rotate+100);
     ofScale(scale.x, scale.y);
     ofBeginShape();
     for(int i=0; i<splash.getVertices().size(); i++){
         //            ofCurveVertex(splash.getVertices()[i]);
         ofCurveVertex(nowPosition[i]);
     }
     ofEndShape();
     
     ofPopMatrix();
 };
示例#28
0
文件: testApp.cpp 项目: MrMdR/julapy
void testApp :: drawContourCurveLines ( vector<Blob>& blobs, bool useBlobColor )
{
	for( int i=0; i<blobs.size(); i++ )
	{
		if( useBlobColor )
		{
			ofColor& c = blobs[ i ].color;
			ofSetColor( c.r, c.g, c.b );
		}
		
		int t = blobs[ i ].pts.size();
		
		ofBeginShape();
		for( int j=0; j<t+3; j++ )		// extra points to close each polygon
		{
			int k = j % t;
			
			ofCurveVertex( blobs[ i ].pts[ k ].x, blobs[ i ].pts[ k ].y );
		}
		ofEndShape();
	}
}
示例#29
0
//----------------------------------------------------------						
void ofxVectorGraphics::curveVertex(float x, float y){
	if(bDraw){
		ofCurveVertex(x, y);
	}
	if(bRecord){
	
		//if some points have already been created
		//this could crash the app 
		//so we close the current path to be safe
		if(bShouldClose){
			if(bFill) creeps.endPath(CreEPS::FILL);
			else creeps.endPath(CreEPS::STROKE);
		}
	
		whichShapeMode = 1;
	
		double* point = new double[2];
		point[0] = x;
		point[1] = y;
		curvePts.push_back(point);
	}
}
示例#30
0
//--------------------------------------------------------------
void rope::draw(){
	
    
	ofSetHexColor(0xffffff);
	ofNoFill();
    ofSetLineWidth(3);
    
    ofBeginShape();
    ofVertex(particles[0].pos.x, particles[0].pos.y);
	for (int i = 0; i < particles.size(); i++){
		ofCurveVertex(particles[i].pos.x, particles[i].pos.y);
//        particles[i].draw();
	}
    ofVertex(particles[particles.size()-1].pos.x, particles[particles.size()-1].pos.y);
    ofEndShape();
    ofFill();
    ofSetLineWidth(1);
	
//	for (int i = 0; i < springs.size(); i++){
//		springs[i].draw();
//	}
    
}