Class PointHashGrid3d<T>
Hash Grid for 3D 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 3D points. So, to remove a point
you must also know it's 3D coordinate, so we can look up the cell coordinates.
Hence, to 'update' a point, you need to know both it's old and new 3D coordinates.
TODO: if a lot of points are in the same spot, this is still a disaster.
What if we had a second level of hashing, where once a list at a level gets too
big, we build a sub-hash there?
Inheritance
PointHashGrid3d<T>
Namespace: g3
Assembly: cs.temp.dll.dll
Syntax
public class PointHashGrid3d<T>
Type Parameters
Constructors
PointHashGrid3d(Double, T)
"invalid" value will be returned by queries if no valid result is found (eg bounded-distance query)
Declaration
public PointHashGrid3d(double cellSize, T invalidValue)
Parameters
Type |
Name |
Description |
Double |
cellSize |
|
T |
invalidValue |
|
Properties
InvalidValue
Declaration
public T InvalidValue { get; }
Property Value
Methods
FindNearestInRadius(Vector3d, 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.
returned key is InvalidValue if not found
Declaration
public KeyValuePair<T, double> FindNearestInRadius(Vector3d query_pt, double radius, Func<T, double> distF, Func<T, bool> ignoreF = null)
Parameters
Returns
InsertPoint(T, Vector3d)
Insert point at position. This function is thread-safe, uses a SpinLock internally
Declaration
public void InsertPoint(T value, Vector3d pos)
Parameters
Type |
Name |
Description |
T |
value |
|
Vector3d |
pos |
|
InsertPointUnsafe(T, Vector3d)
Insert point without locking / thread-safety
Declaration
public void InsertPointUnsafe(T value, Vector3d pos)
Parameters
Type |
Name |
Description |
T |
value |
|
Vector3d |
pos |
|
print_large_buckets()
Declaration
public void print_large_buckets()
RemovePoint(T, Vector3d)
Insert point. This function is thread-safe, uses a SpinLock internally
Declaration
public bool RemovePoint(T value, Vector3d pos)
Parameters
Type |
Name |
Description |
T |
value |
|
Vector3d |
pos |
|
Returns
RemovePointUnsafe(T, Vector3d)
Remove point without locking / thread-safety
Declaration
public bool RemovePointUnsafe(T value, Vector3d pos)
Parameters
Type |
Name |
Description |
T |
value |
|
Vector3d |
pos |
|
Returns
UpdatePoint(T, Vector3d, Vector3d)
Move point from old to new position. This function is thread-safe, uses a SpinLock internally
Declaration
public void UpdatePoint(T value, Vector3d old_pos, Vector3d new_pos)
Parameters
UpdatePointUnsafe(T, Vector3d, Vector3d)
Move point from old to new position without locking / thread-safety
Declaration
public void UpdatePointUnsafe(T value, Vector3d old_pos, Vector3d new_pos)
Parameters