Class that is used to calculate and compare distances between point containers.
More...
|
| DistanceComparer (PointContainerType referencePoint, DistanceDelegate< PointType > distanceFunction) |
| Constructs a new comparer according to input distance to a reference poiont (type IVector). More...
|
|
| DistanceComparer (PointContainerType referencePoint, DistanceDelegate< PointType > distanceFunction, IVector lengthScales) |
| Constructs a new comparer according to input distance to a reference poiont (type IVector). More...
|
|
abstract void | GetPointCoordinates (PointType pt, ref IVector coord) |
| Gets vector of coordinates of the specified point and stores it in the specified variable. More...
|
|
void | SetCoordinateScales (IVector min, IVector max, IVector lengthScales) |
| Sets parameters that affect default calculation of distance and relative point coordinates. More...
|
|
void | GetRelativeCoordinates (IVector coord, ref IVector relativeCoortinates) |
| Converts the specified coordinates to relative coordinates where compponents run from 0 to 1 if original coordinates run from minimal to maximal value. More...
|
|
void | SetOutputScales (IVector min, IVector max, IVector lengthScales) |
| Sets parameters that affect default calculation of output distance and output relative coordinates. More...
|
|
void | GetOutputRelativeCoordinates (IVector coord, ref IVector relativeCoortinates) |
| Converts the specified OUTPUT coordinates to relative coordinates where compponents run from 0 to 1 if original coordinates run from minimal to maximal value. More...
|
|
virtual double | OutputDistance (PointContainerType pt1, PointContainerType pt2) |
| Returns output distance between two point containers. More...
|
|
virtual int | Compare (PointContainerType pt1, PointContainerType pt2) |
| Compares two points according to the current comparer definition. More...
|
|
virtual double | Distance (PointType pt1, PointType pt2) |
| Returns distance between the specified two points. More...
|
|
double | Distance (PointContainerType boxedPt1, PointContainerType boxedPt2) |
| Returns distance between the specified two points enclosed in PointContainer objects, as defined by the distance calculation delegate (property DistanceFunction) of the current object. More...
|
|
double | Distance (PointContainerType boxedPt1, PointType pt2) |
| Returns distance between the specified point encolosed in an PointContainer object and a non-enclosed point, as defined by the distance calculation delegate (property DistanceFunction) of the current object. More...
|
|
double | Distance (PointType pt1, PointContainerType boxedPt2) |
| Returns distance between the specified point and the second point encolosed in an PointContainer object, as defined by the distance calculation delegate (property DistanceFunction) of the current object. More...
|
|
double | Distance (PointType pt) |
| Returns distance between the specified point and the reference point (property ReferencePoint) of the current object (enclosed in PointContainer<PointType> object), as defined by the distance calculation delegate of the current comparer object (property DistanceFunction). More...
|
|
double | Distance (PointContainerType boxedPt) |
| Returns distance between the specified point (enclosed in PointContainer<PointType> pbject) and the reference point (property ReferencePoint) of the current object (property ReferencePoint), as defined by the distance calculation delegate of the current comparer object (property DistanceFunction). More...
|
|
void | Sort (List< PointContainerType > list) |
| Sorts a list of point containers with the current comparer. More...
|
|
void | SortUsingStoredDistance (List< PointContainerType > list) |
| Sorts a list of point containers with the current comparer. More...
|
|
|
object | Lock [get] |
| This object's central lock object to be used by other object. Do not use this object for locking in class' methods, for this you should use InternalLock. More...
|
|
PointContainerType | ReferencePoint [get, set] |
| Reference point. More...
|
|
DistanceDelegate< PointType > | DistanceFunction [get, set] |
| Delegate that calculates distance between two vectors. More...
|
|
IVector | LengthScales [protected get, set] |
| Sets the vector of length scales that are used for calculation of distances. More...
|
|
IVector | Min [protected get, set] |
| Sets the vector of minimal values for point coordinates. Needed for calculation of relative coordinate vector. More...
|
|
IVector | Max [protected get, set] |
| Sets the vector of maximal values point coordinates. Needed for calculation of relative coordinate vector. More...
|
|
IVector | OutputLengthScales [protected get, set] |
| Sets the vector of OUTPUT vector's length scales that are used for calculation of distances and relative coordinates. More...
|
|
IVector | OutputMin [protected get, set] |
| Sets the vector of minimal values for point OUTPUT values. Needed for calculation of relative coordinate vector. More...
|
|
IVector | OutputMax [protected get, set] |
| Sets the vector of maximal values point OUTPUT values. Needed for calculation of relative coordinate vector. More...
|
|
IComparer< PointContainerType > | StoredDistanceComparer [get] |
| Gets comparer that compares two point containers of type PointContainerType by the stored distance stored on those points. More...
|
|
PointContainerType | ReferencePoint [get, set] |
| Reference point. More...
|
|
IVector | LengthScales [set] |
| Sets the vector of length scales that are used for calculation of distances. More...
|
|
IVector | Min [set] |
| Sets the vector of minimal values for point coordinates. Needed for calculation of relative coordinate vector. More...
|
|
IVector | Max [set] |
| Sets the vector of maximal values point coordinates. Needed for calculation of relative coordinate vector. More...
|
|
IVector | OutputLengthScales [set] |
| Sets the vector of OUTPUT vector's length scales that are used for calculation of distances and relative coordinates. More...
|
|
IVector | OutputMin [set] |
| Sets the vector of minimal values for point OUTPUT values. Needed for calculation of relative coordinate vector. More...
|
|
IVector | OutputMax [set] |
| Sets the vector of maximal values point OUTPUT values. Needed for calculation of relative coordinate vector. More...
|
|
IComparer< PointContainerType > | StoredDistanceComparer [get] |
| Gets comparer that compares two point containers of type PointContainerType by the stored distance stored on those points. More...
|
|
object | Lock [get] |
|
Class that is used to calculate and compare distances between point containers.
- Template Parameters
-
PointType | Type of the point objects that have a point position in space, and whose containers of type PointContainer<PointType> are compared by the current class. |
PointContainerType | Type of point container that is used to wrap points of the point type. |
This class as a part of group of classes that have been created in 2008 in order to support different operations and algorithms on losely connected clouds of points that are embedded in space of arbitrary dimension. The primary intended application was in optimization algorithms based on successive approximations of response and on restricted step prototype algorithms, developed by the author. The scope is much broader, however, because these classes can support closest neighbors algorithms, various graph algorithms based on points in space, detection of clusters, etc.
In 2009, major refactoring has been performed where a more generic structure has been introduced, allowing implementation of generic algorithm methods that can be used with different representations of points.
In 2011, the classes weer migrated from sandbox environment to the prduction IGLib library and simplified a bit. The intention is to use the classes in the artificial neural network-based approximation modules developed for COBIK and the University of Nova Gorica. The intention is, however, that the eventual algorithms developed within this scope are implemented in a generic way, such that they can serve multiple purposes.
$A Igor Sep08 May09 Dec11;
- Type Constraints
-
PointContainerType | : | IPointContainer<PointType> | |
void IG.Num.DistanceComparer< PointContainerType, PointType >.GetOutputRelativeCoordinates |
( |
IVector |
coord, |
|
|
ref IVector |
relativeCoortinates |
|
) |
| |
|
inline |
Converts the specified OUTPUT coordinates to relative coordinates where compponents run from 0 to 1 if original coordinates run from minimal to maximal value.
Minimal OUTPUT coordinate values are stored in OutputMin and maximal values are stored in OutputMax.
- Parameters
-
coord | Vector of original coordinates. |
relativeCoortinates | Vector where converted relative OUTPUT coordinates are stored. |
Calculation of relative coordinates does not rely on the vector of length scales, but only on vectors of minimal and maximal coordinates.
This functionality is used only in those types of points that have input parameters and output values, such as approximation data points.
Implements IG.Num.IDistanceComparer< PointContainerType, PointType >.
virtual double IG.Num.DistanceComparer< PointContainerType, PointType >.OutputDistance |
( |
PointContainerType |
pt1, |
|
|
PointContainerType |
pt2 |
|
) |
| |
|
inlinevirtual |
Returns output distance between two point containers.
If vector of output scales (property OutputLengthScales) is specified then weighted Euclidean distance between output vectors of the specified containers is returned (differences in components are divided by components of vector output scaling lengths before being squared).
If vector of output length scales is not specified then usual Euclidean distance between coordinates of the two specified points is returned.
- Parameters
-
pt1 | The first poiint container for distance calculation. |
pt2 | The second point container for distance calculation. |
This functionality is used only in those types of points that have input parameters and output values, such as approximation data points.
While definition of input distance (between point co-ordinates) can be defined by a delegate, definition of output distance is currenyly fixed, can not be modified (except by setting the vector of output length scales that affects the definition).
Implements IG.Num.IDistanceComparer< PointContainerType, PointType >.
virtual double IG.Num.DistanceComparer< PointContainerType, PointType >.OutputDistance |
( |
IVector |
outVec1, |
|
|
IVector |
outVec2 |
|
) |
| |
|
inlineprotectedvirtual |
Returns output distance between two output vectors.
If vector of output scales (property OutputLengthScales) is specified then weighted Euclidean distance between coordinates of the specified point is returned (differences in coordinates are divided by components of vector of scales before being squared).
If vector of output length scales is not specified then usual Euclidean distance between coordinates of the two specified points is returned.
- Parameters
-
outVec1 | The first output vector for output distance calculation. |
outVec2 | The second output vector for output distance calculation. |
This functionality is used only in those types of points that have input parameters and output values, such as approximation data points.
While definition of input distance (between point co-ordinates) can be defined by a delegate, definition of output distance is currenyly fixed, can not be modified (except by setting the vector of output length scales that affects the definition).
References IG.Num.VectorBase.DistancePlain(), and IG.Num.VectorBase.DistanceWeightedPlain().