summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/base/plain_arrows.asy
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/utils/asymptote/base/plain_arrows.asy')
-rw-r--r--Build/source/utils/asymptote/base/plain_arrows.asy47
1 files changed, 28 insertions, 19 deletions
diff --git a/Build/source/utils/asymptote/base/plain_arrows.asy b/Build/source/utils/asymptote/base/plain_arrows.asy
index 0ef8c2b2d5c..18618c2b5b8 100644
--- a/Build/source/utils/asymptote/base/plain_arrows.asy
+++ b/Build/source/utils/asymptote/base/plain_arrows.asy
@@ -543,27 +543,36 @@ void arrow(picture pic=currentpicture, Label L="", pair b, pair dir,
draw(b,pic,L,a--(0,0),align,p,arrow,margin);
}
-// Force an array of 2D pictures to be as least as large as picture all.
-void rescale2(picture[] pictures, picture all)
-{
- if(!all.empty2()) {
- transform t=inverse(all.calculateTransform()*pictures[0].T);
- pair m=t*min(all);
- pair M=t*max(all);
- for(int i=0; i < pictures.length; ++i) {
- draw(pictures[i],m,nullpen);
- draw(pictures[i],M,nullpen);
- }
- }
-}
-
-// Force an array of pictures to have a uniform scaling.
-void rescale(picture[] pictures)
-{
- if(pictures.length == 0) return;
+// Fit an array of pictures simultaneously using the sizing of picture all.
+frame[] fit2(picture[] pictures, picture all)
+{
+ frame[] out;
+ if(!all.empty2()) {
+ transform t=all.calculateTransform();
+ pair m=all.min(t);
+ pair M=all.max(t);
+ for(picture pic : pictures) {
+ frame f=pic.fit(t);
+ draw(f,m,nullpen);
+ draw(f,M,nullpen);
+ out.push(f);
+ }
+ }
+ return out;
+}
+
+// Fit an array of pictures simultaneously using the size of the first picture.
+frame[] fit(string prefix="", picture[] pictures, string format="",
+ bool view=true, string options="", string script="",
+ projection P=currentprojection)
+{
+ if(pictures.length == 0)
+ return new frame[];
+
picture all;
size(all,pictures[0]);
for(picture pic : pictures)
add(all,pic);
- rescale2(pictures,all);
+
+ return fit2(pictures,all);
}