5

I'd like to reproduce in 3D the same thing as can be seen in the manual (section 3.5, Paths)

enter image description here

size(0,100);
path unitcircle=E..N..W..S..cycle;
path g=scale(2)*unitcircle;
filldraw(unitcircle^^g,evenodd+yellow,black);

I tried this

import three;
path3 p =  (0,-2,-2)-- (0,2,-2) -- (0,2,2) -- (0,-2,2) -- (0,-2,-2) -- cycle;
path3 q =  (0,-.25,-1.1) -- (0,.25,-1.1) -- (0,.25,1.1) -- (0,-.25,1.1) -- cycle;
filldraw(q^^p,evenodd+yellow,black);

but I get a

no matching function 'filldraw(path3[], pen)' error

Any ideas?

1 Answer 1

5

There's a routine for generating a surface from a single cyclic path.

enter image description here

Here's the code:

settings.outformat="pdf";
settings.render=0;
import three;
size(5cm);
path3 p =  (0,-2,-2)-- (0,2,-2) -- (0,2,2) -- (0,-2,2) -- (0,-2,-2) -- (0,-2,-2);
path3 q =  (0,-.25,-1.1) -- (0,.25,-1.1) -- (0,.25,1.1) -- (0,-.25,1.1) -- (0,-.25,-1.1);
draw(surface(p -- reverse(q) -- cycle), emissive(yellow));
draw(p ^^ q, black);
1
  • An alternative is to use the surface(path[]) routine, which will construct the surface in the xy-plane; then, use transformations to put the surface in the desired position. Aug 14, 2015 at 5:24

You must log in to answer this question.

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