summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/asymptote/three_tube.asy
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/asymptote/three_tube.asy')
-rw-r--r--Master/texmf-dist/asymptote/three_tube.asy16
1 files changed, 11 insertions, 5 deletions
diff --git a/Master/texmf-dist/asymptote/three_tube.asy b/Master/texmf-dist/asymptote/three_tube.asy
index bbbd5a65633..25bb9385ec8 100644
--- a/Master/texmf-dist/asymptote/three_tube.asy
+++ b/Master/texmf-dist/asymptote/three_tube.asy
@@ -176,18 +176,24 @@ bool uperiodic(real[][] a) {
int m=a[0].length;
real[] a0=a[0];
real[] a1=a[n-1];
- real epsilon=sqrtEpsilon*norm(a);
- for(int j=0; j < m; ++j)
+ for(int j=0; j < m; ++j) {
+ real norm=0;
+ for(int i=0; i < n; ++i)
+ norm=max(norm,abs(a[i][j]));
+ real epsilon=sqrtEpsilon*norm;
if(abs(a0[j]-a1[j]) > epsilon) return false;
+ }
return true;
}
bool vperiodic(real[][] a) {
int n=a.length;
if(n == 0) return false;
int m=a[0].length-1;
- real epsilon=sqrtEpsilon*norm(a);
- for(int i=0; i < n; ++i)
- if(abs(a[i][0]-a[i][m]) > epsilon) return false;
+ for(int i=0; i < n; ++i) {
+ real[] ai=a[i];
+ real epsilon=sqrtEpsilon*norm(ai);
+ if(abs(ai[0]-ai[m]) > epsilon) return false;
+ }
return true;
}