private LineSeries WindowCrossings(OneForm xOneForm, int length) { var allCrossings = new List <Tuple <double, double> >(); var windowEnteringCrossings = new List <Tuple <double, double> >(); foreach (var constraint in Constraints) { allCrossings.Add(Intersection(xOneForm, length, constraint)); } foreach (var pt in allCrossings) { if (Constraints.Any(c => c.Violate(pt))) { continue; } windowEnteringCrossings.Add(pt); } var lineSeries = new LineSeries() { LineStyle = (length == 0 ? LineStyle.Solid : LineStyle.Dash), Color = (length == 0 ? OxyColors.Black : OxyColors.Gray), StrokeThickness = (length == 0 ? 2 : 0.5) }; windowEnteringCrossings.ForEach(c => lineSeries.Points.Add(new DataPoint(c.Item1, c.Item2))); return(lineSeries); }
private Tuple <double, double> Intersection(OneForm o, int z, Constraint c) { // intersection betwen the line normal to a vector from the origin to point and the constraint var y = o.X * c.Length * c.Length - c.X * z; y /= (o.X * c.Y - c.X * o.Y); var x = (z - o.Y * y) / o.X; return(new Tuple <double, double>(x, y)); }
/// <summary> /// Returns lines associated with the supplied 1-form /// </summary> /// <param name="oneForm"></param> /// <returns></returns> public IEnumerable <LineSeries> Lines(OneForm oneForm) { yield return(WindowCrossings(oneForm, 0)); var length = 1; while (EntersWindow(oneForm, length)) { yield return(WindowCrossings(oneForm, length++)); } length = -1; while (EntersWindow(oneForm, length)) { yield return(WindowCrossings(oneForm, length--)); } }
private bool EntersWindow(OneForm xOneForm, int length) { var entersWindow = false; foreach (var constraint in Constraints) { var intersection = Intersection(xOneForm, length, constraint); bool outside = false; foreach (var c in Constraints) { if (c.Violate(intersection)) { outside = true; } } if (outside == false) { entersWindow = true; } } return(entersWindow); }
private LineSeries WindowCrossings(OneForm xOneForm, int length) { var allCrossings = new List<Tuple<double, double>>(); var windowEnteringCrossings = new List<Tuple<double, double>>(); foreach (var constraint in Constraints) { allCrossings.Add(Intersection(xOneForm, length, constraint)); } foreach(var pt in allCrossings) { if (Constraints.Any(c => c.Violate(pt))) continue; windowEnteringCrossings.Add(pt); } var lineSeries = new LineSeries() { LineStyle = (length == 0 ? LineStyle.Solid : LineStyle.Dash), Color = (length == 0 ? OxyColors.Black : OxyColors.Gray), StrokeThickness = (length == 0 ? 2 : 0.5) }; windowEnteringCrossings.ForEach(c => lineSeries.Points.Add(new DataPoint(c.Item1, c.Item2))); return lineSeries; }
private Tuple<double, double> Intersection(OneForm o, int z, Constraint c) { // intersection betwen the line normal to a vector from the origin to point and the constraint var y = o.X * c.Length * c.Length - c.X * z; y /= (o.X * c.Y - c.X * o.Y); var x = (z - o.Y * y ) / o.X; return new Tuple<double, double>(x, y); }
private Tuple<double, double> Increment(OneForm xOneForm, Tuple<double, double> point) { return new Tuple<double, double>(point.Item1 + xOneForm.UnitVector[0], point.Item2 + xOneForm.UnitVector[1]); }
private bool EntersWindow(OneForm xOneForm, int length) { var entersWindow = false; foreach (var constraint in Constraints) { var intersection = Intersection(xOneForm, length, constraint); bool outside = false; foreach(var c in Constraints) { if (c.Violate(intersection)) outside = true; } if (outside == false) entersWindow = true; } return entersWindow; }
/// <summary> /// Returns lines associated with the supplied 1-form /// </summary> /// <param name="oneForm"></param> /// <returns></returns> public IEnumerable<LineSeries> Lines(OneForm oneForm) { yield return WindowCrossings(oneForm, 0); var length = 1; while(EntersWindow(oneForm, length)) { yield return WindowCrossings(oneForm, length++); } length = -1; while (EntersWindow(oneForm, length)) { yield return WindowCrossings(oneForm, length--); } }
private Tuple <double, double> Increment(OneForm xOneForm, Tuple <double, double> point) { return(new Tuple <double, double>(point.Item1 + xOneForm.UnitVector[0], point.Item2 + xOneForm.UnitVector[1])); }