public static bool PlotTileTale(Vector2 start, Vector2 end, float width, Utils.PerLinePoint plot) { float single1 = width / 2f; Vector2 vector2 = end - start; Vector2 vector21 = vector2 / vector2.Length(); Vector2 vector22 = new Vector2(-vector21.Y, vector21.X); Point point3 = start.ToTileCoordinates(); Point point4 = end.ToTileCoordinates(); int num = 0; Utils.PlotLine(point3.X, point3.Y, point4.X, point4.Y, (int x, int y) => { num++; return(true); }, true); num--; int num1 = 0; return(Utils.PlotLine(point3.X, point3.Y, point4.X, point4.Y, (int x, int y) => { float single = 1f - (float)num1 / (float)num; num1++; Point tileCoordinates = (start - ((vector22 * single1) * single)).ToTileCoordinates(); Point point = (start + ((vector22 * single1) * single)).ToTileCoordinates(); Point point1 = new Point(tileCoordinates.X - point3.X, tileCoordinates.Y - point3.Y); Point point2 = new Point(point.X - point3.X, point.Y - point3.Y); return Utils.PlotLine(x + point1.X, y + point1.Y, x + point2.X, y + point2.Y, plot, false); }, true)); }
public static bool PlotTileTale(Vector2 start, Vector2 end, float width, Utils.PerLinePoint plot) { float halfWidth = width / 2f; Vector2 vector2_1 = end - start; Vector2 vector2_2 = vector2_1 / vector2_1.Length(); Vector2 perpOffset = new Vector2(-vector2_2.Y, vector2_2.X); Point pointStart = Utils.ToTileCoordinates(start); Point point1 = Utils.ToTileCoordinates(end); int length = 0; Utils.PlotLine(pointStart.X, pointStart.Y, point1.X, point1.Y, (Utils.PerLinePoint)((x, y) => { ++length; return(true); }), true); --length; int curLength = 0; return(Utils.PlotLine(pointStart.X, pointStart.Y, point1.X, point1.Y, (Utils.PerLinePoint)((x, y) => { float num = (float)(1.0 - (double)curLength / (double)length); ++curLength; Point point2 = Utils.ToTileCoordinates(start - perpOffset * halfWidth * num); Point point3 = Utils.ToTileCoordinates(start + perpOffset * halfWidth * num); Point point4 = new Point(point2.X - pointStart.X, point2.Y - pointStart.Y); Point point5 = new Point(point3.X - pointStart.X, point3.Y - pointStart.Y); return Utils.PlotLine(x + point4.X, y + point4.Y, x + point5.X, y + point5.Y, plot, false); }), true)); }
public static bool PlotTileLine(Vector2 start, Vector2 end, float width, Utils.PerLinePoint plot) { float single = width / 2f; Vector2 vector2 = end - start; Vector2 vector21 = vector2 / vector2.Length(); Vector2 vector22 = new Vector2(-vector21.Y, vector21.X) * single; Point tileCoordinates = (start - vector22).ToTileCoordinates(); Point point = (start + vector22).ToTileCoordinates(); Point tileCoordinates1 = start.ToTileCoordinates(); Point point1 = end.ToTileCoordinates(); Point point2 = new Point(tileCoordinates.X - tileCoordinates1.X, tileCoordinates.Y - tileCoordinates1.Y); Point point3 = new Point(point.X - tileCoordinates1.X, point.Y - tileCoordinates1.Y); return(Utils.PlotLine(tileCoordinates1.X, tileCoordinates1.Y, point1.X, point1.Y, (int x, int y) => Utils.PlotLine(x + point2.X, y + point2.Y, x + point3.X, y + point3.Y, plot, false), true)); }
public static bool PlotTileLine(Vector2 start, Vector2 end, float width, Utils.PerLinePoint plot) { float num = width / 2f; Vector2 vector2_1 = end - start; Vector2 vector2_2 = vector2_1 / vector2_1.Length(); Vector2 vector2_3 = new Vector2(-vector2_2.Y, vector2_2.X) * num; Point point1 = Utils.ToTileCoordinates(start - vector2_3); Point point2 = Utils.ToTileCoordinates(start + vector2_3); Point point3 = Utils.ToTileCoordinates(start); Point point4 = Utils.ToTileCoordinates(end); Point lineMinOffset = new Point(point1.X - point3.X, point1.Y - point3.Y); Point lineMaxOffset = new Point(point2.X - point3.X, point2.Y - point3.Y); return(Utils.PlotLine(point3.X, point3.Y, point4.X, point4.Y, (Utils.PerLinePoint)((x, y) => Utils.PlotLine(x + lineMinOffset.X, y + lineMinOffset.Y, x + lineMaxOffset.X, y + lineMaxOffset.Y, plot, false)), true)); }
public static bool PlotLine(Point p0, Point p1, Utils.PerLinePoint plot, bool jump = true) { return(Utils.PlotLine(p0.X, p0.Y, p1.X, p1.Y, plot, jump)); }