Class HalfEdgeGraph2d
Represents a 2D Graph with Half-edge connectivity, useful for finding polygons bounded by intersecting or overlapping edges.
Inheritance
Inherited Members
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. |
Vertices
The unique vertices of this graph
Declaration
public List<Vector3> Vertices { get; set; }
Property Value
Type | Description |
---|---|
System. |
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
Returns
Type | Description |
---|---|
Half |
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. |
lines | The line segments from which to construct the graph. |
System. |
bothWays | If true, each line will create two half edges — one running each way. |
Returns
Type | Description |
---|---|
Half |
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. |
pg | The polygons. |
System. |
pl | The polylines. |
Returns
Type | Description |
---|---|
Half |
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. |
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. |
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. |
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. |
A collection of polylines. |