private void AddEdge(ref GraphNodeRasterizer.Edge e0, ref GraphNodeRasterizer.Edge e1, object data) { if (e0.y0 == e0.y1 || e1.y0 == e1.y1) { return; } float num = (float)(e0.y1 - e0.y0) * 0.001f; float num2 = (float)(e1.y1 - e1.y0) * 0.001f; float num3 = (float)(e0.x1 - e0.x0) * 0.001f; float num4 = (float)(e1.x1 - e1.x0) * 0.001f; float num5 = (float)(e1.y0 - e0.y0) / num; float num6 = (float)this.cellSize / num; float num7 = 0f; float num8 = (float)this.cellSize / num2; int i = e1.y0; int num9 = this.cellSize; int num10 = (i - this.origin.y) % this.cellSize; if (num10 != 0) { num9 = this.cellSize - num10; } while (i <= e1.y1) { this.tempVar[0] = num3 * num5 + (float)e0.x0; this.tempVar[1] = num4 * num7 + (float)e1.x0; float num11 = 1f; if (i + num9 <= e1.y1) { if (num9 != this.cellSize) { num11 = (float)num9 / (float)this.cellSize; } } else { num11 = (float)(e1.y1 - i) / (float)this.cellSize; } num5 += num6 * num11; num7 += num8 * num11; this.tempVar[2] = num3 * num5 + (float)e0.x0; this.tempVar[3] = num4 * num7 + (float)e1.x0; int num12 = Mathf.FloorToInt(Mathf.Min(this.tempVar)); int num13 = Mathf.CeilToInt(Mathf.Max(this.tempVar)); int y = (i - this.origin.y) / this.cellSize; int x = (num12 - this.origin.x) / this.cellSize; int x2 = (num13 - this.origin.x) / this.cellSize; this.AddLine(x, x2, y, data); i += num9; num9 = this.cellSize; } }
private void InitEdge(ref Int2 v0, ref Int2 v1, int index) { GraphNodeRasterizer.Edge edge = default(GraphNodeRasterizer.Edge); if (v0.y < v1.y) { edge.x0 = v0.x; edge.y0 = v0.y; edge.x1 = v1.x; edge.y1 = v1.y; } else { edge.x0 = v1.x; edge.y0 = v1.y; edge.x1 = v0.x; edge.y1 = v0.y; } this.edges[index] = edge; }