internal override double GetFirstBorderCoordinate(DirectionBase dc) { double minVerticalX = double.MaxValue; //double minTiltedX; //First phase, we need to find the min X coordinate of the vertical border with in the path foreach (Border b in stateMachine.BorderVerifier.VerticalX) { double minBoxToPlaceY = dc.GetYPointTouchesBorder(stateMachine.CurrentBoxReference, this.GetType(), b);// stateMachine.CurrentBoxReference.MinY; if (minBoxToPlaceY >= b.Endpoints[0].coordinate1 && minBoxToPlaceY <= b.Endpoints[0].coordinate2) { if (b.Coordinate < minVerticalX) { stateMachine.CurrentBoxReference.BorderUsedToGetRowStartX = b; minVerticalX = b.Coordinate; } } } //second phase, find the first tilted border within the path double firstTildedBorderCoordinate = dc.GetFirstPositiveTiltedBorder(FirstBorder); return(minVerticalX); }
//find out if the first border to hit in the current path is vertical or tilted internal static FirstBorderBase GetFirstBorderToHit(Machine stateMachine, DirectionBase dir) { if (dir is DirectionL2R) { return(GetFirstBorderL2R(stateMachine)); } else { return(GetFirstBorderR2L(stateMachine)); } }
internal override double GetFirstBorderCoordinate(DirectionBase dc) { double minVerticalX = double.MaxValue; double minTiltedX; double minBoxToPlaceY = stateMachine.CurrentBoxReference.MinY; //First phase, we need to find the min X coordinate of the vertical border with in the path foreach (Border b in stateMachine.BorderVerifier.HorizontalY) { if (minBoxToPlaceY >= b.Endpoints[0].coordinate1 && minBoxToPlaceY <= b.Endpoints[0].coordinate2) { if (b.Coordinate < minVerticalX) { minVerticalX = b.Coordinate; } } } //second phase, find the first tilted border within the path minTiltedX = dc.GetFirstNegativeTiltedBorder(FirstBorder); return(minTiltedX); }
internal abstract double GetFirstBorderCoordinate(DirectionBase dc);