几何公共线去除 [英] Geometric Common Line Removal

查看:54
本文介绍了几何公共线去除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这确实不是这个地方,但是由于此站点一直不错"
过去对我来说,我以为我将从这里开始.我正在寻找常用线移除"
算法.我有一个类似于拼图的物体,其中每一块都是不同的颜色
并可能与周围的部分共享一个边缘段.

我想做的是边缘共享公共边界线的地方
(在公差范围内)使每个片段的边界段相同.我已经搜索过
但我没有发现任何值得的东西.有什么想法吗?

TIA

I know this is really not the place for this but since this site has been "good"
to me in the past I thought I’d start here. I’m looking for a "common line removal"
algorithm. I have objects similar to a puzzle where each piece is a different color
and possibly shares an edge segment(s) with the surrounding pieces.

What I would like to do is where the edges share a common boundary segment
(within a tolerance) make each piece’s bounding segment the same. I’ve searched
but I have not found anything worthwhile. Any ideas?

TIA

推荐答案

这是看不见的线条去除"吗?我总是尽管这个问题是人为的,在大多数情况下不应该解决.该问题可能很困难,并非总是可以解决(例如,由于共享线段的问题及其对共享区域的像素大小附近的影响);同时,与付出的努力相比,该解决方案的好处可能是惨痛的.

(另外,请记住,现实生活中没有线条,它们都是虚构的.在逼真的图像渲染中也没有线条.因此,如果在简化图片中显示线条,则它们是理想数学对象的象征性反映. ,而不是逼真的渲染模型,因此您可能不想太过喜欢点赞.您只需要清晰可辨的图片即可.)

这是主意.如果该线不可见,那是因为它被更靠近观众的对象遮盖了.在2D情况下,您需要保持Z轴顺序以将物体拉近其他物体上方的观众.在3D情况下,它有点复杂,但是从本质上讲,这与Z顺序相同;您需要根据相机"的位置订购对象.顺便说一句,我是用3D格式完成的,并且在性能方面没有问题.换句话说:您必须画出全部或部分看不见"的线条;放在这些行顶部的对象将覆盖它们.

唯一的问题是性能,但在大多数情况下并不重要.您可能会通过尝试找到更复杂的解决方案来浪费更多的CPU时间.无论如何,即使您要防止过度渲染(是的,我的解决方案都基于过度渲染),您也应该将不可见线条"问题视为一种优化,而不是渲染问题.

为了防止闪烁,您需要使用双缓冲.为了提高性能,您需要部分失效(使用Windows GDI,InvalidateRectInvalidateRgn).

—SA
Is this "invisible line removal"? I always though this problem is artificial and should not be solved in most cases. The problem can be difficult, not always solvable (for example, due to the problems of the shared line segment and its affect of pixel-size vicinity of the shared area); at the same time, the benefits of the solution can be miserable when compared with the effort.

(Also, remember, there are no lines in real life, they are all imaginary. In photo-realistic quality of rendering there no lines, too. So, if you show lines in your simplified picture, they are symbolic reflection of ideal mathematical object, not the realistic rendering model, so you may want not too take likes too seriously. You merely need a clear recognizable picture.)

Here is the idea. If the line is invisible, this is because it is masked by the object which is closer to the spectator. In 2D case, you need to keep Z-order to draw objects closer to the spectator on top of the others. In 3D case it''s a bit more complex, but essentially, this is the same is Z-order; you need to order objects according to the position of the "camera". I did it in 3D and had no problems with performance, by the way. In other words: you have to draw all or some of the "invisible" lines; the objects placed on top of those line will cover them.

The only problem is performance, but it is not significant in most cases; you may loose more CPU time by trying to find a more complex solution. Anyway, even if you want to prevent excessive rendering (yes, my solution is based on excessive rendering), you should consider the problem of "invisible lines" as optimization one, not rendering.

To prevent flicker you need to use double-buffering; to improve performance, you need partial invalidation (with Windows GDI, InvalidateRect or InvalidateRgn).

—SA


您可以为一条折线中的所有线段创建多边形缓冲区.然后遍历另一条折线中的线段,查看它们是否在缓冲区内.这是地理信息系统中的一个常见问题,并且可能在该地方有开源代码.

祝你好运
You can create polygon buffer zones for all the segments in one polyline. Then traverse the segments in the other polyline, and see if they are inside the buffers. This is a common problem in geographical information systems, and there is probably open source code for this somwhere.

Good luck


这篇关于几何公共线去除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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