# SortEdge3D

The SortEdge3D function is used to return a sorted list of edges extracted in the point cloud, by referencing an Edges3D structure (created for example by an ExtractEdge3D function). This function allows you to sort the referenced edges by specific sort keys and sort orders, and returns the list of sorted edges in a new Edges3D structure.

Inputs

The SortEdge3D function has the following syntax:

    SortEdge3D(PointCloud,Edges3D,SortKey,SortOrder,Fixture3D,ExternalFixture,Show)

See the table for a description of the available parameters.

Parameter | Description
PointCloud | Reference to a cell containing a point cloud. The default value is $A$0.
Edges3D | Specifies a reference to an Edges3D structure in another spreadsheet cell. The contents of this cell will be used as the basis for sorting.
Sort Key | Specifies the sorting logic for the edges in the Edges3D structure. The available values are the following: None: No sorting logic will be applied. Use this setting if you simply want to count the sorted edges, or want to examine them without the need to order them. Score: Sort the edges by their calculated score values. Coverage: Sort the edges by their coverage amount. Sharpness: Sort the edges by their sharpness. Vertical Angle: Sort the edges by their vertical angles. Horizontal Angle: Sort the edges by their horizontal angles. Position Along Extraction Direction: Sort the edges by their positions along the direction they were extracted into the Edges3D structure. Transition Type: Sort the edges by transition type (convex, concave). Edge Segment Center Spoke Angle: Sort the edges by their angle from the edge segment center's X-axis and Y-axis position to their origin. Edge Segment Center Spoke Radius: Sort the edges by their segment center's distance from their origin to the segment center's location on the X-axis and Y-axis (disregarding the Z-axis height).
Sort Order | Specifies whether to sort the edges of the referenced Edges3D structure in ascending or descending order. Note: This parameter is not available if the Sort Key parameter is set to None.
Fixture3D | Specifies the point cloud coordinate system in which the 3D fixture is defined. It is offset from the PointCloud origin in the following format with the following arguments: {X, Y, Z, Rotation, Tilt, TiltDirection}
X | Offset on the X-axis from the PointCloud origin.
Y | Offset on the Y-axis from the PointCloud origin.
Z | Offset on the Z-axis from the PointCloud origin.
Rotation | Specifies the in-plane rotation in degrees around the PointCloud Z-axis. The value range is -180 to 180. The tool normalizes external references with values outside the allowed range to the allowed range.
Tilt | Specifies the tilt angle in degrees from the PointCloud Z-axis after rotation. The value range is 0-180. External references with values outside the allowed range result in an error.
Tilt Direction | Specifies the direction of tilt in degrees from the rotated PointCloud X-axis of the tool, around the PointCloud Z-axis of the tool. The value range is -180 to 180. The tool normalizes external references with values outside the allowed range to the allowed range.
Note: The Fixture3D parameter is only available if you set External Fixture to 0. Note: This parameter is available only if Sort Key is set to Edge Segment Center Spoke Angle or Edge Segment Center Spoke Radius.
External Fixture | Specifies a reference to a Fixture3D structure defined in another cell. The function uses the referenced cell as the fixture of the function. Set to 0 (OFF) to use the internal fixture of the function instead. Note: This parameter is available only if Sort Key is set to Edge Segment Center Spoke Angle or Edge Segment Center Spoke Radius.
Show | Selects the type of graphics to overlay on the image.
0 = hide all (default) | All graphics are hidden, except when the cell containing the function is highlighted in the spreadsheet.
1 = result graphics only | The result graphics of the function are displayed at all times.
2 = input and result graphics | The region of interest, the input data and the results are displayed at all times.

Outputs

Returns | An Edges3D data structure containing the sorted edges, or #ERR if any of the input parameters are invalid.
Results | When initially inserted into a cell, the following functions are automatically inserted into the spreadsheet to create a result table.
| Num Found | Index | Transition Type | Score | Coverage | Sharpness | Vertical Angle | Horizontal Angle | Line | Midpoint | X0 | Y0 | Z0 | X1 | Y1 | Z1
❒Edges3D | GetNFound(Edges3D) | 0 | GetTransitionTypeText(Edges3D, 0) | GetScore(Edges3D, 0) | GetCoverage(Edges3D, 0) | GetSharpness(Edges3D, 0) | GetVerticalAngle(Edges3D, 0) | GetHorizontalAngle(Edges3D, 0) | GetLine(Edges3D, 0) | GetMidpoint(Line3D) | GetX(Line3D, 0) | GetY(Line3D, 0) | GetZ(Line3D, 0) | GetX(Line3D, 1) | GetY(Line3D, 1) | GetZ(Line3D, 1)
|  | 1 | GetTransitionTypeText(Edges3D, 1) | GetScore(Edges3D, 1) | GetCoverage(Edges3D, 1) | GetSharpness(Edges3D, 1) | GetVerticalAngle(Edges3D, 1) | GetHorizontalAngle(Edges3D, 1) | GetLine(Edges3D, 1) | GetMidpoint(Line3D) | GetX(Line3D, 0) | GetY(Line3D, 0) | GetZ(Line3D, 0) | GetX(Line3D, 1) | GetY(Line3D, 1) | GetZ(Line3D, 1)
|  | ... | ... | ... | ... | ... | ... | ... | ... |  | ... | ... | ... |  |  |
|  | N-1* | GetTransitionTypeText(Edges3D, N-1) | GetScore(Edges3D, N-1) | GetCoverage(Edges3D, N-1) | GetSharpness(Edges3D, N-1) | GetVerticalAngle(Edges3D, N-1) | GetHorizontalAngle(Edges3D, N-1) | GetLine(Edges3D, N-1) | GetMidpoint(Line3D) | GetX(Line3D, 0) | GetY(Line3D, 0) | GetZ(Line3D, 0) | GetX(Line3D, 1) | GetY(Line3D, 1) | GetZ(Line3D, 1)
*N = min(10, NumberToSort)

Vision Data Access functions

The following ExtractEdge3D Vision Data Access functions are automatically inserted into the spreadsheet to create the result table:

Function | Description
GetCoverage(Edges3D, index) | Returns the coverage of the edge specified with the index number.
GetHorizontalAngle(Edges3D, index) | Returns the horizontal angle of the edge specified with the index number.
GetLine(Edges3D, index) | Returns the line of the extracted edge with the specified index as a Line3D structure.
GetMidpoint(Line3D) | Returns the midpoint of the specified Line3D structure as a Point3D structure.
GetNFound(Edges3D) | Returns the number of sorted edges.
GetScore(Edges3D, index) | Returns the score of the edges specified with the index as a value between 0 and 100.
GetSharpness(Edges3D, index) | Returns the sharpness of the edge specified with the index (in degrees).
GetTransitionTypeText(Edges3D, index) | Returns the transition type of the edge specified with the index as a text (convex or concave).
GetVerticalAngle(Edges3D, index) | Returns the vertical angle of the edge specified with the index number.
GetX(Line3D, index) | Returns the X-axis coordinate of the specified line's starting point (when using index 0) or endpoint (when using index 1) on the Fixture3D X-axis.
GetY(Line3D, index) | Returns the Y-axis coordinate of the specified line's starting point (when using index 0) or endpoint (when using index 1) on the Fixture3D Y-axis.
GetZ(Line3D, index) | Returns the Z-axis coordinate of the specified line's starting point (when using index 0) or endpoint (when using index 1) on the Fixture3D Z-axis.