private bool JudgeStrokeCount(List <SketchStroke> sample, List <SketchStroke> template)
        {
            this.SampleStrokeCount   = sample.Count;
            this.TemplateStrokeCount = template.Count;

            if (this.SampleStrokeCount == this.TemplateStrokeCount)
            {
                this.StrokeToStrokeCorrespondenceSameCount = SketchFeatureExtraction.StrokeToStrokeCorrespondenceSameCount(sample, template);
                return(true);
            }
            else
            {
                if (sample.Count < template.Count) // Concatenating strokes
                {
                    this.ConcatenatingCorrespondence = SketchFeatureExtraction.StrokeToStrokeCorrespondenceConcatenating(sample, template);
                    foreach (List <int> templateIndices in this.ConcatenatingCorrespondence)
                    {
                        Debug.Write("Sample: ");
                        foreach (int templateIndex in templateIndices)
                        {
                            Debug.Write(templateIndex + ", ");
                        }
                        Debug.WriteLine("");
                    }
                }
                else // Broken strokes
                {
                    this.BrokenStrokeCorrespondence = SketchFeatureExtraction.StrokeToStrokeCorrespondenceBroken(sample, template);
                    foreach (List <int> sampleIndices in this.BrokenStrokeCorrespondence)
                    {
                        Debug.Write("Template: ");
                        foreach (int sampleIndex in sampleIndices)
                        {
                            Debug.Write(sampleIndex + ", ");
                        }
                        Debug.WriteLine("");
                    }
                }

                return(false);
            }
        }
        public static List <SketchStroke> ScaleSquare(List <SketchStroke> strokes, double size)
        {
            double width  = SketchFeatureExtraction.Width(strokes);
            double height = SketchFeatureExtraction.Height(strokes);

            List <SketchStroke> newStrokes = new List <SketchStroke>();

            foreach (SketchStroke stroke in strokes)
            {
                List <SketchPoint> newPoints = new List <SketchPoint>();
                foreach (SketchPoint point in stroke.Points)
                {
                    newPoints.Add(new SketchPoint(point.X * size / width, point.Y * size / height));
                }
                SketchStroke newStroke = new SketchStroke(newPoints, stroke.TimeStamp);
                newStrokes.Add(newStroke);
            }

            return(newStrokes);
        }
        private bool JudgeIntersection(List <SketchStroke> sample, List <SketchStroke> template)
        {
            if (!IsCorrectStrokeCount)
            {
                return(false);
            }

            this.SampleIntersectionMatrix   = SketchFeatureExtraction.IntersectionMatrix(sample, StrokeToStrokeCorrespondenceSameCount, WrongDirectionStrokeIndices);
            this.TemplateIntersectionMatrix = SketchFeatureExtraction.IntersectionMatrix(template);

            for (int i = 0; i < sample.Count; i++)
            {
                for (int j = 0; j < sample.Count; j++)
                {
                    if (SampleIntersectionMatrix[i, j] != TemplateIntersectionMatrix[i, j])
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
 public static List <SketchStroke> TranslateCentroid(List <SketchStroke> strokes, SketchPoint origin)
 {
     return(Translate(strokes, origin, SketchFeatureExtraction.Centroid(strokes)));
 }