本文整理汇总了C++中ofPath::translate方法的典型用法代码示例。如果您正苦于以下问题:C++ ofPath::translate方法的具体用法?C++ ofPath::translate怎么用?C++ ofPath::translate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofPath
的用法示例。
在下文中一共展示了ofPath::translate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createMeshFromPath
//--------------------------------------------------------------
ofMesh ofApp::createMeshFromPath(ofPath path, float thickness){
ofMesh mesh;
// get outline of original path (for sides)
vector <ofPolyline> outline = path.getOutline();
// add front to mesh
mesh.append(path.getTessellation());
// get number of vertices in original path
int numVerts = mesh.getNumVertices();
// define offset based on thickness
ofVec3f offset = ofVec3f(0, 0, -thickness);
// translate path
path.translate(offset);
// add back to mesh
mesh.append(path.getTessellation());
// add sides to mesh (via indices)
for(int j = 0; j < outline.size(); j++){
int outlineSize = outline[j].getVertices().size();
vector <int> outlineIndices;
for(int i = 1; i < outlineSize; i++){
ofVec3f & v = outline[j].getVertices()[i];
int originalIndex = -1;
for(int k = 0; k < numVerts; k++){
if(v.match(mesh.getVertices()[k])){
originalIndex = k;
break;
}
}
outlineIndices.push_back(originalIndex);
}
for(int i = 0; i < outlineIndices.size(); i++){
const int a = outlineIndices[i];
const int b = outlineIndices[(i + 1) % outlineIndices.size()];
const int c = outlineIndices[i] + numVerts;
const int d = outlineIndices[(i + 1) % outlineIndices.size()] + numVerts;
mesh.addTriangle(a, b, c);
mesh.addTriangle(c, b, d);
}
}
return mesh;
}