在MATLAB R2011b三角形的三维曲面不稳定数据的光标行为 [英] Erratic data cursor behavior for triangulated 3d surfaces in MATLAB R2011b

查看:167
本文介绍了在MATLAB R2011b三角形的三维曲面不稳定数据的光标行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当应用到图3D三角面的我看到从MATLAB R2011b数据光标反常行为。例如用气缸:

I'm seeing erratic behavior from the data cursor in MATLAB R2011b when applied to plots of triangulated 3d surfaces: Clicking on certain points selects completely different points instead. Example with a cylinder:

[r, phi, h] = meshgrid(1, 0:pi/10:2*pi, 0:0.05:1);
x = r.*cos(phi);
y = r.*sin(phi);
z = h;
xyz = [x(:) y(:) z(:)];
tri = delaunay(xyz);
trimesh(tri, xyz(:,1), xyz(:,2), xyz(:,3), ...
        'LineStyle', 'none', 'Marker', '.', 'MarkerSize', 30)
view(-37, 28)

然后启用数据光标模式,并尽量选择在前面的一列的最顶端点。在我的安装,MATLAB不会选择光标下的点,但是你看似随机选择。

Then enable data cursor mode and try to select the topmost dot of one of the columns in front. On my installation, MATLAB does not select the point under the cursor but a different one seemingly chosen at random.

这是一个错误还是我做错了什么?

Is this a bug or am I doing something wrong?

推荐答案

我发现<一个一个地解决这个问题href="http://www.mathworks.com/matlabcentral/fileexchange/26790-overlay-two-datasets-or-indexed-images"相对=nofollow>由Jochen劳一个文件交换的贡献。您可以定义哪些数据是选择通过了的HitTest属性。所以对于我提供的例子,在这里我想只有标记为可选,解决的办法是绘制网格无标记和'的HitTest设置为关闭,然后使用scatter3绘制标记。

I found a solution to this problem in a File Exchange contribution by Jochen Rau. You can define which data is selectable with the data cursor via the 'HitTest' property. So for the example I provided, where I wanted only the markers to be selectable, the solution is to plot the mesh without markers and with 'HitTest' set to 'off' and then use 'scatter3' to plot the markers.

[r, phi, h] = meshgrid(1, 0:pi/10:2*pi, 0:0.05:1);
x = r.*cos(phi);
y = r.*sin(phi);
z = h;
xyz = [x(:) y(:) z(:)];
tri = delaunay(xyz);
figure
hold on
trimesh(tri, xyz(:,1), xyz(:,2), xyz(:,3), ...
        'LineStyle', 'none', 'Marker', 'none', 'HitTest', 'off')
scatter3(xyz(:,1), xyz(:,2), xyz(:,3))
view(-37, 28)

如果你想知道有什么阴谋三角的一点是:它是由模糊是在后面点可视化点云提供帮助。在trimesh呼叫完成这一点,因为它仍然吸引面为白色。

If you're wondering what the point of plotting the triangulation is: it's to aid in visualizing point clouds by obscuring points that are in the back. The 'trimesh' call accomplishes this because it still draws the faces in white.

这篇关于在MATLAB R2011b三角形的三维曲面不稳定数据的光标行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆