public static void Transform(List <FloatDouble> list, float dx, float dy) { for (int i = 0; i < list.Count; i++) { FloatDouble p = list[i]; p.X += dx; p.Y += dy; list[i] = p; } }
private void ReverseArray(List <FloatDouble> list) { int count = list.Count; for (int i = 0; i < count / 2; ++i) { FloatDouble temp = list[count - i - 1]; list[count - i - 1] = list[i]; list[i] = temp; } }
private int GetNearIndex() { int index = -1; double distense = double.MaxValue; FloatDouble p = lineUpProcessed[0]; float x0 = p.X; float y0 = p.Y; for (int i = 0; i < lineDownProcessed.Count; i++) { float x1 = lineDownProcessed[i].X; float y1 = lineDownProcessed[i].Y; double dis = Math.Sqrt((x0 - x1) * (x0 - x1) + (y0 - y1) * (y0 - y1)); if (dis < distense) { distense = dis; index = i; } } return(index); }
public void AddPoint2d(short x, short y) { FloatDouble t = new FloatDouble(x, y); points.Add(t); }