/// <summary> /// colors and indices are lost!! /// </summary> /// <param name="pc"></param> /// <returns></returns> public static PointCloud ResizeAndSort_Distance(PointCloud pc) { pc.ResizeTo1(); List <Vertex> vList = new List <Vertex>(); if (pc.Colors == null || pc.Colors.Length != pc.Vectors.Length) { pc.SetDefaultColors(); } for (int i = 0; i < pc.Vectors.Length; i++) { Vertex v = new Vertex(pc.Vectors[i]); v.Color = pc.Colors[i]; vList.Add(v); } vList.Sort(new Vector_Length()); PointCloud pcNew = PointCloud.FromListVertices(vList); return(pcNew); }