float compare3(puncte[] points, puncte[] _points) { int[] unghi = new int[points.Length]; int[] _unghi = new int[_points.Length]; int[] lung = new int[points.Length]; int[] _lung = new int[_points.Length]; int size = 0; if (points.Length < _points.Length) size = points.Length; else size = _points.Length; if (Math.Abs(points.Length - _points.Length) > points.Length / 2) { return 0; } for (int i = 1; i < points.Length - 1; i++) { unghi[i] = (int)unghi_(points.ElementAt(i - 1), points.ElementAt(i), points.ElementAt(i + 1)); lung[i] = (int)Math.Sqrt(Math.Pow((points.ElementAt(i).x - points.ElementAt(i + 1).x), 2) + Math.Pow((points.ElementAt(i).y - points.ElementAt(i + 1).y), 2)); } for (int i = 1; i < _points.Length - 1; i++) { _unghi[i] = (int)unghi_(_points.ElementAt(i - 1), _points.ElementAt(i), _points.ElementAt(i + 1)); _lung[i] = (int)Math.Sqrt(Math.Pow((_points.ElementAt(i).x - _points.ElementAt(i + 1).x), 2) + Math.Pow((_points.ElementAt(i).y - _points.ElementAt(i + 1).y), 2)); } int nr = 0; for (int i = 1; i < size - 2; i++) if (Math.Abs(unghi[i] - _unghi[i]) <= 20) //&& Math.Abs(lung[i] - _lung[i]) < 50) nr++; return nr * 100 / (points.Length - 2); }
float centru_intern(puncte[] points, puncte[] _points) { // luam punctele de centru din ambele puncte centru = new puncte(); puncte _centru = new puncte(); int minX = 99999, maxX = 0, minY = 99999, maxY = 0; int _minX = 99999, _maxX = 0, _minY = 99999, _maxY = 0; for (int i = 0; i < points1.Length; i++) { if (points1.ElementAt(i).x < minX) minX = points1.ElementAt(i).x; if (points1.ElementAt(i).x > maxX) maxX = points1.ElementAt(i).x; if (points1.ElementAt(i).y < minY) minY = points1.ElementAt(i).y; if (points1.ElementAt(i).y > maxY) maxY = points1.ElementAt(i).y; } for (int i = 0; i < points2.Length; i++) { if (points2.ElementAt(i).x < _minX) _minX = points2.ElementAt(i).x; if (points2.ElementAt(i).x > _maxX) _maxX = points2.ElementAt(i).x; if (points2.ElementAt(i).y < _minY) _minY = points1.ElementAt(i).y; if (points2.ElementAt(i).y > _maxY) _maxY = points1.ElementAt(i).y; } _centru.x = (_minX + _maxX) / 2; _centru.y = (_minY + _maxY) / 2; centru.x = (minX + maxY) / 2; centru.y = (minY + maxY) / 2; // terminat de luat punctele int[] rap = new int[1000]; int[] _rap = new int[1000]; int size = 0; if (points.Length < _points.Length) size = points.Length; else size = _points.Length; if (Math.Abs(points.Length - _points.Length) > points.Length / 2) { return 0; } int k = 0; for (int i = 0; i < points.Length; i++) { int temp = 1; temp = (int)Math.Sqrt(Math.Pow((points.ElementAt(i).x - centru.x), 2) + Math.Pow((points.ElementAt(i).y - centru.y), 2)); rap[i] = temp; // temp = (int)((int) Math.sqrt(Math.pow((points.get(0).x-points.get(points.size()-1).x),2) // +Math.pow((points.get(0).y-points.get(points.size()-1).y),2)))/temp; } for (int i = 0; i < _points.Length; i++) { int temp = 1; temp = (int)Math.Sqrt(Math.Pow((_points.ElementAt(i).x - _centru.x), 2) + Math.Pow((_points.ElementAt(i).y - _centru.y), 2)); _rap[i] = temp; // temp = (int)((int) Math.sqrt(Math.pow((_points.get(0).x-_points.get(_points.size()-1).x),2) // +Math.pow((_points.get(0).y-_points.get(_points.size()-1).y),2)))/temp; } int nr = 0; for (int i = 0; i < size; i++) if (Math.Abs(rap[i] - _rap[i]) <= 5000) nr++; return nr * 100 / (points.Length); }