Show / Hide Table of Contents

    Class HalfEdgeGraph2d

    Represents a 2D Graph with Half-edge connectivity, useful for finding polygons bounded by intersecting or overlapping edges.

    Inheritance
    System.Object
    HalfEdgeGraph2d
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Elements.Spatial
    Assembly: Hypar.Elements.dll
    Syntax
    public class HalfEdgeGraph2d

    Properties

    EdgesPerVertex

    The index pairs, grouped by starting vertex, representing unique half edges.

    Declaration
    public List<List<(int from, int to, int? tag)>> EdgesPerVertex { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.List<System.Collections.Generic.List<System.ValueTuple<System.Int32, System.Int32, System.Nullable<System.Int32>>>>

    Vertices

    The unique vertices of this graph

    Declaration
    public List<Vector3> Vertices { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.List<Vector3>

    Methods

    Construct(Polygon, Polyline)

    Construct a 2D Half Edge Graph from a polygon and an intersecting polyline.

    Declaration
    public static HalfEdgeGraph2d Construct(Polygon pg, Polyline pl)
    Parameters
    Type Name Description
    Polygon pg

    The polygon.

    Polyline pl

    The polyline.

    Returns
    Type Description
    HalfEdgeGraph2d

    Construct(IEnumerable<Line>, Boolean)

    Construct a 2D half-edge graph from a collection of lines.

    Declaration
    public static HalfEdgeGraph2d Construct(IEnumerable<Line> lines, bool bothWays = false)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<Line> lines

    The line segments from which to construct the graph.

    System.Boolean bothWays

    If true, each line will create two half edges — one running each way.

    Returns
    Type Description
    HalfEdgeGraph2d

    Construct(IEnumerable<Polygon>, IEnumerable<Polyline>)

    Construct a 2D Half Edge Graph from a collection of polygons and a collection of intersecting polylines.

    Declaration
    public static HalfEdgeGraph2d Construct(IEnumerable<Polygon> pg, IEnumerable<Polyline> pl)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<Polygon> pg

    The polygons.

    System.Collections.Generic.IEnumerable<Polyline> pl

    The polylines.

    Returns
    Type Description
    HalfEdgeGraph2d

    Polygonize(Func<Nullable<Int32>, Boolean>, Vector3)

    Calculate the closed polygons in this graph.

    Declaration
    public List<Polygon> Polygonize(Func<int?, bool> predicate = null, Vector3 normal = default(Vector3))
    Parameters
    Type Name Description
    System.Func<System.Nullable<System.Int32>, System.Boolean> predicate

    A predicate used during the final step of polygonization to determine if edges are valid.

    Vector3 normal

    The normal of the plane in which graph traversal for polygon construction will occur. If no normal is provided, the +Z axis is used.

    Returns
    Type Description
    System.Collections.Generic.List<Polygon>

    A collection of polygons.

    Polylinize(Func<Nullable<Int32>, Boolean>, Vector3)

    Calculate the closed polylines in this graph.

    Declaration
    public List<Polyline> Polylinize(Func<int?, bool> predicate = null, Vector3 normal = default(Vector3))
    Parameters
    Type Name Description
    System.Func<System.Nullable<System.Int32>, System.Boolean> predicate

    A predicate used during the final step of polylinization to determine if edges are valid.

    Vector3 normal

    The normal of the plane in which graph traversal for polyline construction will occur. If no normal is provided, the +Z axis is used.

    Returns
    Type Description
    System.Collections.Generic.List<Polyline>

    A collection of polylines.