This guide explains how extreme points can be located inside a given shape as illustrated in `samples.tea.gxy.extremepoint.MainPanel`.

The class `TLcdExtremePointFinder` is used to find a given number of extreme points. To ensure that the extreme points are more or less distinct, some separation parameters have to be specified. The separation height (Figure 1, “How to interpret the separation height.”), which is a relative value difference, indicate how distinct the values should be from one another. This parameter only applies for a specified separation distance (Figure 2, “How to interpret the separation distance.”), which makes it possible to find more than one extreme point for a large area of the same value.

Figure 1. How to interpret the separation height.
Figure 2. How to interpret the separation distance.

Program: Finding extreme points. shows how the extreme point finder is used in this sample. Due to performance reasons, a reference matrix view needs to be set to the finder before the minimum or maximum points can be computed. This allows the finder to cache a list of extreme points that only depend on the specified matrix view.

Program: Finding extreme points. (from `samples/tea/AbstractExtremePointAction`)
``````  fExtremePointFinder.setReferencedMatrixView( matrix_view );

List minimum_peaks = fExtremePointFinder.findExtremePoints(
TLcdExtremePointFinder.Type.LOWEST_POINTS,
fRequestedPoints,
fSeparationHeight,
fSeparationDistance
);
List maximum_peaks = fExtremePointFinder.findExtremePoints(
TLcdExtremePointFinder.Type.HIGHEST_POINTS,
fRequestedPoints,
fSeparationHeight,
fSeparationDistance
);``````

Figure 3, “The result of the extreme point sample action.” illustrates the result of the sample action `ExtremePointAction` with a separation distance of 7000m and a separation height of 300m. The 15 red triangles indicate the maxima and the 15 green triangles indicate the minima.

Figure 3. The result of the extreme point sample action.