当前位置: 首页>>代码示例>>C++>>正文


C++ ofPolyline::getVertices方法代码示例

本文整理汇总了C++中ofPolyline::getVertices方法的典型用法代码示例。如果您正苦于以下问题:C++ ofPolyline::getVertices方法的具体用法?C++ ofPolyline::getVertices怎么用?C++ ofPolyline::getVertices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ofPolyline的用法示例。


在下文中一共展示了ofPolyline::getVertices方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: draw

//-----------------------------------------------------------------------------------
void ofxCairoTexture::draw(ofPolyline & poly){
	cairo_new_path(cr);
	for(int i=0;i<(int)poly.size();i++){
		cairo_line_to(cr,poly.getVertices()[i].x,poly.getVertices()[i].y);
	}
	if(poly.isClosed())
		cairo_close_path(cr);
	cairo_stroke( cr );
}
开发者ID:Kaftan777ski,项目名称:mapinect,代码行数:10,代码来源:ofxCairoTexture.cpp

示例2: draw

void ofCairoRenderer::draw(const ofPolyline & poly) const{
	cairo_new_path(cr);
	for(int i=0;i<(int)poly.size();i++){
		cairo_line_to(cr,poly.getVertices()[i].x,poly.getVertices()[i].y);
	}
	if(poly.isClosed())
		cairo_close_path(cr);
	cairo_stroke( cr );
}
开发者ID:MartinHN,项目名称:openFrameworks,代码行数:9,代码来源:ofCairoRenderer.cpp

示例3: draw

void ofCairoRenderer::draw(ofPolyline & poly){
	ofPushStyle();
	cairo_new_path(cr);
	for(int i=0;i<(int)poly.size();i++){
		cairo_line_to(cr,poly.getVertices()[i].x,poly.getVertices()[i].y);
	}
	if(poly.isClosed())
		cairo_close_path(cr);
	ofPopStyle();
}
开发者ID:alfredoBorboa,项目名称:openFrameworks,代码行数:10,代码来源:ofCairoRenderer.cpp

示例4: interpolatePolyLine

void testApp::interpolatePolyLine(ofPolyline& a, ofPolyline& b, ofPolyline& out, float delta){
    if(a.getVertices().size() != b.getVertices().size()){
        ofLogError("Polylines did not match in size");
        return;
    }
    
    out.clear();
    
    for(int i = 0; i < a.getVertices().size(); i++){
        out.addVertex( a.getVertices()[i].getInterpolated(b.getVertices()[i], delta) );
    }
}
开发者ID:obviousjim,项目名称:CloudsInterludes,代码行数:12,代码来源:testApp.cpp

示例5: draw

void ropeMesh::draw(ofPolyline stroke){

    if (stroke.hasChanged()) {
        
        mesh.clear();
        
        mesh.setMode(OF_PRIMITIVE_TRIANGLE_STRIP);
        
        vector < ofPoint > pts = stroke.getVertices();
        
        for (int i = 0; i < pts.size(); i++){
            
            int i_m_1 = MAX(i-1,0);
            int i_p_1 = MIN(i+1, pts.size()-1);
            
            ofPoint pta = pts[i_m_1];
            ofPoint ptb = pts[i];
            ofPoint ptc = pts[i_p_1];
            
            ofPoint diff = ptc - pta;
            
            float angle = atan2(diff.y, diff.x);
            
            angle += PI/2;
            
            float width = 3; //diff.length();
            
            ofPoint offsetA;
            offsetA.x = ptb.x + width * cos(angle);
            offsetA.y = ptb.y + width * sin(angle);
            
            ofPoint offsetB;
            offsetB.x = ptb.x - width * cos(angle);
            offsetB.y = ptb.y - width * sin(angle);
            
            ofSetColor(123,94,65);
          
            ofLine(offsetA, offsetB);
            
            mesh.addVertex(offsetA);
            mesh.addVertex(offsetB);
        }
    
        ofSetColor(197,155,108);
        ofFill();
        mesh.draw();
        ofSetRectMode(OF_RECTMODE_CENTER);
        if (stroke.size()>0) {
             top[num].draw(stroke.getVertices()[stroke.size()-1], width, height);
        }
    }
    
}
开发者ID:bestpaul1985,项目名称:Thesis2013,代码行数:53,代码来源:ropeMesh.cpp

示例6:

bool operator==(const ofPolyline& lhs, const ofPolyline& rhs)
{
    vector<ofPoint> vertices1 = lhs.getVertices();
    vector<ofPoint> vertices2 = rhs.getVertices();
    if(vertices1.size() != vertices2.size()) return false;
    else {
        for(int i = 0; i < vertices1.size(); i++) {
            if(vertices1[i] != vertices2[i]) return false;
        }
    }
    return true;
}
开发者ID:mattvisco,项目名称:SFPC_2016,代码行数:12,代码来源:ofApp.cpp

示例7: draw

//----------------------------------------------------------
void ofGLRenderer::draw(ofPolyline & poly){
	if(!poly.getVertices().empty()) {
		// use smoothness, if requested:
		if (bSmoothHinted) startSmoothing();

		glEnableClientState(GL_VERTEX_ARRAY);
		glVertexPointer(3, GL_FLOAT, sizeof(ofVec3f), &poly.getVertices()[0].x);
		glDrawArrays(poly.isClosed()?GL_LINE_LOOP:GL_LINE_STRIP, 0, poly.size());

		// use smoothness, if requested:
		if (bSmoothHinted) endSmoothing();
	}
}
开发者ID:3snail,项目名称:openFrameworks,代码行数:14,代码来源:ofGLRenderer.cpp

示例8: makeStroke

void Plant::makeStroke(int i,
                       float min,
                       float max,
                       ofPolyline &centerLine,
                       ofPolyline *line1,
                       ofPolyline *line2
                       ){
    ofVec2f v = centerLine.getTangentAtIndex(i);
    float length = ofMap(i, 0, centerLine.size()-1, max, min) ;
    float angle = 90;
    float hackValue = 0.8;
    if(i==0 || i == centerLine.size()-1){
        ofVec2f p = centerLine.getVertices()[i] + v.rotate(angle)*length*hackValue;
        ofVec2f v2 = centerLine.getTangentAtIndex(i);
        ofVec2f p2 = centerLine.getVertices()[i] + v2.rotate(-angle)*length*hackValue;
        line1->lineTo(p);
        line2->lineTo(p2);
    }
    if(i>0 && i < centerLine.size()-1){
        makeCorner(line1, centerLine, i, angle, length);
        makeCorner(line2, centerLine, i, -angle, length);
    }
    if(i == centerLine.size()-1){
        ofVec2f v = centerLine.getTangentAtIndex(i);
        float length = ofMap(i, 0, centerLine.size()-1, min, min) ;
        ofVec2f _p2 = centerLine.getVertices()[i] + v.rotate(90)*length*hackValue;
        ofVec2f _p1 = centerLine.getVertices()[i] + v.rotate(180)*length*hackValue;
        ofVec2f _p3 = _p1 + (_p2 - _p1)/2;
        ofVec2f _delta = _p2 - _p1;
        ofVec2f pCenter = _p3 - _delta.getPerpendicular()*min;
        ofVec2f pLeft = pCenter - _delta/2;
        ofVec2f pRight = pCenter + _delta/2;
        
        line2->bezierTo(_p1, pLeft, pCenter);
        line1->bezierTo(_p2, pRight, pCenter);
        
        //                ofSetColor(ofColor::yellow);
        //                ofDrawCircle(p1, 5);
        //                ofSetColor(ofColor::red);
        //                ofDrawCircle(p2, 5);
        //                ofSetColor(ofColor::blueViolet);
        //                ofDrawCircle(p3, 5);
        //                ofSetColor(ofColor::darkMagenta);
        //                ofDrawCircle(pCenter, 5);
        //                ofSetColor(ofColor::lightPink);
        //                ofDrawCircle(pLeft, 5);
        //                ofSetColor(ofColor::lightSkyBlue);
        //                ofDrawCircle(pRight, 5);
    }

}
开发者ID:ofZach,项目名称:funkyForms,代码行数:51,代码来源:Plant.cpp

示例9: setFromPolyline

//--------------------------------------------------------------
void ofxFatLine::setFromPolyline(ofPolyline & poly){
//	ofxFatLine();
	setGlobalColor(ofGetStyle().color);
	setGlobalWidth(ofGetStyle().lineWidth);
	if (!poly.getVertices().empty()){
		addVertices(poly.getVertices());
	for (int i = 0; i <getVertices().size(); i++) {
		addColor(globalColor);
		addWeight(globalWidth);
	}
	update();
	//*/
	}		
}
开发者ID:adozenlines,项目名称:ofxFatLines,代码行数:15,代码来源:ofxFatLine.cpp

示例10: addLaserPolyline

void LaserManager::addLaserPolyline(const ofPolyline& line, ColourSystem* coloursystem, float intens){
	
	if((line.getVertices().size()==0)||(line.getPerimeter()<0.1)) return;
	
	shapes.push_back(new LaserPolyline(line, coloursystem, intens));
	
	
}
开发者ID:sebleedelisle,项目名称:PixelPyros,代码行数:8,代码来源:LaserManager.cpp

示例11: setup

void Path3D::set(ofPolyline &polyline){
    
    setup(); // incase path hasn't been set up yet
    
    ptIndex = 0;
    reverse = true;
    direction = 1;
    
    // ignore the first and last points for the centroid
    for (int i=1; i<polyline.getVertices().size()-1; i++){
        centroid += polyline.getVertices()[i];
    }
    centroid /= polyline.getVertices().size()-2;
    
    path = polyline;
    buildPerpFrames(path);
}
开发者ID:CreativeInquiry,项目名称:ofxRobotArm,代码行数:17,代码来源:Path3D.cpp

示例12: draw

//--------------------------------------------------------------
void testApp::draw(){

    
    ofBackgroundGradient(ofColor(10,10,10), ofColor(0,0,0) );
    
    /*particleA.draw();
    particleB.draw();
    particleC.draw();
    */
    if (temp.getVertices().size() > 500){
        temp.getVertices().erase(temp.getVertices().begin());
    }
    
    ofEnableAlphaBlending();
    //temp.draw();
    
    glBegin(GL_LINE_STRIP);
    for (int i = 0; i < temp.getVertices().size(); i++){
        float pct = ofMap(i, 0, temp.getVertices().size()-1, 0,1);
        ofSetColor(255,255,255,255*pct);
        glVertex2f(temp.getVertices()[i].x, temp.getVertices()[i].y);
    }
    glEnd();
    ofEndShape();
    
}
开发者ID:decebel,项目名称:drawing-examples,代码行数:27,代码来源:testApp.cpp

示例13: ofPolyline_to_Polygon

//--------------------------------------------------------------
ClipperLib::Polygon ofxClipper::ofPolyline_to_Polygon(ofPolyline& polyline) {
	vector<ofPoint> verts = polyline.getVertices();
    vector<ofPoint>::iterator iter;
    ClipperLib::Polygon polygon;
    for(iter = verts.begin(); iter != verts.end(); iter++) {
        ClipperLib::IntPoint ip((*iter).x * clipperGlobalScale, 
                                (*iter).y * clipperGlobalScale);
        polygon.push_back(ip);
    }
    return polygon;
}
开发者ID:neumic,项目名称:ofxClipper,代码行数:12,代码来源:ofxClipper.cpp

示例14:

int XBScene1::findIntersectionHorizontal(ofPolyline &line, int posX)
{
    //loop through polyline points, left to right, when posX changes from  higher to lower from the x component of the polyline point
    vector<ofPoint> vertices = line.getVertices();
    for (int i = 0; i < vertices.size(); i++) {
        if (posX > vertices[i].x)
            continue;
        else
            return i;
    }
}
开发者ID:kosowski,项目名称:MovimentsGranados,代码行数:11,代码来源:XBScene1.cpp

示例15: getCentroid2D

ofPoint getCentroid2D(ofPolyline  temp){
	
	vector < ofPoint > pts = temp.getVertices();
	ofPoint midPt;
	midPt.set(0,0,0);
	for (int i = 0; i <pts.size(); i++){
		midPt+= pts[i];
	}
	midPt /= MAX(1, pts.size());
	return midPt;
	
}
开发者ID:imclab,项目名称:facepp,代码行数:12,代码来源:testApp.cpp


注:本文中的ofPolyline::getVertices方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。