FreeMat: vtkKMeansDistanceFunctorCalculator

FreeMat

- Main Page
- Related Pages

vtkKMeansDistanceFunctorCalculator

Section: Visualization Toolkit Infovis Classes

# Usage

This is a subclass of the default k-means distance functor that allows the user to specify a distance function as a string. The provided expression is evaluated whenever the parenthesis operator is invoked but this is much slower than the default distance calculation.

User-specified distance expressions should be written in terms of two vector variables named "x" and "y". The length of the vectors will be determined by the k-means request and all columns of interest in the request must contain values that may be converted to a floating point representation. (Strings and vtkObject pointers are not allowed.) An example distance expression is "sqrt( (x0-y0)^2 + (x1-y1)^2 )" which computes Euclidian distance in a plane defined by the first 2 coordinates of the vectors specified.

To create an instance of class vtkKMeansDistanceFunctorCalculator, simply invoke its constructor as follows

      obj = vtkKMeansDistanceFunctorCalculator

# Methods

The class vtkKMeansDistanceFunctorCalculator has several methods that can be used. They are listed below. Note that the documentation is translated automatically from the VTK sources, and may not be completely intelligible. When in doubt, consult the VTK website. In the methods listed below, `obj` is an instance of the vtkKMeansDistanceFunctorCalculator class.

- `string = obj.GetClassName ()`
- `int = obj.IsA (string name)`
- `vtkKMeansDistanceFunctorCalculator = obj.NewInstance ()`
- `vtkKMeansDistanceFunctorCalculator = obj.SafeDownCast (vtkObject o)`
- `obj.SetDistanceExpression (string )` - Set/get the distance function expression.
- `string = obj.GetDistanceExpression ()` - Set/get the distance function expression.
- `obj.SetFunctionParser (vtkFunctionParser )` - Set/get the string containing an expression which evaluates to the distance metric used for k-means computation. The scalar variables "x0", "x1", ... "xn" and "y0", "y1", ..., "yn" refer to the coordinates involved in the computation.
- `vtkFunctionParser = obj.GetFunctionParser ()` - Set/get the string containing an expression which evaluates to the distance metric used for k-means computation. The scalar variables "x0", "x1", ... "xn" and "y0", "y1", ..., "yn" refer to the coordinates involved in the computation.