7

I use asymptote because of its amazing 3D capabilities. However, when I tried to plot a surface over a nonrectangular domain, I could not do it without getting jagged edges. As far as I know, other software such as Mathematica, Maple, or JavaView allow this kind of plots.

So the question is: is it possible to draw a generic surface in asymptote over a nonrectangular domain in such a way that its edges are smooth?

  • 1
    If you want an implicit plot, the contour3 module may be helpful. Otherwise, I'm reasonably sure the solution you describe below (mapping the domain onto a rectangle) is the only other currently feasible solution. I suppose you could set the mesh to be extremely fine so that the ragged edges are less obvious, but that would take forever to compile without really solving the problem. – Charles Staats Sep 20 '13 at 18:36
6

I found a solution that consists of mapping the domain onto a rectangle. If a domain D in R^2 can be represented as

D={(a(u,v), b(u,v)); u1<=u<=u2, v1<=v<=v2}

then, to plot a function f(x,y) over D, we could define the following function in asymptote:

triple g(pair p){
    real x=a(p.x,p.y), y=b(p.x,p.y);
    return (x,y,f(x,y));
}

Finally, the surface is plotted as follows

draw(surface(g,(u1,v1),(u2,v2),...),...);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.