/* Returns true if the stroke is somewhat closed in the * sense that it comes back to itself. Accomplishes * this by checking the distance between the first point * in the stroke and the last point in the stroke. */ public static bool isClosed(Stroke s, double tolerance) { if (s == null) { return(false); } Point[] pts = { s.GetPoint(0), s.GetPoint(s.PacketCount - 1) }; return(StrokeManager.Distance(pts[0], pts[1]) <= tolerance); }
//Gets the length of a stroke public static double StrokeLength(Stroke e) { double dist = 0; Point[] points = e.GetPoints(); for (int i = 0; i < points.Length - 1; i++) { dist += StrokeManager.Distance(points[i], points[i + 1]); } return(dist); }