Click or drag to resize
Accord.NET (logo)

ClosePointsMergingOptimizer Class

Shape optimizer, which merges points within close distance to each other.
Inheritance Hierarchy
SystemObject
  Accord.Math.GeometryClosePointsMergingOptimizer

Namespace:  Accord.Math.Geometry
Assembly:  Accord.Math (in Accord.Math.dll) Version: 3.8.0
Syntax
public class ClosePointsMergingOptimizer : IShapeOptimizer
Request Example View Source

The ClosePointsMergingOptimizer type exposes the following members.

Constructors
  NameDescription
Public methodClosePointsMergingOptimizer
Initializes a new instance of the ClosePointsMergingOptimizer class.
Public methodClosePointsMergingOptimizer(Single)
Initializes a new instance of the ClosePointsMergingOptimizer class.
Top
Properties
  NameDescription
Public propertyMaxDistanceToMerge
Maximum allowed distance between points, which are merged during optimization, [0, ∞).
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodOptimizeShape
Optimize specified shape.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Extension Methods
  NameDescription
Public Extension MethodHasMethod
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)
Public Extension MethodIsEqual
Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.)
Public Extension MethodTo(Type)Overloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Public Extension MethodToTOverloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Top
Remarks

This shape optimizing algorithm checks all points of a shape and merges any two points which are within specified distance to each other. Two close points are replaced by a single point, which has mean coordinates of the removed points.

Note Note
Because of the fact that the algorithm performs points merging while it goes through a shape, it may merge several points (more than 2) into a single point, where distance between extreme points may be bigger than the specified limit. For example, suppose a case with 3 points, where 1st and 2nd points are close enough to be merged, but the 3rd point is a little bit further. During merging of 1st and 2nd points, it may happen that the new point with mean coordinates will get closer to the 3rd point, so they will be merged also on next iteration of the algorithm.

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

See Also