summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/base
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-05-18 21:58:51 +0000
committerKarl Berry <karl@freefriends.org>2013-05-18 21:58:51 +0000
commit1b4cb2401e932a47c4e736a0197d22c7797b58ad (patch)
tree8e478eee9868a06467931e053ec06658ae3a8e06 /Build/source/utils/asymptote/base
parent93dcab8a877f998aafe2bef5e59b7c6ea2f7f434 (diff)
asy 2.22 sources
git-svn-id: svn://tug.org/texlive/trunk@30552 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/base')
-rw-r--r--Build/source/utils/asymptote/base/geometry.asy2
-rw-r--r--Build/source/utils/asymptote/base/graph.asy6
-rw-r--r--Build/source/utils/asymptote/base/math.asy20
-rw-r--r--Build/source/utils/asymptote/base/plain_picture.asy11
-rw-r--r--Build/source/utils/asymptote/base/three_light.asy2
-rw-r--r--Build/source/utils/asymptote/base/three_surface.asy9
6 files changed, 33 insertions, 17 deletions
diff --git a/Build/source/utils/asymptote/base/geometry.asy b/Build/source/utils/asymptote/base/geometry.asy
index bbbc823fc54..6dc10674bd9 100644
--- a/Build/source/utils/asymptote/base/geometry.asy
+++ b/Build/source/utils/asymptote/base/geometry.asy
@@ -4099,7 +4099,7 @@ real arclength(ellipse el, real angle1, real angle2,
real S(real a)
{//Return the arclength from 0 to the angle 'a' (in degrees)
// given form the center of the ellipse.
- real gle = atan(el.a * Tan(a)/el.b)+
+ real gle = atan(el.a * tan(radians(a))/el.b)+
pi * (((a%90 == 0 && a != 0) ? floor(a/90) - 1 : floor(a/90)) -
((a%180 == 0) ? 0 : floor(a/180)) -
(a%360 == 0 ? floor(a/(360)) : 0));
diff --git a/Build/source/utils/asymptote/base/graph.asy b/Build/source/utils/asymptote/base/graph.asy
index 410c59cf13a..c50a7a67b2c 100644
--- a/Build/source/utils/asymptote/base/graph.asy
+++ b/Build/source/utils/asymptote/base/graph.asy
@@ -235,8 +235,10 @@ ticklabel Format(string s=defaultformat)
ticklabel OmitFormat(string s=defaultformat ... real[] x)
{
return new string(real v) {
- int i=find(x == v);
- return i < 0 ? format(s,v) : "";
+ string V=format(s,v);
+ for(real a : x)
+ if(format(s,a) == V) return "";
+ return V;
};
}
diff --git a/Build/source/utils/asymptote/base/math.asy b/Build/source/utils/asymptote/base/math.asy
index 77c0664895f..46d663d3181 100644
--- a/Build/source/utils/asymptote/base/math.asy
+++ b/Build/source/utils/asymptote/base/math.asy
@@ -149,8 +149,9 @@ bool increasing(real[] a, bool strict=false)
return all(b);
}
-// Return the indices of consecutive true-element segments of bool[] b.
-int[][] segment(bool[] b)
+// Return the first and last indices of consecutive true-element segments
+// of bool[] b.
+int[][] segmentlimits(bool[] b)
{
int[][] segment;
bool[] n=copy(b);
@@ -159,15 +160,24 @@ int[][] segment(bool[] b)
int[] edge=(b != n) ? sequence(1,b.length) : null;
edge.insert(0,0);
int stop=edge[0];
- for(int i=0; i < edge.length-1;) {
+ for(int i=1; i < edge.length; ++i) {
int start=stop;
- stop=edge[++i];
+ stop=edge[i];
if(b[start])
- segment.push(sequence(start,stop-1));
+ segment.push(new int[] {start,stop-1});
}
return segment;
}
+// Return the indices of consecutive true-element segments of bool[] b.
+int[][] segment(bool[] b)
+{
+ int[][] S=segmentlimits(b);
+ return sequence(new int[](int i) {
+ return sequence(S[i][0],S[i][1]);
+ },S[0].length);
+}
+
// If the sorted array a does not contain x, insert it sequentially,
// returning the index of x in the resulting array.
int unique(real[] a, real x) {
diff --git a/Build/source/utils/asymptote/base/plain_picture.asy b/Build/source/utils/asymptote/base/plain_picture.asy
index 5b06b7f737c..5f4d759663a 100644
--- a/Build/source/utils/asymptote/base/plain_picture.asy
+++ b/Build/source/utils/asymptote/base/plain_picture.asy
@@ -1250,19 +1250,20 @@ void latticeshade(picture pic=currentpicture, path[] g, bool stroke=false,
}
void axialshade(picture pic=currentpicture, path[] g, bool stroke=false,
- pen pena, pair a, pen penb, pair b, bool copy=true)
+ pen pena, pair a, bool extenda=true,
+ pen penb, pair b, bool extendb=true, bool copy=true)
{
if(copy)
g=copy(g);
pic.add(new void(frame f, transform t) {
- axialshade(f,t*g,stroke,pena,t*a,penb,t*b,false);
+ axialshade(f,t*g,stroke,pena,t*a,extenda,penb,t*b,extendb,false);
},true);
pic.addPath(g);
}
void radialshade(picture pic=currentpicture, path[] g, bool stroke=false,
- pen pena, pair a, real ra, pen penb, pair b, real rb,
- bool copy=true)
+ pen pena, pair a, real ra, bool extenda=true,
+ pen penb, pair b, real rb, bool extendb=true, bool copy=true)
{
if(copy)
g=copy(g);
@@ -1270,7 +1271,7 @@ void radialshade(picture pic=currentpicture, path[] g, bool stroke=false,
pair A=t*a, B=t*b;
real RA=abs(t*(a+ra)-A);
real RB=abs(t*(b+rb)-B);
- radialshade(f,t*g,stroke,pena,A,RA,penb,B,RB,false);
+ radialshade(f,t*g,stroke,pena,A,RA,extenda,penb,B,RB,extendb,false);
},true);
pic.addPath(g);
}
diff --git a/Build/source/utils/asymptote/base/three_light.asy b/Build/source/utils/asymptote/base/three_light.asy
index 73f68b62a86..6cbd9b6f0be 100644
--- a/Build/source/utils/asymptote/base/three_light.asy
+++ b/Build/source/utils/asymptote/base/three_light.asy
@@ -79,7 +79,7 @@ pen color(triple normal, material m, light light, transform3 T=light.T) {
triple[] position=light.position;
if(invisible((pen) m)) return invisible;
if(position.length == 0) return m.diffuse();
- normal=unit(T*normal);
+ normal=unit(transpose(inverse(shiftless(T)))*normal);
if(settings.twosided) normal *= sgn(normal.z);
real s=m.shininess*128;
real[] Diffuse=rgba(m.diffuse());
diff --git a/Build/source/utils/asymptote/base/three_surface.asy b/Build/source/utils/asymptote/base/three_surface.asy
index 0ef497f6d56..85d32b08eb6 100644
--- a/Build/source/utils/asymptote/base/three_surface.asy
+++ b/Build/source/utils/asymptote/base/three_surface.asy
@@ -321,9 +321,12 @@ patch operator * (transform3 t, patch s)
Si[j]=t*si[j];
}
- transform3 t0=shiftless(t);
- for(int i=0; i < s.normals.length; ++i)
- S.normals[i]=t0*s.normals[i];
+ if(s.normals.length > 0) {
+ transform3 t0=shiftless(t);
+ t0=determinant(t0) == 0 ? identity4 : transpose(inverse(t0));
+ for(int i=0; i < s.normals.length; ++i)
+ S.normals[i]=t0*s.normals[i];
+ }
S.colors=copy(s.colors);
S.planar=s.planar;