我在使用 Windows xp 的 Matlab 2010b 中绘制补丁时遇到了一些奇怪的问题。
当我尝试绘制以下补丁时,我得到的补丁不是全部填充,而是有一些空白部分。
如果我将渲染器设置为“画家”(见下文),这可以解决,
但是我不能改变补丁的透明度。
有没有人遇到过类似的问题?任何解决方法?
x = [734608.791666667;734608.843750000;734609;734609.041666667;734609.086805556;734609.125000000;734609.250000000;734609.277777778;];
y = [85.7847149493030;95.4499999983124;96.4800000077516;112.549999984098;109.949999996456;118.299999970804;120.450000002981;112.600000008944;];
figure;
set(gcf, 'Renderer', 'opengl');
patch(x, y, 'r');
title('this plot is with wrong vertices positions');
figure;
set(gcf, 'Renderer', 'painters');
patch(x, y, 'r', 'FaceAlpha', 0.1);
title('this plot is OK, but renderer ignores the transparency');
figure;
set(gcf, 'Renderer', 'opengl');
patch(x, y, 'r', 'FaceAlpha', 0.1);
title('this plot is with wrong vertices positions, but with transparency');
问题似乎源自 MATLAB -> OpenGL 渲染管道某处的浮点精度(我的猜测)。
如果你操纵 x 来:
x = [734608.791666667;734608.843750000;734609;734609.041666667;734609.086805556;734609.125000000;734609.250000000;734609.277777778;];
x = (x - mean(x));
这些情节似乎工作正常。
我是一名优秀的程序员,十分优秀!