# PairEdges

Sorts arrays of edges into arrays of edge pairs. PairEdges scans an Edge data structure for edge pairs that fall within the specified tolerance. Edges belonging to a pair are ordered consecutively, such that the first edge of a pair is on an even index number and the second edge of a pair is on an odd index number.

## PairEdges Inputs

Parameter | Description
Edges | A reference to a spreadsheet cell containing an Edge data structure, which must consist of multiple straight-line edges.
Number of Pairs | Specifies the maximum number of pairs to be reported. (0 to 80; default = 1)
Edge: First | Specifies the polarity of the first edge in a pair. PairEdges will only report edge pairs whose first edge has the specified polarity.
0 = black-to-white
1 = white-to-black (default)
2 = either
Edge: Second | Specifies the polarity of the second edge in a pair. PairEdges will only report edge pairs whose second edge has the specified polarity.
0 = black-to-white (default)
1 = white-to-black
2 = either
Edge Dist: Min | Specifies the minimum arc distance (0 to 1920; default = 0) between edges in a pair. PairEdges will only report edge pairs that are more than Edge Dist: Min distance apart.
Edge Dist: Max | Specifies the maximum arc distance (0 to 1920; default = 50) between edges in a pair. PairEdges will only report edge pairs that are less than Edge Dist: Max distance apart.
Intermediate Edges | Specifies the expected number and polarity of edges that fall between the end points of an edge pair. PairEdges will only report edge pairs with an expected number of intermediate edges.
Min B2W | Specifies the minimum number of black-to-white edges expected between the end points of an edge pair. (0 to 320; default = 0)
Max B2W | Specifies the maximum number of black-to-white edges expected between the end points of an edge pair. (0 to 320; default = 0)
Min W2B | Specifies the minimum number of white-to-black edges expected between the end points of an edge pair. (0 to 320; default = 0)
Max W2B | Specifies the maximum number of white-to-black edges expected between the end points of an edge pair. (0 to 320; default = 0)
Show | Specifies the display mode for PairEdges graphical overlays on top of the image.
0 = hide all (default) | All graphics will be hidden, except when the cell containing the PairEdges function is the active cell in the spreadsheet.
1 = result graphics only | The line edges will be displayed at all times.

## PairEdges Outputs

Returns | An Edge data structure containing paired edges, or #ERR if any of the input parameters are invalid.
Results | When PairEdges is initially inserted into a cell, a result table is created in the spreadsheet. The following Edges Vision Data Access Functions are automatically inserted into the spreadsheet to create the result table:
Label | Function | Description
NumPairs | GetNFound(Edges) | The number of edge pairs found.
MinDist | PairMinDistance(Edges) | The minimum distance between paired edges.
MaxDist | PairMaxDistance(Edges) | The maximum distance between paired edges.
MeanDist | PairMeanDistance(Edges) | The mean distance between paired edges.
SDevDist | PairSDevDistance(Edges) | The standard deviation of the distance between paired edges.

Additional data elements can be accessed using Edges Vision Data Access Functions.