X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Fsrc%2Fsynfig%2Fblinepoint.cpp;h=83e004d95a6257481f67f5c5705807201fd4c3b1;hb=c8dfc1fcfebdcc765fac4de28731a783b6099c35;hp=4291bbfdff9122174e78c6930f3ce0442e12a0c5;hpb=a095981e18cc37a8ecc7cd237cc22b9c10329264;p=synfig.git diff --git a/synfig-core/src/synfig/blinepoint.cpp b/synfig-core/src/synfig/blinepoint.cpp index 4291bbf..83e004d 100644 --- a/synfig-core/src/synfig/blinepoint.cpp +++ b/synfig-core/src/synfig/blinepoint.cpp @@ -49,15 +49,22 @@ using namespace synfig; void synfig::BLinePoint::reverse() { - if(split_tangent_) - { - std::swap(tangent_[0],tangent_[1]); - tangent_[0]=-tangent_[0]; - tangent_[1]=-tangent_[1]; - } - else - { - tangent_[0]=-tangent_[0]; - tangent_[1]=-tangent_[1]; - } + std::swap(tangent_[0],tangent_[1]); + tangent_[0]=-tangent_[0]; + tangent_[1]=-tangent_[1]; +} + +void +synfig::BLinePoint::normalize(int i) +{ + //i is the number of the tangent to modify + //other tangent is (1-i) + split_tangent_=(!link_radius_ && !link_theta_); + if (link_radius_ && link_theta_) + tangent_[i]=tangent_[1-i]; + else if (link_radius_) + tangent_[i]=tangent_[i].norm()*tangent_[1-i].mag(); + else if (link_theta_) + tangent_[i]=tangent_[1-i].norm()*tangent_[i].mag(); + }