In a post of April 15, 2013 by Kitonum, the procedure named Picture accepts a list of polygon segments, creates a plot of these as a 2D polygon's boundaries and fills the polygon with a color.

The code below attempts to modify Picture to produce a 3D filled polygon in a plane parallel to the xy plane.

When invoked by the code below the procedure, the filling color conforms to the straight line boundaries but overflows the curved, parabolic boundary. How can this be corrected?

Picture:=proc(L, C, N::posint:=100, Boundary::list:=[linestyle=1])

local i, var, var1, var2,e, e1, e2,e3, P, h ;

global Q,Border;

for i to nops(L) do

#` set P`[i] = list of points for each segment.

#` for a segment defined as a list of points, P[i] = the segment's definition`

#` for a curve definition, approximate it with a list of [x,y] points of its function evaluated at N even intervals in its

# range`

if type(L[i],listlist(algebraic)) then P[i]:=op(L[i]); else

#` for curve def'n, set var = def'n and h= `(variable range)/(2)

var:=lhs(L[i,2]); var1:=lhs(rhs(L[i,2])); var2:= rhs(rhs(L[i,2])); h:=(var2-var1)/(N);

#` for function def'n, set e=function`

if type(L[i,1], algebraic) then e:=L[i,1];

#` for polar function r=f(t) create N values of the [cos*r,sin*r] i.e. the equivalent [x,y] values for r valued at N even

# divisions of its range`

if nops(L[i])=3 then P[i]:=seq(subs(var=var1+h*i,[e*cos(var), e*sin(var)]), i=0..N); else

#` for non-polar function y=f(x) create N values of [x,y] for x values at N even divisions of its range`

P[i]:=seq([var1+h*i, subs(var=var1+h*i,e)], i=0..N) fi; else

#` for parametric function [f`(t),g(t)] create N values of [f(t),g(t)] for t values at N even divisions of its range.

e1:=L[i,1,1]; e2:=L[i,1,2];

#` P`[i]:=seq(subs(var=var1+i*h,[e1, e2]), i=0..N):

P[i]:=seq([subs(var=var1+i*h,e1), subs(var=var1+i*h,e2),0], i=0..N) fi; fi; od; #` MODIFIED FOR 3 D `[f(t), g(t), 0]

Q:=[seq(P[i], i=1..nops(L))];

Border:=plottools[curve]([op(Q), Q[1]], op(Boundary));

#` the shaded figure is a polygon whose vertices are Q, whose interior color is C`

#` return a list of the polygon and its border`

[plottools[polygon](Q, C), Border];

end proc:

L := [[[0, 0, 0], [0, 1, 0]], [[x, x^2+1, 0], x = 0 .. 2], [[2, 5, 0], [2, 2, 0]], [[x, x, 0], x = 2 .. 0]]:

plots[display](Picture(L, color = yellow), axes = normal, scaling = constrained)