public static void SetOnLineBetween(double d, Edge currentEdge, Edge nextEdge) { Vertice start = currentEdge.Start; Vertice middle = currentEdge.End; Vertice end = nextEdge.End; double distance = DistanceHelpers.DistanceBetween(start, end); double proportion = d / distance; Vertice resultVertice = PointHelpers.GetPointInProportion(proportion, start, end); if (resultVertice.x < int.MinValue + 100 || resultVertice.y > int.MaxValue - 100 || resultVertice.y < int.MinValue + 100 || resultVertice.y > int.MaxValue - 100) { int xdddd = 2; } PointHelpers.SetPointXY(middle, resultVertice.x, resultVertice.y); }
public static void ShortenLineForEdge(double d, Edge currentEdge, Edge nextEdge) { Vertice start = currentEdge.Start; Vertice middle = currentEdge.End; Vertice end = nextEdge.End; Vertice helper = new Vertice(end.x - CONST.ShortenLineForEdgeDistance, end.y - CONST.ShortenLineForEdgeDistance); (double, double)lineHelp = Line.GetStraightLine(helper, end); Vertice resultVertice = PointHelpers.GetPointInProportion(1 / 2, helper, end); (double, double)line = Line.GetStraightLine(start, resultVertice); (Vertice, Vertice)midVertices = PointHelpers.GetPointFromLineDistanceAndPoint(line, d, currentEdge.Start); Vertice midVertice = DistanceHelpers.GetCloserVerticeFromLine(lineHelp, midVertices); PointHelpers.SetPointXY(middle, midVertice.x, midVertice.y); }