summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/asymptote/roundedpath.asy
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-02-27 23:41:11 +0000
committerKarl Berry <karl@freefriends.org>2022-02-27 23:41:11 +0000
commit8027f287eb46d487a0e379911bdbc4d6c2bf44e4 (patch)
treeb6e3aeebab3f5c2560ae1ab892b76cca269eb05e /Master/texmf-dist/asymptote/roundedpath.asy
parenta4855ce49e2101557c17547c2d22594e1b2a215c (diff)
asymptote 2.78 support files
git-svn-id: svn://tug.org/texlive/trunk@62265 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/asymptote/roundedpath.asy')
-rw-r--r--Master/texmf-dist/asymptote/roundedpath.asy30
1 files changed, 15 insertions, 15 deletions
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;