Coord_Space
A coord space uses coordinates in a coordinate system to implement its
metric. It can answer metric queries with Geoms (as with all metric spaces) or with Coords.
Most implementations allow a coordinate system to be provided to
the constructor; by default, they create a Euclidean one of the proper
dimension.
Implementations:
- Coord_Space_2D_Array: Stores geoms objects in an array
based on the (integer part of) its coordinates.
Constructor args:
int xdim, int ydim. Only 2-D Euclidean coordinate systems are
supported. Query coordinates must be non-negative integers less than
the dimensions.
- Coord_Space_2D_Buckets: Extends the 2-d array to allow
negative and non-integer coordinates; the space is discretized, and
multiple objects in each slot of the array.
Constructor args:
int xmin, int ymin, int xmax, int ymax, int xdens, int ydens.
The densities specify how many grid partitions per unit, an integer >=
1.
ALternate constructor args: base metric space. The bounding box,
density, etc. are automatically estimated.
- Coord_Space_Centroid: Measures distances between objects
by the distances between their centroids.
- Coord_Space_Coords: User-specified function yields
representative coords for measuring distances.
Constructor args: coords function.
- Coord_Space_KD_Tree: Stores geoms in a
tree where each level branches on coordinates in one dimension.
Constructor args: k.
Member functions:
- coord_system: Coord_Space -> int
Returns the
coordinate system of the space.
- distance: Coord_Space . Coords . Geom -> double
Returns the distance between the coords and geom.
- distance: Coord_Space . Coords . Coords -> double
Returns the distance between the two coords.
- near: Coord_Space . Coords . double radius . Geoms -> void
Like metric space near, but query is with coords.
- nearest: Coord_Space . Geom . double radius=-1 -> Geom
Like metric space nearest, but query is with coords.