public void onStrokeComplete() { DrawLine script = drawLineObj.GetComponent <DrawLine>(); List <Vector3> points = script.getPointsList(); this.corners = ShortStraw.getCornerPoints(points); markCorners(corners); charCorners[curStroke] = corners; // FIXME Debug.Log("Stroke Complete!"); }
public void getResampleSpacingTest() { List <Vector3> pList = new List <Vector3> { new Vector3(-1.0F, 0.0F), new Vector3(2.0F, 0.0F), new Vector3(0.0F, 2.0F), new Vector3(0.0F, -2.0F) }; float spacing = ShortStraw.getResamplingSpacing(pList); Assert.AreEqual(spacing, 5.0F / 40.0F); }
public void getBoundingBoxTest() { List <Vector3> pList = new List <Vector3> { new Vector3(-1.0F, 0.0F), new Vector3(1.0F, 0.0F), new Vector3(0.0F, 2.0F), new Vector3(0.0F, -2.0F) }; Vector3[] box = ShortStraw.getBoundingBox(pList); Assert.AreEqual(box[0].x, -1.0F); Assert.AreEqual(box[0].y, 2.0F); Assert.AreEqual(box[1].x, 1.0F); Assert.AreEqual(box[1].y, -2.0F); }
public void onStrokeComplete() { DrawLine script = drawLineObj.GetComponent <DrawLine>(); List <Vector3> points = script.getPointsList(); this.corners = ShortStraw.getCornerPoints(points); script.clearLine(); if (showMarks) { markCorners(corners); } charCorners[curStroke] = corners; // FIXME Debug.Log("Stroke Complete!"); //foreach (Vector3 corner in corners) { // Debug.Log(string.Format(" {0}, {1}, {2}", corner.x, corner.y, corner.z)); //} Recognizer recognizer = new Recognizer(); StrokeScore score = recognizer.getResults(corners, charData.strokes[curStroke]); Debug.Log(string.Format(" *** {0} *** angle: {1}, corners: {2}, dist: {3}", score.Pass ? "Pass" : "Fail", score.Angle, score.Corners, score.Distance)); // show sprite stroke for the just completed stroke if (score.Pass) { setStrokeSprite(charData.spriteNames[curStroke]); curStroke++; } if (curStroke >= charData.numStrokes) { // the character is complete, back out of scene Debug.Log("Character complete!"); curStroke--; } else { StartCoroutine(displayStrokeHint(curStroke)); } }