From 682f8522246e030fbbdea7391dce107754c485d3 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 3 Jan 2022 03:01:59 +0000 Subject: CTAN sync 202201030301 --- graphics/asymptote/base/palette.asy | 25 ++++++++++++++++++++++--- graphics/asymptote/base/patterns.asy | 3 ++- graphics/asymptote/base/three.asy | 3 ++- graphics/asymptote/base/v3dheadertypes.asy | 2 +- graphics/asymptote/base/v3dtypes.asy | 2 +- 5 files changed, 28 insertions(+), 7 deletions(-) (limited to 'graphics/asymptote/base') diff --git a/graphics/asymptote/base/palette.asy b/graphics/asymptote/base/palette.asy index 9923e5b3aa..59cff39d72 100644 --- a/graphics/asymptote/base/palette.asy +++ b/graphics/asymptote/base/palette.asy @@ -65,7 +65,7 @@ pen[] adjust(picture pic, real min, real max, real rmin, real rmax, private real[] sequencereal; bounds image(picture pic=currentpicture, real[][] f, range range=Full, - pair initial, pair final, pen[] palette, + pair initial, pair final, pen[] palette, int divs=0, bool transpose=(initial.x < final.x && initial.y < final.y), bool copy=true, bool antialias=false) { @@ -74,6 +74,7 @@ bounds image(picture pic=currentpicture, real[][] f, range range=Full, real m=min(f); real M=max(f); + bounds bounds=range(pic,m,M); real rmin=pic.scale.z.T(bounds.min); real rmax=pic.scale.z.T(bounds.max); @@ -89,6 +90,21 @@ bounds image(picture pic=currentpicture, real[][] f, range range=Full, f[i]=map(new real(real x) {return T(min(max(x,m),M));},f[i]); } + if(divs > 0) { + int nx=f.length; + int ny=f[0].length; + real[][] data=new real[nx][ny]; + real incr=(M-m)/divs; + for(int i=0; i < nx; ++i) { + // Take center point of each bin + real[] fi=f[i]; + data[i]=sequence(new real(int j) { + return min(m+floor((fi[j]-m)/incr)*incr,M-incr); + },ny); + } + f=data; + } + initial=Scale(pic,initial); final=Scale(pic,final); @@ -109,13 +125,15 @@ bounds image(picture pic=currentpicture, real[][] f, range range=Full, bounds image(picture pic=currentpicture, real f(real, real), range range=Full, pair initial, pair final, - int nx=ngraph, int ny=nx, pen[] palette, bool antialias=false) + int nx=ngraph, int ny=nx, pen[] palette, int divs=0, + bool antialias=false) { // Generate data, taking scaling into account real xmin=pic.scale.x.T(initial.x); real xmax=pic.scale.x.T(final.x); real ymin=pic.scale.y.T(initial.y); real ymax=pic.scale.y.T(final.y); + real[][] data=new real[ny][nx]; for(int j=0; j < ny; ++j) { real y=pic.scale.y.Tinv(interp(ymin,ymax,(j+0.5)/ny)); @@ -125,7 +143,8 @@ bounds image(picture pic=currentpicture, real f(real, real), return f(Tinv(interp(xmin,xmax,(i+0.5)/nx)),y); },nx); } - return image(pic,data,range,initial,final,palette,transpose=false, + + return image(pic,data,range,initial,final,palette,divs,transpose=false, copy=false,antialias=antialias); } diff --git a/graphics/asymptote/base/patterns.asy b/graphics/asymptote/base/patterns.asy index 559e36cec1..e71690fbe9 100644 --- a/graphics/asymptote/base/patterns.asy +++ b/graphics/asymptote/base/patterns.asy @@ -13,7 +13,9 @@ frame tiling(string name, picture pic, pair lb=0, pair rt=0) /XStep "+format(s,pmax.x-pmin.x,"C")+" /YStep "+format(s,pmax.y-pmin.y,"C")+" /PaintProc {pop"); + begingroup(tiling); add(tiling,f); + endgroup(tiling); postscript(tiling,"} >> matrix makepattern /"+name+" exch def"); @@ -99,4 +101,3 @@ picture crosshatch(real H=5mm, pen p=currentpen) add(tiling,shift(H*sqrt(2))*rotate(90)*hatch(H,p)); return tiling; } - diff --git a/graphics/asymptote/base/three.asy b/graphics/asymptote/base/three.asy index fbca4b3960..ab30848444 100644 --- a/graphics/asymptote/base/three.asy +++ b/graphics/asymptote/base/three.asy @@ -3025,7 +3025,8 @@ frame embedder(object embedder(string prefix, string format), if(light.background != nullpen) box(f,light.background,Fill,above=false); } else if(!view) - label(f,graphic(prefix,"hiresbb")); + label(f,settings.inlinetex ? + "\input{"+prefix+"}" : graphic(prefix,"hiresbb")); } return f; } diff --git a/graphics/asymptote/base/v3dheadertypes.asy b/graphics/asymptote/base/v3dheadertypes.asy index cc78dfd4f4..19fad67eee 100644 --- a/graphics/asymptote/base/v3dheadertypes.asy +++ b/graphics/asymptote/base/v3dheadertypes.asy @@ -1,6 +1,6 @@ // Enum class for v3dheadertypes // AUTO-GENERATED from v3dheadertypes.csv -// Generated at 2021-12-27 17:52:27.156438 +// Generated at 2022-01-01 13:56:00.166634 struct v3dheadertypes { diff --git a/graphics/asymptote/base/v3dtypes.asy b/graphics/asymptote/base/v3dtypes.asy index 270e28faeb..3611e586ea 100644 --- a/graphics/asymptote/base/v3dtypes.asy +++ b/graphics/asymptote/base/v3dtypes.asy @@ -1,6 +1,6 @@ // Enum class for v3dtypes // AUTO-GENERATED from v3dtypes.csv -// Generated at 2021-12-27 17:52:27.075241 +// Generated at 2022-01-01 13:56:00.084723 struct v3dtypes { -- cgit v1.2.3