From 8027f287eb46d487a0e379911bdbc4d6c2bf44e4 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 27 Feb 2022 23:41:11 +0000 Subject: asymptote 2.78 support files git-svn-id: svn://tug.org/texlive/trunk@62265 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/asymptote/roundedpath.asy | 30 ++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'Master/texmf-dist/asymptote/roundedpath.asy') diff --git a/Master/texmf-dist/asymptote/roundedpath.asy b/Master/texmf-dist/asymptote/roundedpath.asy index 1a426f91dcb..0029447327c 100644 --- a/Master/texmf-dist/asymptote/roundedpath.asy +++ b/Master/texmf-dist/asymptote/roundedpath.asy @@ -1,7 +1,7 @@ // a function to round sharp edges of open and cyclic paths // written by stefan knorr -path roundedpath(path A, real R, real S = 1) +path roundedpath(path A, real R, real S = 1) // create rounded path from path A with radius R and scale S = 1 { path RoundPath; // returned path @@ -9,20 +9,20 @@ path roundedpath(path A, real R, real S = 1) path LocalCirc; // local edge circle for intersection real LocalTime; // local intersectiontime between . and .. pair LocalPair; // local point to be added to 'RoundPath' - - int len=length(A); // length of given path 'A' + + int len=length(A); // length of given path 'A' bool PathClosed=cyclic(A); // true, if given path 'A' is cyclic // initialisation: define first Point of 'RoundPath' as if (PathClosed) // ? is 'A' cyclic - RoundPath=scale(S)*point(point(A,0)--point(A,1), 0.5); // centerpoint of first straight subpath of 'A' + RoundPath=scale(S)*point(point(A,0)--point(A,1), 0.5); // centerpoint of first straight subpath of 'A' else RoundPath=scale(S)*point(A,0); // first point of 'A' - // doing everything between start and end - // create round paths subpath by subpath for every i-th edge + // doing everything between start and end + // create round paths subpath by subpath for every i-th edge for(int i=1; i < len; ++i) - { + { // straight subpath towards i-th edge LocalPath=point(A,i-1)---point(A,i); // circle with radius 'R' around i-th edge @@ -36,23 +36,23 @@ path roundedpath(path A, real R, real S = 1) // add straight subpath towards i-th curvature to 'RoundPath' RoundPath=RoundPath--scale(S)*LocalPair; } - + // straight subpath from i-th edge to (i+1)-th edge LocalPath=point(A,i)---point(A,i+1); // calculate intersection-time between straight subpath and circle real[] t=intersect(LocalPath, LocalCirc); if(t.length > 0) { LocalTime=t[0]; - // define intersectionpoint between both paths + // define intersectionpoint between both paths LocalPair=point(subpath(LocalPath, 0, LocalTime), 1); // add curvature near i-th edge to 'RoundPath' RoundPath=RoundPath..scale(S)*LocalPair; } - } + } - // final steps to have a correct termination + // final steps to have a correct termination if(PathClosed) { // Is 'A' cyclic? - // straight subpath towards 0-th edge + // straight subpath towards 0-th edge LocalPath=point(A,len-1)---point(A,0); // circle with radius 'R' around 0-th edge LocalCirc=circle(point(A,0),R); @@ -65,15 +65,15 @@ path roundedpath(path A, real R, real S = 1) // add straight subpath towards 0-th curvature to 'RoundPath' RoundPath=RoundPath--scale(S)*LocalPair; } - - + + // straight subpath from 0-th edge to 1st edge LocalPath=point(A,0)---point(A,1); // calculate intersection-time between straight subpath and circle real[] t=intersect(LocalPath, LocalCirc); if(t.length > 0) { LocalTime=t[0]; - // define intersectionpoint between both paths + // define intersectionpoint between both paths LocalPair=point(subpath(LocalPath, 0, LocalTime), 1); // add curvature near 0-th edge to 'RoundPath' and close path RoundPath=RoundPath..scale(S)*LocalPair--cycle; -- cgit v1.2.3