Search Results for

    Show / Hide Table of Contents

    Class DGraph2Util

    Utility functions for DGraph2 data structure

    Inheritance
    Object
    DGraph2Util
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: g3
    Assembly: cs.temp.dll.dll
    Syntax
    public static class DGraph2Util

    Methods

    ChainOpenPaths(DGraph2Util.Curves, Double)

    merge members of c.Paths that have unique endpoint pairings. Does not extract closed loops that contain junction vertices, unless the 'other' end of those junctions is dangling. Also, horribly innefficient!

    Declaration
    public static void ChainOpenPaths(DGraph2Util.Curves c, double epsilon = 2.2204460492503131E-16)
    Parameters
    Type Name Description
    DGraph2Util.Curves c
    Double epsilon

    DisconnectJunction(DGraph2, Int32, Double)

    foreach edge [vid,b] connected to junction vertex vid, remove, add new vertex c, and then add new edge [b,c]. Optionally move c a bit back along edge from vid.

    Declaration
    public static void DisconnectJunction(DGraph2 graph, int vid, double shrinkFactor = 1)
    Parameters
    Type Name Description
    DGraph2 graph
    Int32 vid
    Double shrinkFactor

    DisconnectJunctions(DGraph2)

    Find and remove any junction (ie valence>2) vertices of the graph. At a junction, the pair of best-aligned (ie straightest) edges are left connected, and all the other edges are disconnected

    [TODO] currently there is no DGraph2.SetEdge(), so the 'other' edges are deleted and new edges inserted. Hence, edge IDs are not preserved.

    Declaration
    public static int DisconnectJunctions(DGraph2 graph)
    Parameters
    Type Name Description
    DGraph2 graph
    Returns
    Type Description
    Int32

    ExtractCurves(DGraph2)

    Decompose graph into simple polylines and polygons.

    Declaration
    public static DGraph2Util.Curves ExtractCurves(DGraph2 graph)
    Parameters
    Type Name Description
    DGraph2 graph
    Returns
    Type Description
    DGraph2Util.Curves

    FindRayIntersection(Vector2d, Vector2d, out Int32, out Double, DGraph2)

    Declaration
    public static bool FindRayIntersection(Vector2d o, Vector2d d, out int hit_eid, out double hit_ray_t, DGraph2 graph)
    Parameters
    Type Name Description
    Vector2d o
    Vector2d d
    Int32 hit_eid
    Double hit_ray_t
    DGraph2 graph
    Returns
    Type Description
    Boolean

    NextEdgeAndVtx(Int32, Int32, DGraph2)

    If we are at edge eid, which as one vertex prev_vid, find 'other' vertex, and other edge connected to that vertex, and return pair [next_edge, shared_vtx] Returns [int.MaxValue, shared_vtx] if shared_vtx is not valence=2 (ie stops at boundaries and complex junctions)

    Declaration
    public static Index2i NextEdgeAndVtx(int eid, int prev_vid, DGraph2 graph)
    Parameters
    Type Name Description
    Int32 eid
    Int32 prev_vid
    DGraph2 graph
    Returns
    Type Description
    Index2i

    PathLength(DGraph2, IList<Int32>)

    compute length of path through graph

    Declaration
    public static double PathLength(DGraph2 graph, IList<int> pathVertices)
    Parameters
    Type Name Description
    DGraph2 graph
    IList<Int32> pathVertices
    Returns
    Type Description
    Double

    VertexLaplacian(DGraph2, Int32, out Boolean)

    If vid has two or more neighbours, returns uniform laplacian, otherwise returns vid position

    Declaration
    public static Vector2d VertexLaplacian(DGraph2 graph, int vid, out bool isValid)
    Parameters
    Type Name Description
    DGraph2 graph
    Int32 vid
    Boolean isValid
    Returns
    Type Description
    Vector2d

    WalkToNextNonRegularVtx(DGraph2, Int32, Int32)

    walk through graph from fromVtx, in direction of eid, until we hit the next junction vertex

    Declaration
    public static List<int> WalkToNextNonRegularVtx(DGraph2 graph, int fromVtx, int eid)
    Parameters
    Type Name Description
    DGraph2 graph
    Int32 fromVtx
    Int32 eid
    Returns
    Type Description
    List<Int32>
    In This Article
    Back to top ViRGIS VR GIS