using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows; namespace SketchAssistantWPF { public class RedrawLine { InternalLine LineToRedraw; Point[] points; private int radius; private HashSet[] detectionZones; /// /// Constructor of the RedrawLine. /// /// The radius around each point of the line input will be accepted. public RedrawLine(int rad) { radius = rad; } /// /// A function to intialize the redraw line. /// /// /// public bool Init(InternalLine line) { HashSet initialZone = GeometryCalculator.FilledCircleAlgorithm(new Point(0, 0), radius); LineToRedraw = line; points = line.GetPoints().ToArray(); List> dZones = new List>(); foreach(Point p in points) { HashSet newZone = new HashSet(); foreach(Point i_p in initialZone) { newZone.Add(new Point(i_p.X + p.X, i_p.Y + p.Y)); } dZones.Add(newZone); } detectionZones = dZones.ToArray(); Console.WriteLine("This line has {0} points ", line.GetPoints().Count()); return false; } public Point GetOverlayPosition() { return points[0]; } public Angle GetDirection(Point p) { //TODO: Calculate angles between p and the next n points of the line // Take average and return it. return null; } } }