Back to Adaptive Vision Library website

You are here: Start » Function Reference » Geometry 2D Fitting » DetectPointSegments

# DetectPointSegments

Detect points that lie along multiple segments.

### Syntax

C++
C#

void avl::DetectPointSegments
(
const atl::Array<avl::Point2D>& inPoints,
const float inMaxDistance,
const int inMaxRank,
atl::Optional<float> inMaxRelativeDistance,
const float inMaxTurnAngle,
const int inMinPointCount,
atl::Array<avl::Segment2D>& outPointSegments,
atl::Array<avl::Path>& outPaths
)


### Parameters

Name Type Range Default Description
inPoints const Array<Point2D>& Points to connect
inMaxDistance const float 0.0 - 10.0f Maximum distance between connected points
inMaxRank const int 1 - 4 Maximum number of neighbour candidates considered when joining points
inMaxRelativeDistance Optional<float> 1.0 - 2.0f Maximum distance in relation to the shortest distance for a point
inMaxTurnAngle const float 0.0 - 90.0 5.0f Maximum angle between consecutive path segments
inMinPointCount const int 2 - 3 Minimum number of points in one path
outPointSegments Array<Segment2D>& Segments connecting first and last point of each path
outPaths Array<Path>& Paths of connected points

### Description

Use this filter to detect multiple segments or paths at the same time.

Set inMaxDistance to smaller value to avoid connecting distant points.
Set inMaxRank to larger value to allow detecting paths that lie close to each other.
Set inMaxTurnAngle to larger value when points do not lie precisely on a segment.
Set inMinPointCount to filter out too short paths (useful when some of the input points are noise).

Filter returns array of paths as well as segments connecting first and last point of each path.

### Examples

Results for input parameters: inMaxDistance = 30, inMaxRank = 4, inMaxTurnAngle = 20, inMinPointCount = 4.

 The resulting outPointSegments drawn with the input points. The resulting outPaths drawn with the input points.