internal double GetFirstNegativeTiltedBorder(Border firstBorder) { double boxNewNextY = LayoutManager.LocationMachine.OriginY + LayoutManager.LocationMachine.NextRowStart; LinearLine line = new LinearLine(firstBorder); return(line.GetXIntersect(boxNewNextY)); }
public SliderFormat(string[] split) { x = float.Parse(split[0]); y = float.Parse(split[1]); timeInMs = int.Parse(split[2]); group = int.Parse(split[3]); var typeAndAnchorSplit = split[5].Split('|'); var anchors = typeAndAnchorSplit.Skip(1).ToArray(); foreach (var anchor in anchors) { var xy = anchor.Split(':').Select(float.Parse).ToArray(); vectors.Add(new Vector2(xy[0], xy[1])); } switch (typeAndAnchorSplit[0]) { case "L": type = SliderType.LinearLine; points = LinearLine.GetPoints(new Vector2(x, y), vectors[0]); break; case "P": { type = SliderType.PerfectCurve; var list = new List <Vector3>(vectors); list.Insert(0, new Vector3(x, y, 0)); points = PerfectCurve.GetPoints(list); break; } case "B": { type = SliderType.BezierCurve; var list = new List <Vector3>(vectors); list.Insert(0, new Vector3(x, y, 0)); points = BezierCurve.GetPoints(list); break; } } sliderTrips = int.Parse(split[6]); tripMs = double.Parse(split[7]); }
internal double GetFirstPositiveTiltedBorder(Border firstBorder) { LocationStatemachine.Machine m = LayoutManager.LocationMachine; double boxNewNextY = GetYPointTouchesBorder(m.CurrentBoxReference, typeof(FirstBorderPositive), firstBorder); //if (this.GetType() == typeof (DirectionL2R)) //{ // boxNewNextY = m.OriginY + LayoutManager.LocationMachine.NextRowStart + m.CurrentBoxToPlace.Height; //} //else //{ // boxNewNextY = m.OriginY + LayoutManager.LocationMachine.NextRowStart; //} LinearLine line = new LinearLine(firstBorder); return(line.GetXIntersect(boxNewNextY)); }
public IEnumerable <TiltBorder> GetAngledBordersInPath(ColoBox boxToPlace, double y) { //1. collect all the angled borders in the path //3. create virtual borders as vertical in the correct position so we can consider that point as the valid next point to place a given box //4. order the borders (sort) HashSet <string> foundPositive = new HashSet <string>(); HashSet <string> foundNegative = new HashSet <string>(); List <TiltBorder> retVal = new List <TiltBorder>(); List <TiltBorder> bordersWithinPath = new List <TiltBorder>(); foreach (TiltBorder b in BorderVerifier.Tilted) { if (b.BoxWhichBelongTo != boundingBox) { continue; } LinearLine line = new LinearLine(b); double lowY, highY; double rY = Math.Round(y); double yOut; Utility.BorderEndpoints(b, InitParam.Tolerance, y, out lowY, out highY, out yOut); string pKey = string.Format("{0}p", yOut); string nKey = string.Format("{0}n", yOut); if (b.BorderType == Orientation.Positive) { if (yOut >= lowY && yOut <= highY) //&& ! foundNegative.Contains(nKey)) { foundPositive.Add(pKey); //minY is applicaple for both path (upper and lower) b.BoxTouchingBox = line.GetXIntersect(y); bordersWithinPath.Add(b); } } if (b.BorderType == Orientation.Negative)// && !foundPositive.Contains(pKey)) { if (yOut >= lowY && yOut <= highY) { foundNegative.Add(nKey); //minY is applicaple for both path (upper and lower) b.BoxTouchingBox = line.GetXIntersect(y); bordersWithinPath.Add(b); } } } bordersWithinPath.Sort(); foreach (TiltBorder b in bordersWithinPath) { TiltBorder nb = new TiltBorder { Coordinate = b.BoxTouchingBox }; retVal.Add(nb); } return(retVal); }
public LinearSystem3(int rows = 3) { var obj = new LinearLine[rows]; this.lines = obj.Select(x => x = new LinearLine(rows)).ToArray(); }