Here is a possible solution, using fsolve to find the intersection point between two piecewise affine parametric curves (x_1(n),y_1(n)) and (x_2(n),y_2(n)). The equations to fullfill are
\begin{align}
x_1(n_1)-x_2(n_2) &=0,\\
y_1(n_1)-y_2(n_2) &=0,\\
\end{align}
where n_1 \in [1,N_1] and n_2 \in [1,N_2] and N_1,N_2 are the number of edges of each curve. Integer values of the parameter match the edges and between these, points continuously move on the segments. In the below code we use Scilab’s interpln() to compute the coordinates. After fsolve() has converged we get non-integer values n_1,n_2 and we use floor() and ceil() functions to identify the actual segments where the crossing occurs. Then both splitted parts of the curves are joined in the the correct order (I have added arrows in the plot that helps to understand the chosen order) to fill the polygons.
function eq=f(n)
eq = [
interpln([1:N1;x1],n(1))-interpln([1:N2;x2],n(2))
interpln([1:N1;y1],n(1))-interpln([1:N2;y2],n(2))
]
endfunction
//build two parametric curves (x1,y1) and (x2,y2)
t1=linspace(0,%pi/3,15);
x1=sin(t1);
y1=cos(t1);
t2=linspace(%pi/3,0,10);
x2=1.1-sin(t2)
y2=0.2+cos(t2)
N1 = length(x1);
N2 = length(x2);
clf
plot(x1,y1,x2,y2)
// find the intersection point (xi,yi) using fsolve
[n,f]=fsolve([n1/2;n2/2],f);
xi = interpln([1:N1;x1],n(1));
yi = interpln([1:N1;y1],n(1));
// left polygon
xp1 = [x1(1:floor(n(1))) xi x2(floor(n(2)):-1:1)];
yp1 = [y1(1:floor(n(1))) yi y2(floor(n(2)):-1:1)];
xfpoly(xp1,yp1,color("yellow"))
// right polygon
xp2 = [xi x2(ceil(n(2)):$) x1($:-1:ceil(n(1)))];
yp2 = [yi y2(ceil(n(2)):$) y1($:-1:ceil(n(1)))];
xfpoly(xp2,yp2,color("orange"))
plot(x1,y1,"-o",x2,y2,"-o")
gce().children.polyline_style=4
plot(xi,yi,'or')