You are here: Start » Program Examples » Circle Fitting 3D
Circle Fitting 3D
Aim:
The task of the application is to measure distance between 2 holes in a scanned 3D object.
Input:
The surface of the scanned object.
Output:
Marked holes and their centers of the surface. Calculated distance between holes.
Hints:
Having acquired point clouds of the Surface data type, choose the part with the holes using the SurfaceValidPointsRegion filter. Then, use FitCircleToEdges3D to locate holes and their centers. Use the PointToPointDistance3D to measure the distance.
Solution (FIS):
-
In Workspace Explorer, open the workspace Examples, and in the Filmstrip window select the CircleFitting3D dataset. Drag the Surface channel to the ACQUIRE section.
-
Add the SurfaceValidPointsRegion filter to focus on the part with the holes. Open the inRegion editor in the Parameters section and set a rectangle containing only the lower located holes, similar to the one in the image below.
-
Create the local coordinate system based on the marked region:
- Add the RegionBoundingRectangle_OrNil and connect its input with the outValidPointsRegion output.
- Add the CreateCoordinateSystemFromRectangle and connect its input with the outBoundingRectangle output.
- Convert the 2D coordinate system to the 3D version with the ConvertCoordinateSystem2DTo3D. Connect it to the outCoordinateSystem output. Connect the inSurfaceFormat to the ReadFilmstrip outSurface output.
-
Add two FitCircleToEdges3D filters. Connect both inSurface inputs to the ReadFilmstrip outSurface output and both inFittingFieldAlignment inputs to the ConvertCoordinateSystem2DTo3D output. For both filters, set these parameter:
- The inScanCount to 20.
- The inEdgeScanParams Edge Transition to InvalidToValid.
- The inOutlierSuppression to Tukey.
-
For the first FitCircleToEdges3D open the inFittingField editor from the Properties section and mark the first hole as shown in the image below.
-
For the second FitCircleToEdges3D open the inFittingField editor from the Properties section and mark the second hole as shown in the image below.
-
Add the PointToPointDistance3D filter and connect its inPoint inputs with both FitCircleToEdges3D outCircle.Center outputs.Show the found distance on a new preview window.
Macrofilter Main.
Further Readings
- Geometry 3D - List of filters useful in 3D geometry.