Thursday, March 14, 2013

How to Jam an Arrangement_2 into a General_polygon_set_2

I spent about three hours yesterday tracking down a weird bug in CGAL - I have code that builds a general polygon set out of an
 arrangement, exports the polygons, and weirdly the polygons had duplicate points.  This is an impossibility for a valid arrangement.

昨天我花了近3个小时追踪一个怪异的CGAL的bug——我写那个程序是为了从arrangement中构建出多边形的集合,然后导出这些多边形,而奇怪的多边形

会有反复点。但在有效的arrangement里这是不可能的。

To my annoyance, I discovered today as I went to write the bug up that I knew about this bug...over three
years ago
. :-(  I get annoyed when I search for the answer to an obscure OpenGL problem and find my own post (e.g. I'm not going to find anything I didn't already know), but it's even more annoying to waste hours on the bug and then have that happen.
让我气愤只是的是,我今天去记录这个问题是发现我事实上在三年前就遇到过了。:-(当我搜索明显的OpengGL问题然后发现了自己的博文(我不会找到不论什么我不知道的)。可是更令人火大的是我居然花了数小时调代码并产生这个错误。
Basically if you are going to build a general polygon set by providing a pre-built arrangement, there are two things you must do:

  • Remove redundant edges - the GPS code assumes that the arrangement doesn't have needless edges (which will screw up traversal).  Fortunately, the GPS code has a utility to do this, which I just call.
  • Then you have to ensure that the direction of the underlying curves along the various edges are consistent - that is, for a given counter-clockwise boundary, every underlying curve goes either with or against the edge.

(After redundant edge removal, the arrangement will contain no antennas, so it will always be possible to get consistency on both sides of a CCB.)
基本上,假设你要从一个预先构建的arrangement中拿出通用多边形集合。有两件事必须做:

         移除冗余边——GPS代码默认arrangement不须要的边(它们会搞乱遍历过程)幸运的是GPS码有一个辅助函数供我调用帮助完毕这一工作。
         然后你必须确保作为各边基线的曲线的方向是连续的——即给定顺时针方向的边界,每个基础曲线都顺着或逆向于该边界。

I wrote code to enforce this second condition by flipping the curve of any halfedge where (1) the curve goes against the halfedge and (2) the halfedge is adjacent to the "contained" side of the map.

With this, polygon set operations work on arbitrary map input.

Why Did You Try This?

Forcing pre-made arrangements into polygon sets requires sub-classing the general polygon set template instantiation to get direect access to things like the arrangement, and it's not particularly safe. 
It also requires your arrangement to have the containment flag on the face data mixed in.  Why go to the trouble?  I did this for two reasons:
  • Sometimes the polygonal set data I want to process came from an arrangement, and that arrangement is fairly huge.  Having to construct the arrangement out of polygons the normal way requires geometry tests - topology data would be lost and rediscovered. 
    For big maps this is really performance-painful.
  • I have some operations that work on arrangements that are precursors to boolean sets. For example, the airport surface area data are fundamentally polygon sets (e.g. in the set is the airport surface area) but some of the constructive processing (e.g. simplifying
    the contour) run on arrangements.

When an arrangement is turned into a polygon set, one of the results is a rather drastic map cleaning.  Since the polygon set cares only about containment (what points are in, what are out), random features like roads tend to get blown away.

Posted by Benjamin Supnik at 12:20
PM
 

怎样将Arranged_2压入General_Polygon_set_2中的更多相关文章

  1. 面试 16:栈的压入压出队列(剑指 Offer 第 22 题)

    我们今天继续来看看周五留下的习题: 面试题:输入两个整数序列,第一个序列表示栈的压入顺序,请判断二个序列是否为该栈的弹出顺序.假设压入栈的所有数字均不相等.例如:压入序列为{1,2,3,4,5},那{ ...

  2. 剑指offer(21)栈的压入、弹出序列

    题目描述 输入两个整数序列,第一个序列表示栈的压入顺序,请判断第二个序列是否为该栈的弹出顺序.假设压入栈的所有数字均不相等.例如序列1,2,3,4,5是某栈的压入顺序,序列4,5,3,2,1是该压栈序 ...

  3. 《剑指offer》-栈的压入、弹出序列

    输入两个整数序列,第一个序列表示栈的压入顺序,请判断第二个序列是否为该栈的弹出顺序.假设压入栈的所有数字均不相等.例如序列1,2,3,4,5是某栈的压入顺序,序列4,5,3,2,1是该压栈序列对应的一 ...

  4. 剑指offer-第四章解决面试题的思路(栈的压入和弹出序列)

    题目:输入两个整数序列,第一个序列表示栈的压入序列,请判断第二个序列是否为弹出序列. 思路:定义两个指针sPush和sPop分别指向两个整数序列的开头,借助一个辅助的栈,将第一个序列的数据依次压入栈中 ...

  5. 【剑指Offer】21、栈的压入、弹出序列

      题目描述:   输入两个整数序列,第一个序列表示栈的压入顺序,请判断第二个序列是否可能为该栈的弹出顺序.假设压入栈的所有数字均不相等.例如序列1,2,3,4,5是某栈的压入顺序,序列4,5,3,2 ...

  6. 剑指Offer-21.栈的压入、弹出序列(C++/Java)

    题目: 输入两个整数序列,第一个序列表示栈的压入顺序,请判断第二个序列是否可能为该栈的弹出顺序.假设压入栈的所有数字均不相等.例如序列1,2,3,4,5是某栈的压入顺序,序列4,5,3,2,1是该压栈 ...

  7. 剑指offer31----栈的压入、弹出序列

    题目:输入两个整数序列,第一个序列表示栈的压入顺序,请判断第二个序列是否为该栈的弹出顺序.假设压入栈的所有数字均不相等.例如序列1,2,3,4,5是某栈的压入顺序,序列4,5,3,2,1是该压栈序列对 ...

  8. 剑指Offer面试题:20.栈的压入、弹出序列

    一.题目:栈的压入.弹出序列 题目:输入两个整数序列,第一个序列表示栈的压入顺序,请判断第二个序列是否为该栈的弹出顺序.假设压入栈的所有数字均不相等.例如序列1.2.3.4.5是某栈的压栈序列,序列4 ...

  9. 剑指Offer:面试题22——栈的压入,弹出序列(java实现)

    题目描述: 输入两个整数序列,第一个序列表示栈的压入顺序,请判断第二个序列是否为该栈的弹出顺序.假设压入栈的所有数字均不相等.例如序列1,2,3,4,5是某栈的压入顺序,序列4,5,3,2,1是该压栈 ...

随机推荐

  1. 针对16v554(ttyS0-15)的ttyAT0的login配置

    1 ## /etc/inittab# console::sysinit:/etc/init.d/rcSconsole::respawn:/sbin/getty -L 115200 ttyAT0 vt1 ...

  2. Jquery右下角消息提示框

    找了好久,终于找到一个不错的提示框jquery,免费给大家一起用下吧(可是花了我很多积分哦),顺便重写了一下样式,原来的样式真的不敢恭维啊... 下载地址:http://files.cnblogs.c ...

  3. 同过增强Connection类[重写了close的方法]实现的从连接池取出连接并放回连接的简单的实现流程

    package tk.dong.connection.util; import java.io.IOException;import java.io.InputStream;import java.i ...

  4. 关于Unity的C#基础学习(一)

    一.程序包含 1.数据:运行过程中产生的 2.代码:代码指令 数据和代码都是存放到内存中的,代码指令在程序加载的时候放到内存,数据是在程序运行的时候在内存中动态地生成,随时会被回收,要定义变量来存放数 ...

  5. 【NOIP模拟题】Permutation(dp+高精度)

    首先我们可以这样想: 设状态f[i, j]表示1-i序列有j个'<'的方案数 那么考虑转移 因为i比i-1大,所以可以考虑从i-1来转移.首先i是要插入1-i-1这个序列的,所以我们可以思考插入 ...

  6. c#并行扫描端口控制台程序

    static void Main(string[] args) { Console.WriteLine("请输入ip"); string ip = Console.ReadLine ...

  7. hrbustoj 1142:围困(计算几何基础题,判断点是否在三角形内)

    围困 Time Limit: 1000 MS     Memory Limit: 65536 K Total Submit: 360(138 users) Total Accepted: 157(12 ...

  8. SqlAlchemy使用详解

    python之sqlalchemy创建表的实例详解 通过sqlalchemy创建表需要三要素:引擎,基类,元素 from sqlalchemy import create_engine from sq ...

  9. JavaScript 事件循环 — event loop

    引言 相信所有学过 JavaScript 都知道它是一门单线程的语言,这也就意味着 JS 无法进行多线程编程,但是 JS 当中却有着无处不在的异步概念 .在初期许多人会把异步理解成类似多线程的编程模式 ...

  10. 类库服务寄宿到WebHost

    1.该Demo中包含一个类库项目.一个空的WebForm项目 2.新建WebForm项目 3.全局路由中注册类库服务 public class Global : System.Web.HttpAppl ...