Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
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

1 Answer 1

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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