Search Results for

    Show / Hide Table of Contents

    Class TriangleBinsGrid2d

    This class is a spatial data structure for 2D triangles. It is intended for point-containment and box-overlap queries. It does not store the triangles, only indices, so you must pass in the triangle vertices to add/remove functions, similar to PointHashGrid2d.

    However, unlike the hash classes, this one is based on a grid of "bins" which has a fixed size, so you must provide a bounding box on construction. Each triangle is inserted into every bin that it overlaps.

    [TODO] currently each triangle is inserted into every bin that it's bounding box overlaps. Need conservative rasterization to improve this. Can implement by testing each bin bbox for intersection w/ triangle

    Inheritance
    Object
    TriangleBinsGrid2d
    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 class TriangleBinsGrid2d

    Constructors

    TriangleBinsGrid2d(AxisAlignedBox2d, Int32)

    "invalid" value will be returned by queries if no valid result is found (eg bounded-distance query)

    Declaration
    public TriangleBinsGrid2d(AxisAlignedBox2d bounds, int numCells)
    Parameters
    Type Name Description
    AxisAlignedBox2d bounds
    Int32 numCells

    Properties

    Bounds

    Declaration
    public AxisAlignedBox2d Bounds { get; }
    Property Value
    Type Description
    AxisAlignedBox2d

    Methods

    FindContainingTriangle(Vector2d, Func<Int32, Vector2d, Boolean>, Func<Int32, Boolean>)

    Find triangle that contains point. Not thread-safe. You provide containsF(), which does the containment check. If you provide ignoreF(), then tri is skipped if ignoreF(tid) == true

    Declaration
    public int FindContainingTriangle(Vector2d query_pt, Func<int, Vector2d, bool> containsF, Func<int, bool> ignoreF = null)
    Parameters
    Type Name Description
    Vector2d query_pt
    Func<Int32, Vector2d, Boolean> containsF
    Func<Int32, Boolean> ignoreF
    Returns
    Type Description
    Int32

    FindTrianglesInRange(AxisAlignedBox2d, HashSet<Int32>)

    find all triangles that overlap range

    Declaration
    public void FindTrianglesInRange(AxisAlignedBox2d range, HashSet<int> triangles)
    Parameters
    Type Name Description
    AxisAlignedBox2d range
    HashSet<Int32> triangles

    InsertTriangle(Int32, ref Vector2d, ref Vector2d, ref Vector2d)

    Insert triangle. This function is thread-safe, uses a SpinLock internally

    Declaration
    public void InsertTriangle(int triangle_id, ref Vector2d a, ref Vector2d b, ref Vector2d c)
    Parameters
    Type Name Description
    Int32 triangle_id
    Vector2d a
    Vector2d b
    Vector2d c

    InsertTriangleUnsafe(Int32, ref Vector2d, ref Vector2d, ref Vector2d)

    Insert triangle without locking / thread-safety

    Declaration
    public void InsertTriangleUnsafe(int triangle_id, ref Vector2d a, ref Vector2d b, ref Vector2d c)
    Parameters
    Type Name Description
    Int32 triangle_id
    Vector2d a
    Vector2d b
    Vector2d c

    RemoveTriangle(Int32, ref Vector2d, ref Vector2d, ref Vector2d)

    Remove triangle. This function is thread-safe, uses a SpinLock internally

    Declaration
    public void RemoveTriangle(int triangle_id, ref Vector2d a, ref Vector2d b, ref Vector2d c)
    Parameters
    Type Name Description
    Int32 triangle_id
    Vector2d a
    Vector2d b
    Vector2d c

    RemoveTriangleUnsafe(Int32, ref Vector2d, ref Vector2d, ref Vector2d)

    Remove triangle without locking / thread-safety

    Declaration
    public void RemoveTriangleUnsafe(int triangle_id, ref Vector2d a, ref Vector2d b, ref Vector2d c)
    Parameters
    Type Name Description
    Int32 triangle_id
    Vector2d a
    Vector2d b
    Vector2d c
    In This Article
    Back to top ViRGIS VR GIS