I've got a program which plots 2 graphs(Sin[x]
and Log[y]
) and 2 lists of rectangles(built from lists of numbers spx
,spy
) in accordance. Prompt, please, how to get the interval (or even the rectangle) andwhere these rectangles overlap?
spx = {-1, -0.75, -0.5 , -0.35, -0.25 , 0, 0.3, 0.775 , 0.95 , 1.55 ,
1.6, 2.325 , 2.375 , 3.1, 3.825, 3.925, 4.55 , 4.7, 5.275 , 5.35,
5.675 , 6};
spy = {1, 2.25, 3.5, 4.75, 6}
g1 = Graphics[{EdgeForm[{Black, Thick}], {Pink, Opacity[0.7],
Table[Rectangle[{spx[[i]],
Sin[spx[[i]]] + Cos[spx[[i]]]}, {spx[[i + 1]],
Sin[spx[[i + 1]]] + Cos[spx[[i + 1]]]}], {i, 1,
Length[spx] - 1}]}}, Axes -> True];
g2 = Plot[{Sin[x]}, {x, -1, 6}, PlotStyle -> Thick];
g3 = Graphics[{EdgeForm[{Black, Thick}], {Yellow, Opacity[0.7],
Table[Rectangle[{spy[[i]], Log[spy[[i]]]}, {spy[[i + 1]],
Log[spy[[i + 1]]]}], {i, 1, Length[spy] - 1}]}}, Axes -> True];
g4 = Plot[{Log[y]}, {y, 1, 6}, PlotStyle -> Thick];
lift = {{x_Real, y_Real} :> {z, y, x}, Rectangle :> Cuboid};
lifted1 = N[g1] /. lift;
lifted2 = N[g2] /. lift;
lifted3 = N[g3] /. lift;
lifted4 = N[g4] /. lift;
zlevelI = 0;
zlevel[] := (zlevelI = zlevelI + .001);
Show[Graphics3D @@ (lifted1 /. z :> 0),
Graphics3D @@ (lifted2 /. z :> 1 + zlevel[]),
Graphics3D @@ (lifted3 /. z :> 0),
Graphics3D @@ (lifted4 /. z :> 1 + zlevel[])]![enter image description here][1]