本文整理汇总了C++中ofPath::getOutline方法的典型用法代码示例。如果您正苦于以下问题:C++ ofPath::getOutline方法的具体用法?C++ ofPath::getOutline怎么用?C++ ofPath::getOutline使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofPath
的用法示例。
在下文中一共展示了ofPath::getOutline方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ofxGetBoundingBox
ofRectangle ofxGetBoundingBox(ofPath &path) {
ofRectangle rect;
for (int i=0; i<path.getOutline().size(); i++) {
ofRectangle b = path.getOutline().at(i).getBoundingBox();
if (i==0) rect = b;
else rect.growToInclude(b);
}
return rect;
}
示例2: draw
//----------------------------------------------------------
void ofGLRenderer::draw(ofPath & shape){
ofColor prevColor;
if(shape.getUseShapeColor()){
prevColor = ofGetStyle().color;
}
if(shape.isFilled()){
ofMesh & mesh = shape.getTessellation();
if(shape.getUseShapeColor()){
setColor( shape.getFillColor() * ofGetStyle().color,shape.getFillColor().a/255. * ofGetStyle().color.a);
}
draw(mesh);
}
if(shape.hasOutline()){
float lineWidth = ofGetStyle().lineWidth;
if(shape.getUseShapeColor()){
setColor( shape.getStrokeColor() * ofGetStyle().color, shape.getStrokeColor().a/255. * ofGetStyle().color.a);
}
setLineWidth( shape.getStrokeWidth() );
vector<ofPolyline> & outlines = shape.getOutline();
for(int i=0; i<(int)outlines.size(); i++)
draw(outlines[i]);
setLineWidth(lineWidth);
}
if(shape.getUseShapeColor()){
setColor(prevColor);
}
}
示例3: draw
//----------------------------------------------------------
void ofGLRenderer::draw(const ofPath & shape) const{
ofColor prevColor;
if(shape.getUseShapeColor()){
prevColor = ofGetStyle().color;
}
ofGLRenderer * mut_this = const_cast<ofGLRenderer*>(this);
if(shape.isFilled()){
const ofMesh & mesh = shape.getTessellation();
if(shape.getUseShapeColor()){
mut_this->setColor( shape.getFillColor(),shape.getFillColor().a);
}
draw(mesh,OF_MESH_FILL);
}
if(shape.hasOutline()){
float lineWidth = ofGetStyle().lineWidth;
if(shape.getUseShapeColor()){
mut_this->setColor( shape.getStrokeColor(), shape.getStrokeColor().a);
}
mut_this->setLineWidth( shape.getStrokeWidth() );
const vector<ofPolyline> & outlines = shape.getOutline();
for(int i=0; i<(int)outlines.size(); i++)
draw(outlines[i]);
mut_this->setLineWidth(lineWidth);
}
if(shape.getUseShapeColor()){
mut_this->setColor(prevColor);
}
}
示例4: addPath
bool Clipper::addPath(const ofPath& paths,
ClipperLib::PolyType PolyTyp,
bool autoClose,
ClipperLib::cInt scale)
{
return addPolylines(paths.getOutline(), PolyTyp, autoClose, scale);
}
示例5: append
void ofPath::append(const ofPath & path){
if(mode==COMMANDS){
for(auto & command: path.getCommands()){
addCommand(command);
}
}else{
for(auto & poly: path.getOutline()){
polylines.push_back(poly);
}
}
flagShapeChanged();
}
示例6: resamplePath
//--------------------------------------------------------------
ofPath ofApp::resamplePath(ofPath path, float spacing){
ofPath resampledPath;
vector <ofPolyline> polylines = path.getOutline();
for(int j = 0; j < polylines.size(); j++){
ofPolyline spacePoly = polylines[j].getResampledBySpacing(spacing);
resampledPath.moveTo(spacePoly[0]);
for(int k = 1; k < spacePoly.size(); k++){
resampledPath.lineTo(spacePoly[k]);
}
resampledPath.lineTo(spacePoly[0]);
}
return resampledPath;
}
示例7: send
bool ofxEpilog::send(ofPath path)
{
//
// TODO([email protected]): test again and finish implementation
//
if (!tcp_client.isConnected())
{
return false;
}
ofBuffer buffer;
vector<ofPolyline> line = path.getOutline();
for (int i=0; i<line.size(); i++)
{
if(!send(line[i]))
return false;
}
return true;
}
示例8: 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;
}
示例9: ofPath_to_Polygons
//--------------------------------------------------------------
//--------------------------------------------------------------
//--------------------------------------------------------------
void ofxClipper::ofPath_to_Polygons(ofPath& path,ClipperLib::Polygons& polygons) {
return ofxPolylines_to_Polygons(path.getOutline(),polygons);
}
示例10: toClipper
ClipperLib::Paths Clipper::toClipper(const ofPath& path, ClipperLib::cInt scale)
{
return toClipper(path.getOutline(), scale);
}