//---------------------------------------------------------- void ofPath::moveTo(const ofPoint & p){ if(mode==COMMANDS){ addCommand(Command(Command::moveTo,p)); }else{ if(lastPolyline().size()>0) newSubPath(); lastPolyline().addVertex(p); } flagShapeChanged(); }
//---------------------------------------------------------- void ofPath::moveTo(const ofPoint & p){ if(mode==PATHS){ if(lastPath().size()>0) newSubPath(); lastPath().addCommand(ofSubPath::Command(ofSubPath::Command::lineTo,p)); hasChanged = true; }else{ if(lastPolyline().size()>0) newSubPath(); lastPolyline().addVertex(p); bNeedsTessellation = true; } }
//---------------------------------------------------------- void ofPath::lineTo(const ofPoint & p){ if(mode==COMMANDS){ addCommand(Command(Command::lineTo,p)); }else{ lastPolyline().lineTo(p); } flagShapeChanged(); }
//---------------------------------------------------------- void ofPath::close(){ if(mode==COMMANDS){ addCommand(Command(Command::close)); }else{ lastPolyline().setClosed(true); } flagShapeChanged(); }
//---------------------------------------------------------- void ofPath::arcNegative(const ofPoint & centre, float radiusX, float radiusY, float angleBegin, float angleEnd){ if(mode==COMMANDS){ addCommand(Command(Command::arcNegative,centre,radiusX,radiusY,angleBegin,angleEnd)); }else{ lastPolyline().arcNegative(centre,radiusX,radiusY,angleBegin,angleEnd,circleResolution); } flagShapeChanged(); }
//---------------------------------------------------------- void ofPath::quadBezierTo(const ofPoint & cp1, const ofPoint & cp2, const ofPoint & p){ if(mode==COMMANDS){ addCommand(Command(Command::quadBezierTo,p,cp1,cp2)); }else{ lastPolyline().quadBezierTo(cp1,cp2,p,curveResolution); } flagShapeChanged(); }
//---------------------------------------------------------- void ofPath::curveTo(const ofPoint & p){ if(mode==COMMANDS){ addCommand(Command(Command::curveTo,p)); }else{ lastPolyline().curveTo(p,curveResolution); } flagShapeChanged(); }
//---------------------------------------------------------- void ofPath::bezierTo(const glm::vec3 & cp1, const glm::vec3 & cp2, const glm::vec3 & p){ if(mode==COMMANDS){ addCommand(Command(Command::bezierTo,p,cp1,cp2)); }else{ lastPolyline().bezierTo(cp1,cp2,p,curveResolution); } flagShapeChanged(); }
//---------------------------------------------------------- void ofPath::arcNegative(const ofPoint & centre, float radiusX, float radiusY, float angleBegin, float angleEnd){ if(mode==PATHS){ lastPath().addCommand(ofSubPath::Command(ofSubPath::Command::arcNegative,centre,radiusX,radiusY,angleBegin,angleEnd)); hasChanged = true; }else{ lastPolyline().arcNegative(centre,radiusX,radiusY,angleBegin,angleEnd,arcResolution); bNeedsTessellation = true; } }
//---------------------------------------------------------- void ofPath::quadBezierTo(const ofPoint & cp1, const ofPoint & cp2, const ofPoint & p){ if(mode==PATHS){ lastPath().addCommand(ofSubPath::Command(ofSubPath::Command::quadBezierTo,p,cp1,cp2)); hasChanged = true; }else{ lastPolyline().quadBezierTo(cp1,cp2,p); bNeedsTessellation = true; } }
//---------------------------------------------------------- void ofPath::curveTo(const ofPoint & p){ if(mode==PATHS){ lastPath().addCommand(ofSubPath::Command(ofSubPath::Command::curveTo,p)); hasChanged = true; }else{ lastPolyline().curveTo(p); bNeedsTessellation = true; } }
//---------------------------------------------------------- void ofPath::close(){ if(mode==PATHS){ lastPath().close(); hasChanged = true; }else{ lastPolyline().setClosed(true); bNeedsTessellation = true; } //newPath(); }