Skip to content

Commit

Permalink
Remove radial line from ofpath::arc and ofPath::arcNegative (#6224)
Browse files Browse the repository at this point in the history
Remove the first command from ofPath, when the path command is arc.

fixes #5236 

#changelog #graphics
  • Loading branch information
CarstenHoyer authored and arturoc committed Feb 3, 2019
1 parent da2b6a8 commit 68fdf1a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions libs/openFrameworks/graphics/ofPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ void ofPath::arc(const glm::vec2 & centre, float radiusX, float radiusY, float a
//----------------------------------------------------------
void ofPath::arc(const glm::vec3 & centre, float radiusX, float radiusY, float angleBegin, float angleEnd){
if(mode==COMMANDS){
//addCommand adds a moveTo if one hasn't been set, but in this case it is adding a moveTo to the center of the arc and not the beginning of the arc
if(commands.empty() || commands.back().type==Command::close){
glm::vec3 start = centre + glm::vec3( glm::cos( glm::radians(angleBegin) ) * radiusX, glm::sin( glm::radians(angleBegin) ) * radiusY, 0.0f );
commands.push_back(Command(Command::moveTo,start));
}
addCommand(Command(Command::arc,centre,radiusX,radiusY,angleBegin,angleEnd));
}else{
lastPolyline().arc(centre,radiusX,radiusY,angleBegin,angleEnd,circleResolution);
Expand All @@ -237,6 +242,10 @@ void ofPath::arc(float x, float y, float z, float radiusX, float radiusY, float
//----------------------------------------------------------
void ofPath::arcNegative(const glm::vec3 & centre, float radiusX, float radiusY, float angleBegin, float angleEnd){
if(mode==COMMANDS){
if(commands.empty() || commands.back().type==Command::close){
glm::vec3 start = centre + glm::vec3( glm::cos( glm::radians(angleBegin) ) * radiusX, glm::sin( glm::radians(angleBegin) ) * radiusY, 0.0f );
commands.push_back(Command(Command::moveTo,start));
}
addCommand(Command(Command::arcNegative,centre,radiusX,radiusY,angleBegin,angleEnd));
}else{
lastPolyline().arcNegative(centre,radiusX,radiusY,angleBegin,angleEnd,circleResolution);
Expand Down

0 comments on commit 68fdf1a

Please sign in to comment.