The boundaries of the overlap of transparent objects disappear

I need to display several thousand transparent objects on a figure in MATLAB, each with its frame. However, when I use the fill to build objects, the borders in the intersection interiors are somehow covered by transparent objects, even if one of the objects is on top. Here is a sample code that shows the behavior that I have in mind:

t = linspace(0,2*pi,100);
s = linspace(0,2*pi,50);

eps = .35;

f = figure;
hold on;
c = [1.0 0.5 0.0];

for i = 1:1:length(s)
    x = eps*cos(t)+cos(s(i));
    y = eps*sin(t)+sin(s(i));
    fill(x,y,c,'EdgeColor','k','LineWidth',1,'facealpha',.25);
end

As you can see, the boundaries of the circles that are inside are weaker than the borders on the outside. What I expect to see is the very front circle, which has a completely black border and the very back circle, which has the most transparent frame on the inside.

Example

- , , ? , , , ?

+4
1

ZData fill:

for i = 1:1:length(s)
    x = eps*cos(t)+cos(s(i));
    y = eps*sin(t)+sin(s(i));
    z = ones(size(x))*i;
    h=fill(x,y,c,'EdgeColor','k','LineWidth',1,'facealpha',.25);
    set(h,'ZData',z);
end

enter image description here

+1

Source: https://habr.com/ru/post/1541773/


All Articles