Search Results for

    Show / Hide Table of Contents

    Class PointHashGrid2d<T>

    Hash Grid for 2D points. You provide the 'point' type. If you have an indexable set of points this can just be int, or can be more complex point data structure (but be careful w/ structs...)

    Does not actually store 2D points. So, to remove a point you must also know it's 2D coordinate, so we can look up the cell coordinates. Hence, to 'update' a point, you need to know both it's old and new 2D coordinates.

    Inheritance
    Object
    PointHashGrid2d<T>
    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 PointHashGrid2d<T>
    Type Parameters
    Name Description
    T

    Constructors

    PointHashGrid2d(Double, T)

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

    Declaration
    public PointHashGrid2d(double cellSize, T invalidValue)
    Parameters
    Type Name Description
    Double cellSize
    T invalidValue

    Properties

    InvalidValue

    Declaration
    public T InvalidValue { get; }
    Property Value
    Type Description
    T

    Methods

    FindNearestInRadius(Vector2d, Double, Func<T, Double>, Func<T, Boolean>)

    Find nearest point in grid, within radius, without locking / thread-safety You must provided distF which returns distance between query_pt and the point argument You can ignore specific points via ignoreF lambda

    Declaration
    public KeyValuePair<T, double> FindNearestInRadius(Vector2d query_pt, double radius, Func<T, double> distF, Func<T, bool> ignoreF = null)
    Parameters
    Type Name Description
    Vector2d query_pt
    Double radius
    Func<T, Double> distF
    Func<T, Boolean> ignoreF
    Returns
    Type Description
    KeyValuePair<T, Double>

    InsertPoint(T, Vector2d)

    Insert point at position. This function is thread-safe, uses a SpinLock internally

    Declaration
    public void InsertPoint(T value, Vector2d pos)
    Parameters
    Type Name Description
    T value
    Vector2d pos

    InsertPointUnsafe(T, Vector2d)

    Insert point without locking / thread-safety

    Declaration
    public void InsertPointUnsafe(T value, Vector2d pos)
    Parameters
    Type Name Description
    T value
    Vector2d pos

    RemovePoint(T, Vector2d)

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

    Declaration
    public bool RemovePoint(T value, Vector2d pos)
    Parameters
    Type Name Description
    T value
    Vector2d pos
    Returns
    Type Description
    Boolean

    RemovePointUnsafe(T, Vector2d)

    Remove point without locking / thread-safety

    Declaration
    public bool RemovePointUnsafe(T value, Vector2d pos)
    Parameters
    Type Name Description
    T value
    Vector2d pos
    Returns
    Type Description
    Boolean

    UpdatePoint(T, Vector2d, Vector2d)

    Move point from old to new position. This function is thread-safe, uses a SpinLock internally

    Declaration
    public void UpdatePoint(T value, Vector2d old_pos, Vector2d new_pos)
    Parameters
    Type Name Description
    T value
    Vector2d old_pos
    Vector2d new_pos

    UpdatePointUnsafe(T, Vector2d, Vector2d)

    Move point from old to new position without locking / thread-safety

    Declaration
    public void UpdatePointUnsafe(T value, Vector2d old_pos, Vector2d new_pos)
    Parameters
    Type Name Description
    T value
    Vector2d old_pos
    Vector2d new_pos
    In This Article
    Back to top ViRGIS VR GIS