【问题标题】:Problem with patch transparency (FaceAlpha)补丁透明度问题(FaceAlpha)
【发布时间】:2011-09-06 10:04:59
【问题描述】:

我在 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');

【问题讨论】:

  • +1 确实很奇怪。我想知道它是否也可以在 Mac/Linux 上重现(您可能应该将此作为错误提交给 MathWorks)

标签: matlab opengl rendering


【解决方案1】:

问题似乎源于 MATLAB -> OpenGL 渲染管道某处的浮点精度(我的猜测)。

如果您将 x 操作为:

x = [734608.791666667;734608.843750000;734609;734609.041666667;734609.086805556;734609.125000000;734609.250000000;734609.277777778;];
x = (x - mean(x));

情节似乎运作良好。

【讨论】:

  • 确实有效。由于 x 值实际上是 datenums,因此我使用 x = x-floor(min(x)) 代替。谢谢!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-09-29
  • 2013-01-24
  • 2013-06-21
相关资源
最近更新 更多