This topic contains the following sections.
The Fit Circle edit control provides a graphical user interface to the CogFitCircleTool vision tool, which takes a set of input points and returns the circle that best fits those input points while generating the smallest root mean square (RMSError) error. A Fit Circle tool requires a minimum of three input points.
The Fit Circle edit control allows you to select the input points, specify a constrain radius, and view vision tool results. The following figure shows the Fit Circle edit control:

The edit control offers the following features:
- A row of control buttons at the top left
- A set of function tabs for specifying the input points, setting run-time parameters, and viewing results
- An image display window for displaying Fit Circle tool images and graphics
You can experiment with the edit control by using QuickBuild to create a CogFitCircle tool. A new CogFitCircle tool appears with the input terminals for three input points, as shown in the following figure:


The following table describes the function of each button:
| Button | Description | Function |
![]() | Run | Fit a circle to the current set of input points, taking the present set of run parameters into consideration. |
![]() | Electric mode | Toggle electric mode, where the Fit Circle tool executes automatically when particular configuration parameters change. In electric mode, a lightning bolt appears next to every electric property. |
![]() | Local image display | Open or close the local image display window. A Fit Circle tool supports the following image buffers:
|
![]() | Floating image display | Open one or more floating image windows, which support the same image buffers as the local image display window. |
![]() | Open | Open a VisionPro persistence (.vpp) file that contains a set of saved properties for this vision tool object type. VisionPro reports an error if you try to open a .vpp file for another object type. |
![]() | Save | Save the current properties of the vision tool to a VisionPro persistence (.vpp) file. The edit control allows you to choose between saving the vision tool with or without its image buffers and tool results. |
![]() | Save As | Save the current properties of the vision tool to a new VisionPro persistence (.vpp) file. |
![]() | Reset | Reset the vision tool to its default state. This tool gives you a choice between resetting to the default-constructed state, which is appropriate when you are using it in a Visual Studio.NET application, and its template-initialized state, which is appropriate for QuickBuild applications. |
![]() | Show Floating Results | Open a separate results window with the same contents as seen in the Results tab. |
![]() | Show ToolTips | Enable or disable the display of tooltips for individual items in the edit control. |
![]() | Help | Open this VisionPro online help file. |
Use the Settings tab to specify the number of the input points you want to use, the number of points you want the tool to ignore, and any constraint radius you want to use to limit the size of the circle. The following figure shows the default Settings tab:

Use the Input Points grid of the Settings tab to specify the number and (x,y) coordinates of the input points for this Fit Circle tool, which requires a minimum of three. Use the function buttons, shown in the following figure, to add, delete and reorder the input points:

The following table describes the function buttons:
| Button | Description |
![]() | AddPoint a new input point. Initially, the input point has the coordinates (0, 0), and you must reference a valid point result generated by another vision tool. With QuickBuild you can connect the output (x, y) terminals of a valid point to the input (x, y) terminals of a Fit Circle point. In your custom vision application you use the SetPoint method. |
![]() | DeletePoint the currently highlighted input point from the list. If you have fewer than three input points plus the number of points to ignore, the edit control displays the message Not Enough Input Points and the Fit Circle tool will not function properly. |
![]() | Move the highlighted input point up one position in the list, although the order of input points does not affect the operation of the Fit Circle tool. |
![]() | Move the highlighted input point down one position in the list, although the order of input points does not affect the operation of the Fit Circle tool. |
To add an input point to the list, you can either enter an (x,y) coordinate directly or use the Tool Group edit control to link the (x,y) coordinates of a point result from another tool to the (x,y) coordinates of the input parameters for the Fit Circle tool .
Check the RadiusConstraint checkbox to specify a precise radius for the circle that best fits the input points. Use the textbox to the right of the checkbox to enter a radius value. For example, the following figure shows a Fit Circle edit control with the Constrain Radius set to 110 and the resulting circle that fits the input points:

Use the NumToIgnore textbox to specify the number of input points the Fit Circle tool will ignore while calculating the best fitting circle. To determine which point to ignore, the Fit Circle tool considers all possible subsets and keeps the set that produces the best possible score. Be aware that the larger the value, the more time the tool requires to execute.
Use the CreateResultGraphics tab to control which graphics the Fit Circle tool generates and displays. The following figure shows the Graphics tab:

The following table describes the options in the Graphics tab:
| Area | Description |
| Inputs | Controls whether or not the input points appear in the Current.InputImage image buffer. |
| Results | Controls which graphics appear in the LastRun.InputImage buffer. |
| Diagnostics | Controls whether or not the input image is recorded as part of the diagnostic record, and whether the image is copied to the record or saved in the record as a reference. |
Use the CogFitCircleResult tab to view the results of each execution of the Fit Circle tool. The following figure shows the Results tab:

The Results tab contains the following information:
| Area | Description |
| Circle | Displays the coordinate space for input image, as well as the center point and radius of the circle |
| RMS Error | Displays the RMS error for the fit of the circle |
Points | Displays the following information for each input point:
|














