Back to Adaptive Vision Library website

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


Header: AVL.h
Namespace: avl
Module: FoundationPro

Detect points that lie along multiple segments.


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


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


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.


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.

See Also

  • FitSegmentToPoints – Approximates points with a segment using selected outliers suppression method.