C# Class Accord.Math.Geometry.PointsCloud

Set of tools for processing collection of points in 2D space.

The static class contains set of routines, which provide different operations with collection of points in 2D space. For example, finding the furthest point from a specified point or line.

Sample usage:

// create points' list List<IntPoint> points = new List<IntPoint>( ); points.Add( new IntPoint( 10, 10 ) ); points.Add( new IntPoint( 20, 15 ) ); points.Add( new IntPoint( 15, 30 ) ); points.Add( new IntPoint( 40, 12 ) ); points.Add( new IntPoint( 30, 20 ) ); // get furthest point from the specified point IntPoint p1 = PointsCloud.GetFurthestPoint( points, new IntPoint( 15, 15 ) ); Console.WriteLine( p1.X + ", " + p1.Y ); // get furthest point from line IntPoint p2 = PointsCloud.GetFurthestPointFromLine( points, new IntPoint( 50, 0 ), new IntPoint( 0, 50 ) ); Console.WriteLine( p2.X + ", " + p2.Y );
Mostrar archivo Open project: accord-net/framework Class Usage Examples

Public Methods

Method Description
FindQuadrilateralCorners ( IEnumerable cloud ) : List

Find corners of quadrilateral or triangular area, which contains the specified collection of points.

The method makes an assumption that the specified collection of points form some sort of quadrilateral/triangular area. With this assumption it tries to find corners of the area.

The method does not search for bounding quadrilateral/triangular area, where all specified points are inside of the found quadrilateral/triangle. Some of the specified points potentially may be outside of the found quadrilateral/triangle, since the method takes corners only from the specified collection of points, but does not calculate such to form true bounding quadrilateral/triangle.

See QuadrilateralRelativeDistortionLimit property for additional information.

GetBoundingRectangle ( IEnumerable cloud, IntPoint &minXY, IntPoint &maxXY ) : void

Get bounding rectangle of the specified list of points.

GetCenterOfGravity ( IEnumerable cloud ) : Point

Get center of gravity for the specified list of points.

GetFurthestPoint ( IEnumerable cloud, IntPoint referencePoint ) : IntPoint

Find furthest point from the specified point.

GetFurthestPointFromLine ( IEnumerable cloud, IntPoint linePoint1, IntPoint linePoint2 ) : IntPoint

Find the furthest point from the specified line.

The method finds the furthest point from the specified line. Unlike the GetFurthestPointsFromLine( IEnumerable{IntPoint}, IntPoint, IntPoint, out IntPoint, out IntPoint ) method, this method find only one point, which is the furthest away from the line regardless of side from the line.

GetFurthestPointFromLine ( IEnumerable cloud, IntPoint linePoint1, IntPoint linePoint2, float &distance ) : IntPoint

Find the furthest point from the specified line.

The method finds the furthest point from the specified line. Unlike the GetFurthestPointsFromLine( IEnumerable{IntPoint}, IntPoint, IntPoint, out IntPoint, out float, out IntPoint, out float ) method, this method find only one point, which is the furthest away from the line regardless of side from the line.

GetFurthestPointsFromLine ( IEnumerable cloud, IntPoint linePoint1, IntPoint linePoint2, IntPoint &furthestPoint1, IntPoint &furthestPoint2 ) : void

Find two furthest points from the specified line.

The method finds two furthest points from the specified line, where one point is on one side from the line and the second point is on another side from the line.

GetFurthestPointsFromLine ( IEnumerable cloud, IntPoint linePoint1, IntPoint linePoint2, IntPoint &furthestPoint1, float &distance1, IntPoint &furthestPoint2, float &distance2 ) : void

Find two furthest points from the specified line.

The method finds two furthest points from the specified line, where one point is on one side from the line and the second point is on another side from the line.

Shift ( IList cloud, IntPoint shift ) : void

Shift cloud by adding specified value to all points in the collection.

Method Details

FindQuadrilateralCorners() public static method

Find corners of quadrilateral or triangular area, which contains the specified collection of points.

The method makes an assumption that the specified collection of points form some sort of quadrilateral/triangular area. With this assumption it tries to find corners of the area.

The method does not search for bounding quadrilateral/triangular area, where all specified points are inside of the found quadrilateral/triangle. Some of the specified points potentially may be outside of the found quadrilateral/triangle, since the method takes corners only from the specified collection of points, but does not calculate such to form true bounding quadrilateral/triangle.

See QuadrilateralRelativeDistortionLimit property for additional information.

public static FindQuadrilateralCorners ( IEnumerable cloud ) : List
cloud IEnumerable Collection of points to search quadrilateral for.
return List

GetBoundingRectangle() public static method

Get bounding rectangle of the specified list of points.
public static GetBoundingRectangle ( IEnumerable cloud, IntPoint &minXY, IntPoint &maxXY ) : void
cloud IEnumerable Collection of points to get bounding rectangle for.
minXY AForge.IntPoint Point comprised of smallest X and Y coordinates.
maxXY AForge.IntPoint Point comprised of biggest X and Y coordinates.
return void

GetCenterOfGravity() public static method

Get center of gravity for the specified list of points.
public static GetCenterOfGravity ( IEnumerable cloud ) : Point
cloud IEnumerable List of points to calculate center of gravity for.
return Point

GetFurthestPoint() public static method

Find furthest point from the specified point.
public static GetFurthestPoint ( IEnumerable cloud, IntPoint referencePoint ) : IntPoint
cloud IEnumerable Collection of points to search furthest point in.
referencePoint AForge.IntPoint The point to search furthest point from.
return AForge.IntPoint

GetFurthestPointFromLine() public static method

Find the furthest point from the specified line.

The method finds the furthest point from the specified line. Unlike the GetFurthestPointsFromLine( IEnumerable{IntPoint}, IntPoint, IntPoint, out IntPoint, out IntPoint ) method, this method find only one point, which is the furthest away from the line regardless of side from the line.

public static GetFurthestPointFromLine ( IEnumerable cloud, IntPoint linePoint1, IntPoint linePoint2 ) : IntPoint
cloud IEnumerable Collection of points to search furthest point in.
linePoint1 AForge.IntPoint First point forming the line.
linePoint2 AForge.IntPoint Second point forming the line.
return AForge.IntPoint

GetFurthestPointFromLine() public static method

Find the furthest point from the specified line.

The method finds the furthest point from the specified line. Unlike the GetFurthestPointsFromLine( IEnumerable{IntPoint}, IntPoint, IntPoint, out IntPoint, out float, out IntPoint, out float ) method, this method find only one point, which is the furthest away from the line regardless of side from the line.

public static GetFurthestPointFromLine ( IEnumerable cloud, IntPoint linePoint1, IntPoint linePoint2, float &distance ) : IntPoint
cloud IEnumerable Collection of points to search furthest points in.
linePoint1 AForge.IntPoint First point forming the line.
linePoint2 AForge.IntPoint Second point forming the line.
distance float Distance between the furthest found point and the given line.
return AForge.IntPoint

GetFurthestPointsFromLine() public static method

Find two furthest points from the specified line.

The method finds two furthest points from the specified line, where one point is on one side from the line and the second point is on another side from the line.

public static GetFurthestPointsFromLine ( IEnumerable cloud, IntPoint linePoint1, IntPoint linePoint2, IntPoint &furthestPoint1, IntPoint &furthestPoint2 ) : void
cloud IEnumerable Collection of points to search furthest points in.
linePoint1 AForge.IntPoint First point forming the line.
linePoint2 AForge.IntPoint Second point forming the line.
furthestPoint1 AForge.IntPoint First found furthest point.
furthestPoint2 AForge.IntPoint Second found furthest point (which is on the /// opposite side from the line compared to the );
return void

GetFurthestPointsFromLine() public static method

Find two furthest points from the specified line.

The method finds two furthest points from the specified line, where one point is on one side from the line and the second point is on another side from the line.

public static GetFurthestPointsFromLine ( IEnumerable cloud, IntPoint linePoint1, IntPoint linePoint2, IntPoint &furthestPoint1, float &distance1, IntPoint &furthestPoint2, float &distance2 ) : void
cloud IEnumerable Collection of points to search furthest points in.
linePoint1 AForge.IntPoint First point forming the line.
linePoint2 AForge.IntPoint Second point forming the line.
furthestPoint1 AForge.IntPoint First found furthest point.
distance1 float Distance between the first found point and the given line.
furthestPoint2 AForge.IntPoint Second found furthest point (which is on the /// opposite side from the line compared to the );
distance2 float Distance between the second found point and the given line.
return void

Shift() public static method

Shift cloud by adding specified value to all points in the collection.
public static Shift ( IList cloud, IntPoint shift ) : void
cloud IList Collection of points to shift their coordinates.
shift AForge.IntPoint Point to shift by.
return void