本文整理汇总了C++中ofPath类的典型用法代码示例。如果您正苦于以下问题:C++ ofPath类的具体用法?C++ ofPath怎么用?C++ ofPath使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ofPath类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: mousePointerStraight
void pathFactory::mousePointerStraight(ofPath &p, float x_dim, float y_dim, float t_size){
vector<ofPoint> tpoints;
float tw = 0.3;
float sw = 0.074;
float cl = 1;
float al = 0.74;
float bl = 0.55;
tpoints.push_back(ofPoint(0,0));
tpoints.push_back(ofPoint(-tw,al));//a1
tpoints.push_back(ofPoint(-sw,bl)); // b1
tpoints.push_back(ofPoint(-sw,cl)); //c1
tpoints.push_back(ofPoint(sw,cl));//c2
tpoints.push_back(ofPoint(sw,bl)); // b2
tpoints.push_back(ofPoint(tw,al)); //a2
tpoints.push_back(ofPoint(0,0));
for(int i = 0; i < tpoints.size(); i++){
tpoints[i] *= ofVec2f(x_dim, y_dim);
tpoints[i] *= t_size;
p.lineTo(tpoints[i]);
}
p.close();
}
开发者ID:kimon-satan,项目名称:clamourMedia,代码行数:29,代码来源:pathFactory.cpp
示例2: push
void ShapeContentRect::push(ofPath& path)
{
vector<ofPath::Command>& command = path.getCommands();
int command_count_prev = command.size();
path.rectRounded(pos_-size_/2.f, size_.x, size_.y, roundness_);
command_count_ = command.size() - command_count_prev;
}
开发者ID:N3TWORK,项目名称:ofxAE,代码行数:7,代码来源:ofxAEShapeCap.cpp
示例3: rectangle
// Temporary fix until OF 0.8.0
static void rectangle(ofPath & path, const ofRectangle & r){
path.moveTo(r.getTopLeft());
path.lineTo(r.getTopRight());
path.lineTo(r.getBottomRight());
path.lineTo(r.getBottomLeft());
path.close();
}
开发者ID:NickHardeman,项目名称:ofxBox2d,代码行数:8,代码来源:ofxBox2dRect.cpp
示例4: 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;
}
开发者ID:companje,项目名称:ofxExtras,代码行数:9,代码来源:ofxExtras.cpp
示例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();
}
开发者ID:IglooVision,项目名称:openFrameworks,代码行数:12,代码来源:ofPath.cpp
示例6: pop
void ShapeContentFill::pop(ofPath& path)
{
ofPushStyle();
path.setFilled(true);
ofColor prev = path.getFillColor();
float opacity = prev.a/255.f*opacity_;
path.setFillColor(ofColor(color_, opacity*255));
ofEnableBlendMode(blend_mode_);
path.draw();
path.setFillColor(prev);
ofPopStyle();
}
开发者ID:N3TWORK,项目名称:ofxAE,代码行数:12,代码来源:ofxAEShapeCap.cpp
示例7: handlePathDrawStyle
void handlePathDrawStyle(ofPath& p)
{
p.setFilled(m_hasFill);
p.setFillColor(m_fillColor);
p.setStrokeColor(m_strokeColor);
if( m_hasStroke )
{
p.setStrokeWidth(m_strokeWeight);
}
else
{
p.setStrokeWidth(0);
}
}
开发者ID:JosephLaurino,项目名称:ofx-experiments,代码行数:14,代码来源:processing.cpp
示例8: ofSetCurrentRenderer
void ofSetCurrentRenderer(ofPtr<ofBaseRenderer> renderer_){
renderer = renderer_;
renderer->setupGraphicDefaults();
if(renderer->rendersPathPrimitives()){
shape.setMode(ofPath::PATHS);
}else{
shape.setMode(ofPath::POLYLINES);
}
shape.setUseShapeColor(false);
ofSetStyle(currentStyle);
}
开发者ID:jasonlevine,项目名称:body-controlled-instrument,代码行数:14,代码来源:ofGraphics.cpp
示例9: ofxSimplifyPath
void ofxSimplifyPath(ofPath &path, int iterations, float amount) {
for (int iteration=0; iteration<iterations; iteration++) {
vector<ofSubPath> &subpaths = path.getSubPaths();
for (int i=0; i<subpaths.size(); i++) {
vector<ofSubPath::Command> &commands = subpaths[i].getCommands();
if (commands.size()<amount) continue;
for (int j=0; j<commands.size()-1; j++) {
if (commands[j].to.distance(commands[j+1].to)<3) {
commands[j].to = (commands[j].to+commands[j+1].to)/2;
commands.erase(commands.begin()+j+1);
}
}
}
}
path.flagShapeChanged();
}
开发者ID:minusplusminus,项目名称:ofxExtras,代码行数:16,代码来源:ofxExtras.cpp
示例10: roundedRect
void pathFactory::roundedRect(ofPath &p, float x_dim, float y_dim, float t_size){
ofRectangle r;
r.setFromCenter(0,0, x_dim * t_size, y_dim * t_size);
p.rectRounded(r, t_size/10);
}
开发者ID:kimon-satan,项目名称:clamourMedia,代码行数:7,代码来源:pathFactory.cpp
示例11: ofSetCurrentRenderer
void ofSetCurrentRenderer(ofPtr<ofBaseRenderer> renderer_,bool setDefaults){
renderer = renderer_;
if(renderer->rendersPathPrimitives()){
shape.setMode(ofPath::COMMANDS);
}else{
shape.setMode(ofPath::POLYLINES);
}
shape.setUseShapeColor(false);
if(setDefaults){
renderer->setupGraphicDefaults();
ofSetStyle(currentStyle);
ofBackground(currentStyle.bgColor);
}
}
开发者ID:B-IT,项目名称:openFrameworks,代码行数:16,代码来源:ofGraphics.cpp
示例12: addPath
bool Clipper::addPath(const ofPath& paths,
ClipperLib::PolyType PolyTyp,
bool autoClose,
ClipperLib::cInt scale)
{
return addPolylines(paths.getOutline(), PolyTyp, autoClose, scale);
}
开发者ID:bakercp,项目名称:ofxClipper,代码行数:7,代码来源:Clipper.cpp
示例13: ofxSimplifyPath
void ofxSimplifyPath(ofPath &path, int iterations, float amount, float distance) { //wat doet amount?? should be distance???
for (int iteration=0; iteration<iterations; iteration++) {
vector<ofSubPath> &subpaths = path.getSubPaths();
for (int i=0; i<subpaths.size(); i++) {
vector<ofSubPath::Command> &commands = subpaths[i].getCommands();
if (commands.size()<amount) continue;
for (int j=1; j<commands.size()-2; j++) { //laat eerste en laatste punt met rust
if (commands[j].to.distance(commands[j+1].to)<distance) {
commands[j].to = (commands[j].to+commands[j+1].to)/2;
commands.erase(commands.begin()+j+1);
}
}
}
}
path.flagShapeChanged();
}
开发者ID:Bicicletorama,项目名称:Game,代码行数:16,代码来源:ofxExtras.cpp
示例14: setupShape
void Svg::setupShape(struct svgtiny_shape * shape, ofPath & path){
float* p = shape->path;
path.setFilled(false);
if(shape->fill != svgtiny_TRANSPARENT){
path.setFilled(true);
path.setFillHexColor(shape->fill);
path.setPolyWindingMode(OF_POLY_WINDING_NONZERO);
}
if(shape->stroke != svgtiny_TRANSPARENT){
path.setStrokeWidth(shape->stroke_width);
path.setStrokeHexColor(shape->stroke);
}
for(int i = 0; i < (int)shape->path_length;){
if(p[i] == svgtiny_PATH_MOVE){
path.moveTo(p[i + 1], p[i + 2]);
i += 3;
}
else if(p[i] == svgtiny_PATH_CLOSE){
path.close();
i += 1;
}
else if(p[i] == svgtiny_PATH_LINE){
path.lineTo(p[i + 1], p[i + 2]);
i += 3;
}
else if(p[i] == svgtiny_PATH_BEZIER){
path.bezierTo(p[i + 1], p[i + 2],
p[i + 3], p[i + 4],
p[i + 5], p[i + 6]);
i += 7;
}
else{
ofLogError("Svg") << "setupShape(): SVG parse error";
i += 1;
}
}
}
开发者ID:cviejo,项目名称:mPD,代码行数:43,代码来源:Svg.cpp
示例15: ofxGetPointsFromPath
vector<ofPoint*> ofxGetPointsFromPath(ofPath &path) {
vector<ofPoint*> points;
vector<ofSubPath> &subpaths = path.getSubPaths();
for (int i=0; i<subpaths.size(); i++) {
vector<ofSubPath::Command> &commands = subpaths[i].getCommands();
for (int j=0; j<commands.size(); j++) {
points.push_back(&commands[j].to);
}
}
return points;
}
开发者ID:Bicicletorama,项目名称:Game,代码行数:11,代码来源:ofxExtras.cpp
示例16: 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;
}
开发者ID:danielmorena,项目名称:OF_GenerativeTypography,代码行数:41,代码来源:ofApp.cpp
示例17: ofxGetPolylinesFromPath
vector<ofPolyline> ofxGetPolylinesFromPath(ofPath path) {
vector<ofPolyline> polylines;
vector<ofSubPath> &subpaths = path.getSubPaths();
for (int i=0; i<subpaths.size(); i++) {
ofPolyline poly;
vector<ofSubPath::Command> &commands = subpaths[i].getCommands();
for (int j=0; j<commands.size()-1; j++) {
poly.addVertex(commands[i].to);
}
polylines.push_back(poly);
}
return polylines;
}
开发者ID:Bicicletorama,项目名称:Game,代码行数:13,代码来源:ofxExtras.cpp
示例18: 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;
}
开发者ID:danielmorena,项目名称:OF_GenerativeTypography,代码行数:14,代码来源:ofApp.cpp
示例19: setup
// -----------------------------------
void Letter::setup(ofPath letter, float depth)
{
// Tessellation is subdividing a concave polygon into convex polygons.
front = letter.getTessellation();
back = front;
// Loop through all of the vertices in the "back" mesh
// and move them back in on the "z" axis
vector<ofPoint>& f = front.getVertices();
vector<ofPoint>& b = back.getVertices();
for(int j=0; j< f.size(); j++)
{
f[j].z += depth/2.0;
b[j].z -= depth/2.0;
}
}
开发者ID:Sammino,项目名称:CodeForArt,代码行数:17,代码来源:Letter.cpp
示例20: 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;
}
开发者ID:YCAMInterlab,项目名称:ofxEpilog,代码行数:21,代码来源:ofxEpilog.cpp
注:本文中的ofPath类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论