本文介绍了线剪裁到arbitary 2D多边形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

人,如果我得到的线段这是足够长,以跨越一个给定的多边形,它可以是凹的或凸多边形。我怎么觉得这是包含在多边形所有相交光部分?

guys,If I get a line segment which was long enough to cross a given polygon, which could be concave or convex polygon. How did I find the all the intersected light segments which was contained in the polygon?

如果目标区域不是多边形,但隐含的曲线函数或样条曲线,该怎么办呢?

If the target region is not polygon, but a implicit curve function or spline curve, how to do it?

谢谢!

推荐答案

真的没有一个简单的解决你的问题,特别是与曲线(贝济耶和样条曲线)。在多边形裁剪的复杂性上面,有个相当大的挑战重建截取曲线(假设你要剪辑的结果仍然是贝济耶和样条曲线,而不仅仅是'扁平化'线近似)。

There really isn't a simple solution to your problem, especially with curves (beziers and splines). On top of the complexities of polygon clipping, there's the considerable challenge of reconstructing the clipped curves (assuming you want the clipping result to remain as beziers and splines and not just 'flattened' line approximations).

我最近发布了一个测试版更新*我的多边形裁剪库快船这确实做线面和线线裁剪(其中线可曲线太)。然而,当主库是用Delphi编写的,C ++和放大器; C#,新的测试版code是至今只在德尔福可能帮不了你。不过,如果你看一下code,你就会明白为什么我的状态没有简单的解决方案。

I have recently released a beta update* to my polygon clipping library 'Clipper' that does do line-polygon and line-line clipping (where lines can be curves too). However, while the main library is written in Delp C++ & C#, the new beta code is so far only in Delphi which may not help you. Nevertheless if you look at the code you'll see why I state there's no 'simple' solution.

  • 编辑2011年7月15日:这种更新从来没有超过这个beta版本,现在是简单的证明性的概念。它现在是基于一个旧版本我的帆船库,并需要一个重大改写为维护和扩展。 (在某个阶段我会再讲,但我现在打算进一步提高核心库。)然而,概念证明型的特尔斐code可下载的
  • Edit 15 Jul 2011:This 'update' never got beyond this beta release and is now simply 'proof-of-concept'. It is now based on an old version of my Clipper library and would need a major rewrite to be maintainable and extensible. (At some stage I may revisit it but I'm currently intent on further improving the core library.) Nevertheless, this 'proof-of-concept' Delphi code can be downloaded here

这篇关于线剪裁到arbitary 2D多边形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 20:29