public static double EndDirection(this Stroke stroke, int diffIdx) { PointSection sect = new PointSection(stroke[Math.Max(0, stroke.Count - 1 - diffIdx)].Pos, stroke[stroke.Count - 1].Pos); return(sect.Direction()); }
public static double Direction(this PointSection section) { double dx = (double)(section.End.X - section.Start.X); double dy = (double)(section.End.Y - section.Start.Y); return(Math.Atan2(dy, dx)); }
public static double StartDirection(this Stroke stroke, int diffIdx) { PointSection sect = new PointSection(stroke.Start.Pos, stroke[Math.Min(stroke.Count - 1, diffIdx)].Pos); return(sect.Direction()); }