翼缘vs半边缘

Max*_*nce 4 topology cad brep

我尝试理解边界表示(B-rep),我找不到半边数据结构与翼边数据结构的优点.我在本书中发现,边缘不能代表空间中存在顶点但没有边缘的状态.但是没有样品.

另一本书说边缘方向存在模糊性.

最后,在此网页上,调用了性能原因.

Max*_*nce 5

我在本文中找到了解决方案.

有了边缘,你就有了这个数据结构:

在此输入图像描述

C#中的代码如下:

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; }
}
Run Code Online (Sandbox Code Playgroud)

在面上,您只需要存储一个边界边,因为结构形成一个双链表,您可以检索其他边:

public class Face
{
    /// <summary>
    /// One of the edges bounding this face.
    /// </summary>
    public WingedEdge FirstEdge { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

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

WingedEdge edge = face.FirstEdge;
do {
  // Do something with the edge
  WingedEdge edge = edge.LeftFace == face ? edge.LeftNextEdge : edge.RightNextEdge;
} while (edge != face.FirstEdge)
Run Code Online (Sandbox Code Playgroud)

我们必须在循环中使用条件表达式(?:)来查找下一个边缘.在现代的处理器,这会导致性能的下降,如描述在这个岗位.

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