private double PDollar(List <DrawPoint> givenPoints, Shape s) { double score = Double.MaxValue; int n = 32; //Console.WriteLine("norm points"); List <DrawPoint> normPoints = normalize(givenPoints, n); //Console.WriteLine("normPoints has " + normPoints.Count); //Console.WriteLine("attempt template 1"); for (int i = 0; i < s.numTemplates; i++) { //Console.WriteLine("norm template "+i); List <DrawPoint> normTemplate = normalize(s.getTemplate(i), n); //Console.WriteLine("normTemplate{0} has {1}",i, normTemplate.Count); //Console.WriteLine("start cloudmatch"); double d = GreedyCloudMatch(normPoints, normTemplate, n); if (score > d) { score = d; } } return(score); }
private void showTemplates() { Shape shape = Shapes.getShape(currentShape); for (int j = 0; j < shape.numTemplates; j++) { List <DrawPoint> template = shape.getTemplate(j); Pen template_pen = new Pen(Color.Red); m_graphics.DrawRectangle(template_pen, (int)template[0].X, (int)template[0].Y, 1, 1); for (int i = 1; i < template.Count; i++) { if (template[i - 1].stroke == template[i].stroke) { m_graphics.DrawLine(template_pen, template[i - 1].ToPoint(), template[i].ToPoint()); } } } }
private double PDollar(List<DrawPoint> givenPoints, Shape s) { double score = Double.MaxValue; int n = 32; //Console.WriteLine("norm points"); List<DrawPoint> normPoints = normalize(givenPoints, n); //Console.WriteLine("normPoints has " + normPoints.Count); //Console.WriteLine("attempt template 1"); for (int i=0;i<s.numTemplates;i++) { //Console.WriteLine("norm template "+i); List<DrawPoint> normTemplate = normalize(s.getTemplate(i),n); //Console.WriteLine("normTemplate{0} has {1}",i, normTemplate.Count); //Console.WriteLine("start cloudmatch"); double d = GreedyCloudMatch(normPoints, normTemplate, n); if(score > d) score = d; } return score; }