Осталось продублировать фрагменты для генерации последней строки кода.
Вот это работает.
Pascal | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
| count1:=yRazmerY;////кроме последней строки
if Not (count1 = 0) Then begin //2
marking1:
Inc(y);
p := @p1;
x := xRazmerX;
BremainderstepsFrequentCicles:=remainderstepsFrequentCicles;//3
BstepsSetapInLine:=stepsSetapInLine;
Balternation:=alternation;
BstepsFrequentCicles:=stepsBig;
BstepFrequent:=stepFrequent;///3
count2:=remainderCicles;//4
TracerY := y - steps1;
formula1:= stepFrequent * y + znak *trunc(y / (SummSteps));
if TracerY < 0 then
begin
TracerX := RazmerX - formula1;
if TracerX < 0 then TracerX := 0;
TracerY := 0;
end else TracerX := 0;
if Not (count2 = 0) Then begin
marking2:
count3:=BremainderstepsFrequentCicles;//5
if Not (count3 = 0) Then begin
marking3:
count4:=BstepsSetapInLine;//6
if Not (count4 = 0) Then begin
marking4:
Bstep:=BstepFrequent;//7///7
count5:=Balternation;//8
if Not (count5 = 0) Then begin
marking5:
count6:=BstepsFrequentCicles;//9
if Not (count6 = 0) Then
begin
marking6:
count7:=Bstep;//10
//count7
if Not (count7 = 0) Then begin
marking7:
{%REGION 'Engine'}
asm
JMP p
end;
p1:
StringGrid1.Cells[px^, py^] := IntToStr(pTracerX^) + ',' + IntToStr(pTracerY^) + ',' + '1';
//запись правого столбца
p := @p3;
goto p4;
p2:
y1:=y+1;
//автоматическое забивание координат в местах скоса трассы
p := @p3;
goto p5;
p3:
y1:=y;
p5:
x1:=x-xInc;
StringGrid1.Cells[px^, py^] := IntToStr(px1^) + ',' + IntToStr(py1^) + ',' + '0';
//автоматическое забивание координат трассы на прямых участках
p4:
x:=x+xInc;
{%ENDREGION}
dec(count7);
if Not (count7 = 0) then goto marking7;
end;///10
p := @p2; /////count7
dec(count6);
if Not (count6 = 0) then goto marking6;
end;//11
Bstep:=stepRare;//12
BstepsFrequentCicles:=1;
dec(count5);
if Not (count5 = 0) then goto marking5;
end;//13
BstepFrequent:=stepFrequent;//14
BstepsFrequentCicles:=stepsBig;
dec(count4);
if Not (count4 = 0) then goto marking4;
end;//15
BremainderstepsFrequentCicles:=1;//16
BstepsSetapInLine:=1;
Balternation:=1;
BstepsFrequentCicles:=remainderstepsFrequent;///16
dec(count3);
if Not (count3 = 0) then goto marking3;
end;//17
if BremainderstepsFrequentCicles = 0 then begin
BstepsSetapInLine:=1;
Balternation:=1;
end;
BstepFrequent:=remainder;//18
BremainderstepsFrequentCicles:=1;
BstepsFrequentCicles:=1;
dec(count2);
if Not (count2 = 0) then goto marking2;
end;//19
dec(count1);
if Not (count1 = 0) then goto marking1;
end; //20 |
|
В комментариях номера блоков, схема конечно не полна, но какое-как напоминает нодовую систему.
И что я могу сказать- это работает хорошо, и увеличение скорости выполнения есть - наблюдается если угол равен нулю, остальные варианты угла остаются по скорости выполнения прежними, но это потому что видимо происходит подгрузка кода из-за меток и переходов, а сам код очень даже не объёмный. Так как это часть кода, то можно было бы и дать пользователю возможность использования кэша процессора. Имей например я такую возможность - увеличил бы бысьтродействие программы ещё, помимо того что не стал использовать алгоритм Брезенхема. |