首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >有翼边缘与半边

有翼边缘与半边
EN

Stack Overflow用户
提问于 2015-12-31 23:08:49
回答 1查看 2.4K关注 0票数 4

我试图理解边界表示(B-rep),但我找不到半边数据结构相对于有翼边数据结构的优势。我在this book中发现,有翼边不能表示空间中有顶点但没有边的状态。但是没有样本。

Another book说,在边缘方向上有一个模糊性。

最后,在this web page上,调用性能原因。

EN

回答 1

Stack Overflow用户

发布于 2016-01-03 16:17:36

我已经在this paper中找到了解决方案。

有了winged-edge,你就得到了这样的数据结构:

C#中的代码如下:

代码语言:javascript
复制
public class WingedEdge
{
    public Curve3d Curve { get; set; }

    /// <summary>
    /// Edge of the left loop starting on the end vertex of this edge.
    /// </summary>
    public Edge EndLeftEdge { get; set; }

    /// <summary>
    /// Edge of the right loop starting on the end vertex of this edge.
    /// </summary>
    public Edge EndRightEdge { get; set; }

    /// <summary>
    /// Vertex on the end point of the edge.
    /// </summary>
    public Vertex EndVertex { get; set; }

    /// <summary>
    /// Face on the left side of the edge.
    /// </summary>
    public Face LeftFace { get; set; }

    /// <summary>
    /// Face on the right side of the edge.
    /// </summary>
    public Face RightFace { get; set; }

    /// <summary>
    /// Edge of the left loop ending on the start vertex of this edge.
    /// </summary>
    public Edge StartLeftEdge { get; set; }

    /// <summary>
    /// Edge of the right loop ending on the start vertex of this edge.
    /// </summary>
    public Edge StartRightEdge { get; set; }

    /// <summary>
    /// Vertex on the start point of the edge.
    /// </summary>
    public Vertex StartVertex { get; set; }
}

在face上,你只需要存储其中一个边界边,当结构形成一个双向链表时,你可以检索到其他边:

代码语言:javascript
复制
public class Face
{
    /// <summary>
    /// One of the edges bounding this face.
    /// </summary>
    public WingedEdge FirstEdge { get; set; }
}

但是如果你需要迭代一个面的边缘,你可以使用下面的代码:

代码语言:javascript
复制
WingedEdge edge = face.FirstEdge;
do {
  // Do something with the edge
  WingedEdge edge = edge.LeftFace == face ? edge.LeftNextEdge : edge.RightNextEdge;
} while (edge != face.FirstEdge)

我们必须在循环中使用条件表达式(?:)来查找下一条边。在现代处理器上,这会导致性能下降,正如in this post所描述的那样。

半边数据结构没有这个问题(但需要更多的内存)。

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34548207

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档