Use ytick(Label(align=W),(0,4),W);
Just copied an example NURBSsurface.asy to http://asymptote.ualberta.ca and get an error message: triple[][] P=scale3(20)*octant1.P; ^ workspace_1.asy: 63.32: no matching variable 'octant1.P'
This could be done in many ways, here is one: import Lsystem; size(10cm,0); Lsystem SierpinskiCurve1= Lsystem("YF", new string[][]{{"X","YF+XF+Y"},{"Y","XF-YF-X"}}, La=60, Lai=0); Lsystem SierpinskiCurve2= Lsystem("YF", new string[][]{{"X","YF+XF+Y"},{"Y","XF-YF-X"}}, La=60, Lai=0); Lsystem SierpinskiCurve3= Lsystem("YF", new string[][]{{"X","YF+XF+Y"},{"Y","XF-YF-X"}}, La=60, Lai=0); SierpinskiCurve1.iterate(1); path g=SierpinskiCurve1.paths()[0]; SierpinskiCurve2.iterate(2); path h=SierpinskiCurve2.paths()[0];...
The png image above was produced with the standard options for such 3D surfaces asy -f png -render=4 Also, you can get a vector pdf file with just the curves of intersection: settings.outformat="pdf"; settings.prc=false; import graph3; size(200); currentprojection=orthographic((0.5,0.5,1)); real f(real x, real y, real z) {return y^2 + (z - 2)^2 - 4;} real g(real x, real y, real z) {return (x^2 + y^2 + z^2 + 8)^2 - 36*(x^2 + y^2);} arrowbar arr=Arrow(HookHead,size=2); draw(project(O--X),red+0.7bp,arr);...
Luckily, in this case we can find the intersection of the two surfaces in parametric form, expressing $x$ and $y$ coordinates of the intersection curve(s) in terms of $z$ and using $z$ as a parameter, varying from $0$ to $1$. The intersection curve is then a piece-wise parametric curve. Here is the code: import graph3; import smoothcontour3; size(200); currentprojection=orthographic((0.5,0.5,1)); real f(real x, real y, real z) {return y^2 + (z - 2)^2 - 4;} real g(real x, real y, real z) {return (x^2...
Cyclic array is a convenient feature, as well as the in-place anonymous array. Question: Is there any standard way to set a cyclic flag for a new anonymous array used, say, as an argument of a function? For example, let's assume that function f accepts an array argument a and either fill the closed area or just draw the outline, depending on the .cyclic flag of that array: import graph; void f(pair[] a, pen p=currentpen){ guide g=graph(a); if(a.cyclic){ g=g..cycle; fill(g,p); } else draw(g,p); }...
Try var mypen=rgb(.6,.6,1)+opacity(.7); // or // var mypen=emissive(white+opacity(.6)); //
You can also check out a couple of related examples at TeX.SE: filling-in the closed parts of a typeface glyph and can-i-visualize-the-bezier-control-points-of-a-letter-in-tex.
Something similar: settings.outformat="pdf"; size(9cm); path[] Lpath=texpath(Label("testing")); pair ll=min(Lpath); pair ur=max(Lpath); pair ul=(ll.x,ur.y); pair lr=(ur.x,ll.y); filldraw(Lpath,deepblue); draw(box(ll,ur),orange+0.2bp); dot("ll",ll,plain.SW,UnFill); dot("ur",ur,plain.NE,UnFill); dot("ul",ul,plain.NW,UnFill); dot("lr",lr,plain.SE,UnFill);
Hmmm... Are you going to check if the surface is one-sided, like a Mobius strip?
As a user of the Asymptote, I agree that it is also a great tool for leaning and doing programming. For your students I would suggest to use a TeXLive distribution, which includes ready-to-use Asymptote. Well yes, it's quite big, but it contains all dependencies and as far as I know, the installation needs minimal user efforts. For such math-intensive subject your students will benefit in using LaTeX anyway, so the earlier they start to use it, the better.
Try, for example, draw(Labels[i],cont[i][j],p[i],arrow=ArcArrow(HookHead,size=3,position=Relative(i/cont.length))); The argument of Relative is a real number from 0 (the beginning of the path to 1 (the end of it). To reverse direction of the arrow use BeginArcArrow with the same parameters instead. If it's possible to calculate somehow a direction/position of all arrows from the index, like in this example, use this function. Otherwise you can always prepare an array of manually specified arrows...
Something like this? import contour; size(200); real f(real x, real y) {return x^2-y^2;} int n=10; real[] c=new real[n]; for(int i=0; i < n; ++i) c[i]=(i-n/2)/n; pen[] p=sequence(new pen(int i) { return ( (c[i] >= 0 ? solid : dashed)+fontsize(6pt)); },c.length); Label[] Labels=sequence(new Label(int i) { return Label(c[i] != 0 ? (string) c[i] : "" ,Relative(unitrand()),(0,0),UnFill(1bp)); },c.length); guide[][] cont=contour(f,(-1,-1),(1,1),c); for(int i=0;i<cont.length;++i){ for(int j=0;j<cont[i].length;++j){...
Obviously, you've spotted a typo in the docs. The function arcpoint is defined in ../base/plain_paths.asy as // return the point on path p at arclength L pair arcpoint(path p, real L) { return point(p,arctime(p,L)); } Also, the interactive mode shows this definition: $ asy Welcome to Asymptote version 2.61 (to view the manual, type help) > arcpoint <pair arcpoint(path p, real L)> >
Try to play with fuzz, for example, real[][] A = intersections(p,kn,fuzz=1e-12);
Are you asking about pen invisible; This special pen writes in invisible ink, but adjusts the bounding box as if something had been drawn (like the \phantom command in TEX).
One way to fix this is to use $intersectionpoints$ instead: dot("$N$",intersectionpoints(reverse(dca),M--A)[0],plain.NE); since there are naturally two intersection points. OK, let's see what we can find in the docs (asymptote.pdf). pair[] intersectionpoints(path p, path q, real fuzz=-1); returns an array containing all intersection points of the paths p and q. That's exactly what one would need when the two paths clearly have more than one intersection point. On the other hand, pair intersectionpoint(path...
One way to fix this is to use $intersectionpoints$ instead: dot("$N$",intersectionpoints(reverse(dca),M--A)[0],plain.NE); since there are naturally two intersection points. OK, let's see what we can find in the docs (asymptote.pdf). pair[] intersectionpoints(path p, path q, real fuzz=-1); returns an array containing all intersection points of the paths p and q. That's exactly what one would need when the two paths clearly have more than one intersection point. On the other hand, pair intersectionpoint(path...
One way to fix this is to use intersectionpoints instead: dot("$N$",intersectionpoints(reverse(dca),M--A)[0],plain.NE); since there are naturally two intersection points in this case .
As suggested, added a copy of an issue Unexpected four points of Circle/Circle intersection.
I've checked several previous versions, and it looks like some changes were introduced (fuzz usage?) in version 2.48: the same code results in: // asymptote-2.47~~~ // // 0: (-0.560237885523118,0.828331764225293) // 1: (-0.560237885562501,-0.828331764198656) // // 0: (-0.560042915644411,0.828463597653214) // 1: (-0.560042915682286,-0.828463597627611) // // asymptote-2.48 // 0: (-0.560224859385282,0.828340574236673) // 1: (-0.560253448908069,-0.82832123779764) // // 0: (-0.560021536906841,0.82847804931724)...
// Asymptote version 2.61 [(C) 2004 Andy Hammerlindl, John C. Bowman, Tom Prince] // // ENABLED OPTIONS: // WebGL 3D HTML rendering // OpenGL 3D OpenGL rendering // GSL GNU Scientific Library (special functions) // FFTW3 Fast Fourier transforms // XDR external data representation (portable binary file format) // Readline interactive history and editing // Sigsegv distinguish stack overflows from segmentation faults // GC Boehm garbage collector // // DISABLED OPTIONS: // import graph; size(6cm);...
Try earthVelUnit=dir(earthOrbit, 3.6);
And this is completely valid position. But the question, however, is: why the archive is named asymptote-2.42.i386.tgz? This is confusing. The user sees i386 in a name, downloads it, and is surprised that asy is not working. P.S. I've found this by chance, it's not that I need this 32bit file, just want to point out that such inconsistency can be a source of unnecessary frustration, which can be easily avoided.
Is the executable found in asymptote-2.42.i386.tgz supposed to be 64-bit? /2.42/usr/local/bin$ file asy asy: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=da40173797555098b397e0881ea3cc7d676a8fe2, not stripped
Try surface s=surface(f,(0,0),(1,pi),100,Spline);
Great thanks for the update. Testing v.2.33: when compiling 3d-scenes, for example,...
Great thanks for the update. Testing v.2.33: when compiling 3d-scenes, for example,...
Use separate brackets instead: write(A[0][0][0]);
Check out this thread: http://sourceforge.net/p/asymptote/discussion/409349/thread/7261ab22/?limit=25#2a89...