C# Класс Accord.Math.Geometry.LineStraighteningOptimizer

Shape optimizer, which removes points within close range to shapes' body.

This shape optimizing algorithm checks all points of the shape and removes those of them, which are in a certain distance to a line connecting previous and the next points. In other words, it goes through all adjacent edges of a shape and checks what is the distance between the corner formed by these two edges and a possible edge, which could be used as substitution of these edges. If the distance is equal or smaller than the specified value, then the point is removed, so the two edges are substituted by a single one. When optimization process is done, the new shape has reduced amount of points and none of the removed points are further away from the new shape than the specified limit.

The shape optimizer does not optimize shapes to less than 3 points, so optimized shape always will have at least 3 points.

For example, the below circle shape comprised of 65 points, can be optimized to 8 points by setting MaxDistanceToRemove to 10.

Наследование: IShapeOptimizer
Показать файл Открыть проект

Открытые методы

Метод Описание
LineStraighteningOptimizer ( ) : System

Initializes a new instance of the LineStraighteningOptimizer class.

LineStraighteningOptimizer ( float maxDistanceToRemove ) : System

Initializes a new instance of the LineStraighteningOptimizer class.

OptimizeShape ( List shape ) : List

Optimize specified shape.

Описание методов

LineStraighteningOptimizer() публичный Метод

Initializes a new instance of the LineStraighteningOptimizer class.
public LineStraighteningOptimizer ( ) : System
Результат System

LineStraighteningOptimizer() публичный Метод

Initializes a new instance of the LineStraighteningOptimizer class.
public LineStraighteningOptimizer ( float maxDistanceToRemove ) : System
maxDistanceToRemove float Maximum allowed distance between removed points /// and optimized shape (see ).
Результат System

OptimizeShape() публичный Метод

Optimize specified shape.
public OptimizeShape ( List shape ) : List
shape List Shape to be optimized.
Результат List