本文整理汇总了C++中ofPolyline::hasChanged方法的典型用法代码示例。如果您正苦于以下问题:C++ ofPolyline::hasChanged方法的具体用法?C++ ofPolyline::hasChanged怎么用?C++ ofPolyline::hasChanged使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofPolyline
的用法示例。
在下文中一共展示了ofPolyline::hasChanged方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
}