summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/base
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-06-14 23:14:16 +0000
committerKarl Berry <karl@freefriends.org>2010-06-14 23:14:16 +0000
commitc2175edc7aa44ca0b526f008d473d6f8a8ac4933 (patch)
treed6c491676b413ad1922481f8c3fc7b64c3afc0a5 /Build/source/utils/asymptote/base
parent5d08e9ff4fe5fc836d237ea08e82c82b27d558a2 (diff)
asy 1.98
git-svn-id: svn://tug.org/texlive/trunk@18982 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/base')
-rw-r--r--Build/source/utils/asymptote/base/graph3.asy15
-rw-r--r--Build/source/utils/asymptote/base/plain_Label.asy2
-rw-r--r--Build/source/utils/asymptote/base/plain_constants.asy2
-rw-r--r--Build/source/utils/asymptote/base/three.asy32
-rw-r--r--Build/source/utils/asymptote/base/three_surface.asy17
-rw-r--r--Build/source/utils/asymptote/base/three_tube.asy6
6 files changed, 47 insertions, 27 deletions
diff --git a/Build/source/utils/asymptote/base/graph3.asy b/Build/source/utils/asymptote/base/graph3.asy
index 9c6529a74dd..ee83e8cb99b 100644
--- a/Build/source/utils/asymptote/base/graph3.asy
+++ b/Build/source/utils/asymptote/base/graph3.asy
@@ -1877,10 +1877,11 @@ void draw(picture pic=currentpicture, Label[] L=new Label[],
void draw(picture pic=currentpicture, Label[] L=new Label[],
guide3[][] g, pen p=currentpen, light light=currentlight,
- string name="", interaction interaction=LabelInteraction())
+ string name="", render render=defaultrender,
+ interaction interaction=LabelInteraction())
{
draw(pic,L,g,sequence(new pen(int) {return p;},g.length),light,name,
- interaction);
+ render,interaction);
}
real maxlength(triple f(pair z), pair a, pair b, int nu, int nv)
@@ -1893,7 +1894,8 @@ picture vectorfield(path3 vector(pair v), triple f(pair z), pair a, pair b,
int nu=nmesh, int nv=nu, bool truesize=false,
real maxlength=truesize ? 0 : maxlength(f,a,b,nu,nv),
bool cond(pair z)=null, pen p=currentpen,
- arrowbar3 arrow=Arrow3, margin3 margin=PenMargin3)
+ arrowbar3 arrow=Arrow3, margin3 margin=PenMargin3,
+ string name="", render render=defaultrender)
{
picture pic;
real du=1/nu;
@@ -1915,21 +1917,24 @@ picture vectorfield(path3 vector(pair v), triple f(pair z), pair a, pair b,
scale=max > 0 ? maxlength/max : 1;
} else scale=1;
+ begingroup3(pic,name == "" ? "vectorfield" : name,render);
for(int i=0; i <= nu; ++i) {
real x=interp(a.x,b.x,i*du);
for(int j=0; j <= nv; ++j) {
pair z=(x,interp(a.y,b.y,j*dv));
if(all || cond(z)) {
path3 g=scale3(scale)*vector(z);
+ string name="vector";
if(truesize) {
picture opic;
- draw(opic,g,p,arrow,margin);
+ draw(opic,g,p,arrow,margin,name,render);
add(pic,opic,f(z));
} else
- draw(pic,shift(f(z))*g,p,arrow,margin);
+ draw(pic,shift(f(z))*g,p,arrow,margin,name,render);
}
}
}
+ endgroup3(pic);
return pic;
}
diff --git a/Build/source/utils/asymptote/base/plain_Label.asy b/Build/source/utils/asymptote/base/plain_Label.asy
index 6e6f231375a..4f9d9a20f11 100644
--- a/Build/source/utils/asymptote/base/plain_Label.asy
+++ b/Build/source/utils/asymptote/base/plain_Label.asy
@@ -297,7 +297,7 @@ struct Label {
void label(frame f, transform t=identity(), pair position, pair align) {
pen p0=p == nullpen ? currentpen : p;
- align=length(align)*unit(shiftless(t)*align);
+ align=length(align)*unit(rotation(t)*align);
label(f,s,size,embed(t)*shiftless(T),
t*position+align*labelmargin(p0)+shift(T)*0,align,p0);
}
diff --git a/Build/source/utils/asymptote/base/plain_constants.asy b/Build/source/utils/asymptote/base/plain_constants.asy
index ba8947c91c2..d1d11b1b1c5 100644
--- a/Build/source/utils/asymptote/base/plain_constants.asy
+++ b/Build/source/utils/asymptote/base/plain_constants.asy
@@ -1,4 +1,4 @@
-restricted int undefined=intMax+((intMax % 2)-1);
+restricted int undefined=(intMax % 2 == 1) ? intMax : intMax-1;
restricted real inches=72;
restricted real inch=inches;
diff --git a/Build/source/utils/asymptote/base/three.asy b/Build/source/utils/asymptote/base/three.asy
index b0d9c456faa..2de8b4a5cca 100644
--- a/Build/source/utils/asymptote/base/three.asy
+++ b/Build/source/utils/asymptote/base/three.asy
@@ -36,6 +36,7 @@ struct render
// General parameters:
real margin; // shrink amount for rendered openGL viewport, in bp.
real tubegranularity; // granularity for rendering tubes
+ bool labelfill; // fill subdivision cracks in unlighted labels
static render defaultrender;
@@ -46,7 +47,8 @@ struct render
bool3 merge=defaultrender.merge,
int sphere=defaultrender.sphere,
real margin=defaultrender.margin,
- real tubegranularity=defaultrender.tubegranularity)
+ real tubegranularity=defaultrender.tubegranularity,
+ bool labelfill=defaultrender.labelfill)
{
this.compression=compression;
this.granularity=granularity;
@@ -56,6 +58,7 @@ struct render
this.sphere=sphere;
this.margin=margin;
this.tubegranularity=tubegranularity;
+ this.labelfill=labelfill;
}
}
@@ -70,6 +73,7 @@ defaultrender.merge=false;
defaultrender.margin=0.02;
defaultrender.tubegranularity=0.005;
defaultrender.sphere=NURBSsphere;
+defaultrender.labelfill=true;
real defaultshininess=0.25;
@@ -2127,8 +2131,7 @@ pair max(frame f, projection P)
void draw(picture pic=currentpicture, Label L="", path3 g,
align align=NoAlign, material p=currentpen, margin3 margin=NoMargin3,
- light light=nolight, string name="",
- render render=defaultrender)
+ light light=nolight, string name="", render render=defaultrender)
{
pen q=(pen) p;
pic.add(new void(frame f, transform3 t, picture pic, projection P) {
@@ -2167,13 +2170,13 @@ draw=new void(frame f, path3 g, material p=currentpen,
void cylinder(transform3) {};
void sphere(transform3, bool half) {};
void disk(transform3) {};
- void tube(path3, path3);
+ void pipe(path3, path3);
if(prc) {
cylinder=new void(transform3 t) {drawPRCcylinder(f,t,p,light);};
sphere=new void(transform3 t, bool half)
{drawPRCsphere(f,t,half,p,light,render);};
- disk=new void(transform3 t) {draw(f,t*unitdisk,p,light);};
- tube=new void(path3 center, path3 g)
+ disk=new void(transform3 t) {draw(f,t*unitdisk,p,light,render);};
+ pipe=new void(path3 center, path3 g)
{drawPRCtube(f,center,g,p,light);};
}
real linecap;
@@ -2193,7 +2196,7 @@ draw=new void(frame f, path3 g, material p=currentpen,
L += 2;
}
}
- tube T=tube(g,width,render,cylinder,sphere,tube);
+ tube T=tube(g,width,render,cylinder,sphere,pipe);
path3 c=T.center;
if(L >= 0) {
if(open) {
@@ -2300,10 +2303,11 @@ void draw(picture pic=currentpicture, Label L="", path3 g,
begingroup3(pic,name,render);
bool drawpath=arrow(pic,g,p,margin,light,arrowheadlight);
if(bar(pic,g,p,margin,light,arrowheadlight) && drawpath)
- draw(pic,L,g,align,p,margin,light);
+ draw(pic,L,g,align,p,margin,light,render);
if(group)
endgroup3(pic);
- label(pic,L,g,align,(pen) p);
+ if(L.s != "")
+ label(pic,L,g,align,(pen) p);
}
void draw(frame f, path3 g, material p=currentpen, arrowbar3 arrow,
@@ -2316,7 +2320,7 @@ void draw(frame f, path3 g, material p=currentpen, arrowbar3 arrow,
if(group)
begingroup3(f,name,render);
if(arrow(pic,g,p,NoMargin3,light,arrowheadlight))
- draw(f,g,p,light,P);
+ draw(f,g,p,light,render,P);
add(f,pic.fit());
if(group)
endgroup3(f);
@@ -2349,7 +2353,8 @@ void add(picture src, triple position, bool group=true, bool above=true)
void arrow(picture pic=currentpicture, Label L="", triple b, triple dir,
real length=arrowlength, align align=NoAlign,
pen p=currentpen, arrowbar3 arrow=Arrow3, margin3 margin=EndMargin3,
- light light=nolight, light arrowheadlight=currentlight)
+ light light=nolight, light arrowheadlight=currentlight,
+ string name="", render render=defaultrender)
{
Label L=L.copy();
if(L.defaultposition) L.position(0);
@@ -2358,7 +2363,7 @@ void arrow(picture pic=currentpicture, Label L="", triple b, triple dir,
picture opic;
marginT3 margin=margin(b--b,p); // Extract margin.begin and margin.end
triple a=(margin.begin+length+margin.end)*unit(dir);
- draw(opic,L,a--O,align,p,arrow,margin,light,arrowheadlight);
+ draw(opic,L,a--O,align,p,arrow,margin,light,arrowheadlight,name,render);
add(pic,opic,b);
}
@@ -2366,10 +2371,11 @@ void arrow(picture pic=currentpicture, Label L="", triple b, pair dir,
real length=arrowlength, align align=NoAlign,
pen p=currentpen, arrowbar3 arrow=Arrow3, margin3 margin=EndMargin3,
light light=nolight, light arrowheadlight=currentlight,
+ string name="", render render=defaultrender,
projection P=currentprojection)
{
arrow(pic,L,b,invert(dir,b,P),length,align,p,arrow,margin,light,
- arrowheadlight);
+ arrowheadlight,name,render);
}
triple min3(picture pic, projection P=currentprojection)
diff --git a/Build/source/utils/asymptote/base/three_surface.asy b/Build/source/utils/asymptote/base/three_surface.asy
index e00acfa8367..c4f05c7882f 100644
--- a/Build/source/utils/asymptote/base/three_surface.asy
+++ b/Build/source/utils/asymptote/base/three_surface.asy
@@ -1431,8 +1431,12 @@ void label(frame f, Label L, triple position, align align=NoAlign,
L.T3=transform3(P);
begingroup3(f,name == "" ? L.s : name,render);
if(is3D()) {
- for(patch S : surface(L,position).s)
+ bool lighton=light.on();
+ for(patch S : surface(L,position).s) {
draw3D(f,S,position,L.p,light,interaction);
+ if(render.labelfill && !lighton) // Fill subdivision cracks
+ _draw(f,S.external(),position,L.p,interaction.type);
+ }
} else {
pen p=color(L.T3*Z,L.p,light,shiftless(P.T.modelview));
if(L.defaulttransform3) {
@@ -1475,10 +1479,15 @@ void label(picture pic=currentpicture, Label L, triple position,
surface S=surface(L,v);
begingroup3(f,name == "" ? L.s : name,render,v,interaction.type);
- if(is3D())
- for(patch S : surface(L,v).s)
+ bool lighton=light.on();
+ if(is3D()) {
+ for(patch S : surface(L,v).s) {
draw3D(f,S,v,L.p,light,interaction);
-
+ if(render.labelfill && !lighton) // Fill subdivision cracks
+ _draw(f,S.external(),v,L.p,interaction.type);
+ }
+ }
+
if(pic != null) {
pen p=color(L.T3*Z,L.p,light,shiftless(P.T.modelview));
if(L.defaulttransform3) {
diff --git a/Build/source/utils/asymptote/base/three_tube.asy b/Build/source/utils/asymptote/base/three_tube.asy
index 2eb5e4cf716..281eb0716da 100644
--- a/Build/source/utils/asymptote/base/three_tube.asy
+++ b/Build/source/utils/asymptote/base/three_tube.asy
@@ -296,7 +296,7 @@ struct tube
void operator init(path3 p, real width, render render=defaultrender,
void cylinder(transform3)=Null,
void sphere(transform3, bool half)=Null,
- void tube(path3, path3)=null) {
+ void pipe(path3, path3)=null) {
real r=0.5*width;
void generate(path3 p) {
@@ -380,7 +380,7 @@ struct tube
path3 Center=path3(pre,point,post,b,T.cyclic);
center=center&Center;
- if(tube != null) { // Compute path along tube
+ if(pipe != null) { // Compute path along tube
triple[] pre=new triple[n+1];
triple[] point=new triple[n+1];
triple[] post=new triple[n+1];
@@ -392,7 +392,7 @@ struct tube
point[i+1]=P[3][0];
}
post[n]=S.s[S.index[n-1][0]].P[3][0];
- tube(Center,path3(pre,point,post,b,T.cyclic));
+ pipe(Center,path3(pre,point,post,b,T.cyclic));
}
}
}