public Line2D(Sketch parent, Point2D start, Point2D end) : base(parent, start, end) { }
public FullLine2D(Point2D point, double angle) { //this.Point = new Point(point.X, point.Y); this.Points2D.Add(point); this.Vector = new Vector(Math.Cos(angle), Math.Sin(angle)); }
public FullLine2D(Point2D point1, Point2D point2) { //this.Point = new Point(point1.X, point1.Y); this.Points2D.Add(point1); this.Vector = point2.Point - point1.Point; //new Vector(point2.X - point1.X, point2.Y - point1.Y); }
public IIntersectable SatisfyRelations(Point? p = null) { IList<IIntersectable> possibles = new List<IIntersectable>(); foreach (Relation2D rel in this.Relations2D) { if (rel.IsDriven(this) && rel.ChildRelations.Count == 0) { IIntersectable temp = rel.Satisfy(); possibles.Add(temp); } } switch(possibles.Count()) { case 0: return p == null ? null : new Point2D(p.Value); case 1: return possibles[0]; default: List<Point> intersections = new List<Point>(); intersections.AddMany(possibles[0].Intersection(possibles[1])); for (int i = 2; i < possibles.Count; i++) { List<Point> tempList = new List<Point>(); foreach (Point intersectionPoint in intersections) { Point2D p2d = new Point2D(intersectionPoint); tempList.AddMany(possibles[i].Intersection(p2d)); } intersections.Clear(); intersections.AddMany(tempList); } return intersections.Count > 0 ? new Point2D(intersections.GetNearest(this.Point).Value) : null; } }
public FullLine2D(Point2D point, Vector vector) { //this.Point = new Point(point.X, point.Y); this.Points2D.Add(point); this.Vector = vector; }
public Ray2D(Point2D point1, Point2D point2) { this.Point = point1.Point; this.Vector = point2.Point - point1.Point; }
public Ray2D(Point2D point, double angle) { this.Point = point.Point; this.Vector = new Vector(Math.Cos(angle), Math.Sin(angle)); }
public Ray2D(Point2D point, Vector vector) { this.Point = point.Point; this.Vector = vector; }
public Line2D(Point2D startPoint, Point2D endPoint) { this.Points2D.Add(startPoint); this.Points2D.Add(endPoint); }
public static Point? GetNearest(Point2D p1, Point p2) { return p1.Point; }