2

I have a question regarding Asymptote. I experience a problem when I use Asymptote to draw planar surfaces defined from cyclic paths, as illustrated with the example below. When I draw the surface, odd streaks are visible near the corners of the surface.

settings.outformat="png";
settings.render=8;
size(8cm, 0);
import three;

currentprojection = orthographic(0,0,-1,up=-Y,zoom=0.937);

real r=3;
real c = 5;
real w = 1;

pair Pynp = (-w/2, c/2);
pair P1np = (-w/2, w/2);
pair Pxnp = (-c/2, w/2);
pair Pxnn = (-c/2, -w/2);
pair P1nn = (-w/2, -w/2);
pair Pynn = (-w/2, -c/2);
pair Pcyn = (0, -c/2);
pair Pcyp = (0, c/2);

path outline = arc((0,0), r, 90, 270) -- Pcyn -- Pynn -- P1nn -- Pxnn -- Pxnp -- P1np -- Pynp -- Pcyp -- cycle;

path3 outline3 = path3(outline);

surface s = surface(outline); 

draw(outline3, black + linewidth(2));

draw(s, red);

As seen in the example above, the surface is defined from a cyclic 2D path, which consists of an arc and a number of line segments.

Could you please let me know if this is a known problem, and if there is anything that I can do to solve the problem?

I am using Asymptote 2.41 on a Windows 10 platform.

This is a screenshot from the OpenGL render. The black streaks are clearly visible in two of the corners. The streaks are also present in the PNG-file which I generate directly from the asy-file.

This is a screenshot from the OpenGL render. The black streaks are clearly visible in two of the corners. The streaks are also present in the PNG-file which I generate directly from the asy-file.

1 Answer 1

2

I am not sure to explain the problem. Perhaps in the 3D renderer, degenerate triangle or Bezier patch ? I tried the command Arc (with capital A) from graph.asy which can produce circular arc with more accuracy. The number of nodes of the circular arc being different, the triangulation of outline (required to create the surface) is different and with Asymptote svn (more or less) on Linux 64bits, it seems to be ok. Here the code

size(8cm, 0);
import graph;
import three;

currentprojection = orthographic(0,0,-1,up=-Y,zoom=0.937);

real r=3;
real c = 5;
real w = 1;

pair Pynp = (-w/2, c/2);
pair P1np = (-w/2, w/2);
pair Pxnp = (-c/2, w/2);
pair Pxnn = (-c/2, -w/2);
pair P1nn = (-w/2, -w/2);
pair Pynn = (-w/2, -c/2);
pair Pcyn = (0, -c/2);
pair Pcyp = (0, c/2);

path outline = Arc((0,0), r, 90, 270,10) -- Pcyn -- Pynn -- P1nn -- Pxnn -- Pxnp -- P1np -- Pynp -- Pcyp -- cycle;

path3 outline3 = path3(outline);

surface s = surface(outline3); 

draw(outline3, black + linewidth(2));

draw(s, red);

and the result

enter image description here

O.G.

1
  • O. G.: Thanks a lot for your advice. Using the command "Arc" (with capital "A") from the graph.asy (or graph3.asy) package solved my problem.
    – Henrik
    Sep 7, 2017 at 12:40

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .