二维坐标点按行排序的算法思路为:通过Y值判断坐标点是否属于同一行,再对同一行的坐标点按X值从小到大进行排序。具体C#代码实现如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TwoDimensionalCoordinatesSort
{
class Program
{
struct Point
{
public float X;
public float Y;
}
const int LineSpacing = 15; //行间距,用来判断坐标点是否属于同一行
static void Main(string[] args)
{
List<Point> RandomPointList = new List<Point>();
List<Point> SortedPointList = new List<Point>();
List<Point> YSortedPointList = new List<Point>();
List<Point> RowPointList = new Lis