# RectangleFromLineSegment2D

The RectangleFromLineSegment2D function Functions are tools that are available in Spreadsheet for processing and analyzing acquisitions or other results. You can add functions to your Spreadsheet job to create tool chains and produce results for specific applications. allows you to construct a rectangle from a specified two-dimensional Line.

Input LineSegment structure | Rectangle3D output

To use the RectangleFromLineSegment2D function:

1. Drag and drop the RectangleFromLineSegment2D function into the Spreadsheet.

2. In the property sheet that pops up, either define the LineSegment manually or double-click the External Line Segment parameter to open cell selection. Select the Line cell containing the Line structure you want the function to use.

3. Check the Auto Compute Z Range checkbox, or manually adjust the Z center offset and height of the Rectangle3D output structure. The acquisition Acquisition is the process or result of the vision system acquiring a new image. display shows a preview of the Rectangle3D structure.

4. Click OK to finalize the settings.

Input

The RectangleFromLineSegment2D function has the following syntax:

RectangleFromLineSegment2D(PointCloud A point cloud is a 3D structure that consists of the data points collected by a 3D vision system during acquisition.,Image,X0,Y0,X1,Y1,ExternalLineSegment,AutoComputeZRange,ZCenter,Height,Show)

Parameter | Description
--- | ---
PointCloud | Reference to a cell containing a point cloud A point cloud is a 3D structure that consists of the data points collected by a 3D vision system during acquisition.. The default value is $A$0.
Image | Reference to a cell containing an Image. The default value is $A$1.
LineSegment | Specifies the coordinates of the line.
X 0 | X offset from the PointCloud origin, in real-world units.
Y 0 | Y offset from the PointCloud origin, in real-world units.
X 1 | X offset from the PointCloud origin, in real-world units.
Y 1 | Y offset from the PointCloud origin, in real-world units.
External Line Segment | Specifies a reference to a Line defined in another cell. Set to 0 (OFF) to use the internal Line of the function.
Auto Compute Z Range | Computes the Z range using the 3D points along the 2D line segment, and updates the values on the property sheet.
Z Center | Z center offset from the PointCloud origin, in real-world units.
Height | Length of the rectangle, in real-world units.
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.

Output

Returns | A Rectangle3D data structure as the projected 3D structure, 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.
| SizeX | SizeY | X | Y | Z | Rotation | Tilt | Tilt Direction
❒Rectangle3D | GetSizeX(Rectangle3D) | GetSizeY(Rectangle3D) | GetX(Rectangle3D) | GetY(Rectangle3D) | GetZ(Rectangle3D) | GetRotation(Rectangle3D) | GetTilt(Rectangle3D) | GetTiltDirection(Rectangle3D)

Vision Data Access functions

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

Function | Description
GetSizeX(Rectangle3D) | Returns the size of the structure along the X-axis.
GetSizeY(Rectangle3D) | Returns the size of the structure along the Y-axis.
GetX(Rectangle3D) | Returns the X-axis coordinate of the specified structure's center point.
GetY(Rectangle3D) | Returns the Y-axis coordinate of the specified structure's center point.
GetZ(Rectangle3D) | Returns the Z-axis coordinate of the specified structure's center point.
GetRotation(Rectangle3D) | Returns the rotation of the Z-axis in degrees, also known as the in-plane rotation.
GetTilt(Rectangle3D) | Returns the tilt angle of the structure in degrees on the Z-axis.
GetTiltDirection(Rectangle3D) | Returns the tilt direction angle of the specified structure in degrees. The angle is measured in the X-Y plane of the original reference coordinate system, and specifies the direction for the projection of the tilted Z-axis onto that plane.