Metric_Space
A metric space defines a distance metric on its objects. This gives
rise to geometric properties, which are encapsulated by Geoms. Operations return the Geom for an
SObject, measure the distance between a pair of Geoms, and use spatial
indices to answer nearness-related queries.
A base metric space defines Geoms for SObjects. Multiple
derived metric spaces can be defined relative to a base space.
The derived spaces do not define Geoms, but instead only serve as
views, indexing some of the Geoms defined in the base space. The add
and remove operations serve to specify which objects from the base
should be indexed by the view.
Subclasses:
Implementations:
- Metric_Space_Centroid
Measures object distance by
centroid distance in the base (coord) space.
- Metric_Space_Function
Uses a user-specified distance
metric.
Constructor args: metric function, int dimension.
- Metric_Space_Induced
Maps each Geom to a Geom in
another metric space; answers queries in terms of these
representatives.
Constructor args: Metric_Space for
representatives, int dimension.
- Metric_Space_Vertices
Measures distance by closest
pair of vertices (not a true metric). Objects must be Geoms for
CComplexes.
Member functions:
- base: Metric_Space -> Metric_Space
Returns the base space for a derived space, or the space itself if it
is a base space.
- derive: Metric_Space . Metric_Space base -> void
The metric space is a derived view of the base.
- dimension: Metric_Space -> int
Returns the dimension
of the space.
- distance: Metric_Space . Geom . Geom -> double
Returns the distance between the two geoms, using the space's metric.
- geom: Metric_Space . SObject -> Geom
Returns the Geom defined for the object in the space.
- near: Metric_Space . Geom . double radius . Geoms -> void
Stores in the container all geoms within the radius of the query geom.
- nearest: Metric_Space . Geom . double radius=-1 -> Geom
Returns the geom closest to the query geom. If radius is
non-negative, only geoms within that radius are checked (thus nil can be
returned).
Secondary operations:
- coords: PointContainer . CoordsContainer -> void
Fills the coords container with the coords for the points.
- create_geoms: Space . Geom . Metric_Space . Space -> void
Adds to the final space geometries created for the structures in the
first space with respect to the metric space.
- fill: Metric_Space . int . Geom . SObject -> void
Adds to the space n new objects of the given prototypes
(geometry and structure).
- geoms: Space . Metric_Space . Space -> void
Adds to the final space geometries in the metric space for
the structures in the first space.
- structures: Space . Space -> void
Adds to the second space structures for the geometries in the first space.