Added new variants

fixed filter buf
This commit is contained in:
ronaldhordijk 2005-03-20 18:30:21 +00:00
parent afa92f6412
commit 665af685f9
8 changed files with 155 additions and 55 deletions

View File

@ -25,11 +25,11 @@ uses
const const
EPS = 1E-10; EPS = 1E-10;
NVARS = 22; NVARS = Xform.NVARS;
NXFORMS = 12; NXFORMS = 12;
SUB_BATCH_SIZE = 10000; SUB_BATCH_SIZE = 10000;
PREFILTER_WHITE = (1 shl 26); PREFILTER_WHITE = (1 shl 26);
FILTER_CUTOFF = 2.5; FILTER_CUTOFF = 1.8;
BRIGHT_ADJUST = 2.3; BRIGHT_ADJUST = 2.3;
type type
@ -37,7 +37,8 @@ type
TLongintArray = array[0..8192] of Longint; TLongintArray = array[0..8192] of Longint;
TVariation = (vLinear, vSinusoidal, vSpherical, vSwirl, vHorseshoe, vPolar, TVariation = (vLinear, vSinusoidal, vSpherical, vSwirl, vHorseshoe, vPolar,
vHandkerchief, vHeart, vDisc, vSpiral, vHyperbolic, vSquare, vEx, vJulia, vHandkerchief, vHeart, vDisc, vSpiral, vHyperbolic, vSquare, vEx, vJulia,
vBent, vWaves, vFisheye, vPopcorn, vExponential, vPower, vCosine, vSawTooth, vRandom); vBent, vWaves, vFisheye, vPopcorn, vExponential, vPower, vCosine,
vRings, vFan, vRandom);
type type
TPointsArray = array of TCPpoint; TPointsArray = array of TCPpoint;
@ -800,14 +801,14 @@ end;
procedure TControlPoint.SetVariation(vari: TVariation); procedure TControlPoint.SetVariation(vari: TVariation);
const const
xform_distrib: array[0..12] of integer = (2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 7, 8); xform_distrib: array[0..12] of integer = (2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 7, 8);
var_distrib: array[0..40] of integer = (-1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21); var_distrib: array[0..41] of integer = (-1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22);
mixed_var_distrib: array[0..30] of integer = (0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21); mixed_var_distrib: array[0..31] of integer = (0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22);
var var
i, j, v: integer; i, j, v: integer;
rv: integer; rv: integer;
begin begin
repeat repeat
rv := var_distrib[random(41)]; rv := var_distrib[random(Length(var_distrib))];
until Variations[rv]; until Variations[rv];
for i := 0 to NXFORMS - 1 do begin for i := 0 to NXFORMS - 1 do begin
@ -820,7 +821,7 @@ begin
if rv < 0 then if rv < 0 then
begin begin
repeat repeat
v := Mixed_var_distrib[random(31)]; v := Mixed_var_distrib[random(Length(mixed_var_distrib))];
until Variations[v]; // Use only Variations set in options until Variations[v]; // Use only Variations set in options
xform[i].vars[v] := 1 xform[i].vars[v] := 1
end end
@ -835,8 +836,8 @@ end;
procedure TControlPoint.RandomCP(min: integer = 2; max: integer = NXFORMS; calc: boolean = true); procedure TControlPoint.RandomCP(min: integer = 2; max: integer = NXFORMS; calc: boolean = true);
const const
xform_distrib: array[0..12] of integer = (2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 7, 8); xform_distrib: array[0..12] of integer = (2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 7, 8);
var_distrib: array[0..40] of integer = (-1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21); var_distrib: array[0..41] of integer = (-1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22);
mixed_var_distrib: array[0..30] of integer = (0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21); mixed_var_distrib: array[0..31] of integer = (0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22);
var var
nrXforms: integer; nrXforms: integer;
i, j: integer; i, j: integer;
@ -851,7 +852,7 @@ begin
//nrXforms := xform_distrib[random(13)]; //nrXforms := xform_distrib[random(13)];
nrXforms := random(Max - (Min - 1)) + Min; nrXforms := random(Max - (Min - 1)) + Min;
repeat repeat
rv := var_distrib[random(41)]; rv := var_distrib[random(Length(var_distrib))];
until Variations[rv]; until Variations[rv];
for i := 0 to NXFORMS - 1 do begin for i := 0 to NXFORMS - 1 do begin
@ -880,7 +881,7 @@ begin
if rv < 0 then if rv < 0 then
begin begin
repeat repeat
v := Mixed_var_distrib[random(31)]; v := Mixed_var_distrib[random(Length(mixed_var_distrib))];
until Variations[v]; // use only variations set in options until Variations[v]; // use only variations set in options
xform[i].vars[v] := 1 xform[i].vars[v] := 1
end end

View File

@ -2,7 +2,7 @@ object MainForm: TMainForm
Left = 316 Left = 316
Top = 424 Top = 424
Width = 574 Width = 574
Height = 455 Height = 515
Caption = 'Apophysis' Caption = 'Apophysis'
Color = clBtnFace Color = clBtnFace
Font.Charset = ANSI_CHARSET Font.Charset = ANSI_CHARSET
@ -27,7 +27,7 @@ object MainForm: TMainForm
Left = 160 Left = 160
Top = 28 Top = 28
Width = 4 Width = 4
Height = 354 Height = 414
end end
object ToolBar: TToolBar object ToolBar: TToolBar
Left = 0 Left = 0
@ -251,7 +251,7 @@ object MainForm: TMainForm
Left = 0 Left = 0
Top = 28 Top = 28
Width = 160 Width = 160
Height = 354 Height = 414
Align = alLeft Align = alLeft
Columns = < Columns = <
item item
@ -270,7 +270,7 @@ object MainForm: TMainForm
Left = 164 Left = 164
Top = 28 Top = 28
Width = 402 Width = 402
Height = 354 Height = 414
Align = alClient Align = alClient
BevelInner = bvLowered BevelInner = bvLowered
BevelOuter = bvNone BevelOuter = bvNone
@ -281,7 +281,7 @@ object MainForm: TMainForm
Left = 1 Left = 1
Top = 1 Top = 1
Width = 400 Width = 400
Height = 352 Height = 412
Align = alClient Align = alClient
AutoSize = True AutoSize = True
PopupMenu = DisplayPopup PopupMenu = DisplayPopup
@ -293,7 +293,7 @@ object MainForm: TMainForm
end end
object StatusBar: TStatusBar object StatusBar: TStatusBar
Left = 0 Left = 0
Top = 382 Top = 442
Width = 566 Width = 566
Height = 19 Height = 19
Panels = < Panels = <
@ -2618,6 +2618,7 @@ object MainForm: TMainForm
end end
object mnuimage: TMenuItem object mnuimage: TMenuItem
Caption = 'Image ' Caption = 'Image '
Visible = False
OnClick = mnuimageClick OnClick = mnuimageClick
end end
object N4: TMenuItem object N4: TMenuItem
@ -2836,11 +2837,16 @@ object MainForm: TMainForm
RadioItem = True RadioItem = True
OnClick = mnuCosineClick OnClick = mnuCosineClick
end end
object mnuSawtooth: TMenuItem object mnuRings: TMenuItem
Caption = 'Sawtooth' Caption = 'Rings'
GroupIndex = 1 GroupIndex = 1
RadioItem = True RadioItem = True
OnClick = mnuSawtoothClick OnClick = mnuRingsClick
end
object mnuFan: TMenuItem
Caption = 'Fan'
GroupIndex = 1
OnClick = mnuFanClick
end end
end end
object mnuScript: TMenuItem object mnuScript: TMenuItem

View File

@ -37,7 +37,7 @@ const
RS_DR = 1; RS_DR = 1;
RS_XO = 2; RS_XO = 2;
RS_VO = 3; RS_VO = 3;
varnames: array[0..21] of PChar = ( varnames: array[0..NVARS -1] of PChar = (
'linear', 'linear',
'sinusoidal', 'sinusoidal',
'spherical', 'spherical',
@ -59,7 +59,8 @@ const
'exponential', 'exponential',
'power', 'power',
'cosine', 'cosine',
'sawtooth' 'rings',
'fan'
); );
type type
@ -216,12 +217,14 @@ type
MnuExponential: TMenuItem; MnuExponential: TMenuItem;
mnuPower: TMenuItem; mnuPower: TMenuItem;
mnuCosine: TMenuItem; mnuCosine: TMenuItem;
mnuSawtooth: TMenuItem; mnuRings: TMenuItem;
ToolButton4: TToolButton; ToolButton4: TToolButton;
tbzoomwindow: TToolButton; tbzoomwindow: TToolButton;
tbDrag: TToolButton; tbDrag: TToolButton;
tbRotate: TToolButton; tbRotate: TToolButton;
mnuimage: TMenuItem; mnuimage: TMenuItem;
mnuFan: TMenuItem;
procedure mnuFanClick(Sender: TObject);
procedure mnuimageClick(Sender: TObject); procedure mnuimageClick(Sender: TObject);
procedure mnuExitClick(Sender: TObject); procedure mnuExitClick(Sender: TObject);
procedure mnuSaveUPRClick(Sender: TObject); procedure mnuSaveUPRClick(Sender: TObject);
@ -329,7 +332,7 @@ type
procedure MnuExponentialClick(Sender: TObject); procedure MnuExponentialClick(Sender: TObject);
procedure mnuPowerClick(Sender: TObject); procedure mnuPowerClick(Sender: TObject);
procedure mnuCosineClick(Sender: TObject); procedure mnuCosineClick(Sender: TObject);
procedure mnuSawtoothClick(Sender: TObject); procedure mnuRingsClick(Sender: TObject);
procedure ImageMouseDown(Sender: TObject; Button: TMouseButton; procedure ImageMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer); Shift: TShiftState; X, Y: Integer);
procedure ImageMouseMove(Sender: TObject; Shift: TShiftState; X, procedure ImageMouseMove(Sender: TObject; Shift: TShiftState; X,
@ -425,7 +428,7 @@ implementation
uses Editor, Options, Regstry, Gradient, Render, uses Editor, Options, Regstry, Gradient, Render,
FullScreen, FormRender, Mutate, Adjust, Browser, Save, About, CmapData, FullScreen, FormRender, Mutate, Adjust, Browser, Save, About, CmapData,
HtmlHlp, ScriptForm, FormFavorites, Size, FormExport, msMultiPartFormData, HtmlHlp, ScriptForm, FormFavorites, Size, FormExport, msMultiPartFormData,
Sheep; Sheep, ImageColoring;
{$R *.DFM} {$R *.DFM}
@ -3107,7 +3110,7 @@ end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
procedure TMainForm.mnuimageClick(Sender: TObject); procedure TMainForm.mnuimageClick(Sender: TObject);
begin begin
// frmImageColoring.Show; frmImageColoring.Show;
end; end;
procedure swapcolor(var clist: array of cardinal; i, j: integer); procedure swapcolor(var clist: array of cardinal; i, j: integer);
@ -4265,11 +4268,24 @@ begin
UpdateWindows; UpdateWindows;
end; end;
procedure TMainForm.mnuSawtoothClick(Sender: TObject); procedure TMainForm.mnuRingsClick(Sender: TObject);
begin begin
mnuSawtooth.Checked := True; mnuRings.Checked := True;
UpdateUndo; UpdateUndo;
Variation := vSawtooth; Variation := vRings;
SetVariation(maincp);
ResetLocation;
RedrawTimer.Enabled := True;
UpdateWindows;
end;
///////////////////////////////////////////////////////////////////////////////
procedure TMainForm.mnuFanClick(Sender: TObject);
begin
mnuFan.Checked := True;
UpdateUndo;
Variation := vFan;
SetVariation(maincp); SetVariation(maincp);
ResetLocation; ResetLocation;
RedrawTimer.Enabled := True; RedrawTimer.Enabled := True;

View File

@ -178,20 +178,33 @@ end;
procedure TRenderer32.CreateFilter; procedure TRenderer32.CreateFilter;
var var
i, j: integer; i, j: integer;
fw: integer;
adjust: double;
ii, jj: double;
begin begin
oversample := fcp.spatial_oversample; oversample := fcp.spatial_oversample;
filter_width := Round(2.0 * FILTER_CUTOFF * oversample * fcp.spatial_filter_radius); fw := Trunc(2.0 * FILTER_CUTOFF * oversample * fcp.spatial_filter_radius);
filter_width := fw + 1;
// make sure it has same parity as oversample // make sure it has same parity as oversample
if odd(filter_width + oversample) then if odd(filter_width + oversample) then
inc(filter_width); inc(filter_width);
if (fw > 0.0) then
adjust := (1.0 * FILTER_CUTOFF * filter_width) / fw
else
adjust := 1.0;
setLength(filter, filter_width, filter_width); setLength(filter, filter_width, filter_width);
for i := 0 to filter_width - 1 do begin for i := 0 to filter_width - 1 do begin
for j := 0 to filter_width - 1 do begin for j := 0 to filter_width - 1 do begin
filter[i, j] := exp(-2.0 * power(((2.0 * i + 1.0) / filter_width - 1.0) * FILTER_CUTOFF, 2) * ii := ((2.0 * i + 1.0)/ filter_width - 1.0) * adjust;
power(((2.0 * j + 1.0) / filter_width - 1.0) * FILTER_CUTOFF, 2)); jj := ((2.0 * j + 1.0)/ filter_width - 1.0) * adjust;
filter[i, j] := exp(-2.0 * (ii * ii + jj * jj));
end; end;
end; end;
Normalizefilter; Normalizefilter;
end; end;

View File

@ -178,20 +178,33 @@ end;
procedure TRenderer64.CreateFilter; procedure TRenderer64.CreateFilter;
var var
i, j: integer; i, j: integer;
fw: integer;
adjust: double;
ii, jj: double;
begin begin
oversample := fcp.spatial_oversample; oversample := fcp.spatial_oversample;
filter_width := Round(2.0 * FILTER_CUTOFF * oversample * fcp.spatial_filter_radius); fw := Trunc(2.0 * FILTER_CUTOFF * oversample * fcp.spatial_filter_radius);
filter_width := fw + 1;
// make sure it has same parity as oversample // make sure it has same parity as oversample
if odd(filter_width + oversample) then if odd(filter_width + oversample) then
inc(filter_width); inc(filter_width);
if (fw > 0.0) then
adjust := (1.0 * FILTER_CUTOFF * filter_width) / fw
else
adjust := 1.0;
setLength(filter, filter_width, filter_width); setLength(filter, filter_width, filter_width);
for i := 0 to filter_width - 1 do begin for i := 0 to filter_width - 1 do begin
for j := 0 to filter_width - 1 do begin for j := 0 to filter_width - 1 do begin
filter[i, j] := exp(-2.0 * power(((2.0 * i + 1.0) / filter_width - 1.0) * FILTER_CUTOFF, 2) * ii := ((2.0 * i + 1.0)/ filter_width - 1.0) * adjust;
power(((2.0 * j + 1.0) / filter_width - 1.0) * FILTER_CUTOFF, 2)); jj := ((2.0 * j + 1.0)/ filter_width - 1.0) * adjust;
filter[i, j] := exp(-2.0 * (ii * ii + jj * jj));
end; end;
end; end;
Normalizefilter; Normalizefilter;
end; end;
@ -357,11 +370,18 @@ end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
procedure TRenderer64.SetPixels; procedure TRenderer64.SetPixels;
var var
i: integer; i{,j}: integer;
nsamples: Int64; nsamples: Int64;
nrbatches: Integer; nrbatches: Integer;
points: TPointsArray; points: TPointsArray;
// f: text;
begin begin
// if FileExists('c:\temp\flame.txt') then
// Deletefile('c:\temp\flame.txt');
// AssignFile(F, 'c:\temp\flame.txt');
// Rewrite(F);
SetLength(Points, SUB_BATCH_SIZE); SetLength(Points, SUB_BATCH_SIZE);
nsamples := Round(sample_density * bucketSize / (oversample * oversample)); nsamples := Round(sample_density * bucketSize / (oversample * oversample));
@ -381,12 +401,17 @@ begin
1: fcp.iterateXYC(SUB_BATCH_SIZE, points); 1: fcp.iterateXYC(SUB_BATCH_SIZE, points);
end; end;
// for j := SUB_BATCH_SIZE - 1 downto 0 do
// Writeln(f, FloatTostr(points[j].x) + #9 + FloatTostr(points[j].y) + #9 + FloatTostr(points[j].c));
if FCP.FAngle = 0 then if FCP.FAngle = 0 then
AddPointsToBuckets(points) AddPointsToBuckets(points)
else else
AddPointsToBucketsAngle(points); AddPointsToBucketsAngle(points);
end; end;
// closefile(f);
Progress(1); Progress(1);
end; end;
@ -537,7 +562,7 @@ begin
else if (bi > 255) then else if (bi > 255) then
bi := 255; bi := 255;
Row[j] := RGB(bi, gi, ri) + (ai shl 24); Row[j] := RGB(bi, gi, ri);// + (ai shl 24);
end; end;
Inc(bucketpos, 2 * gutter_width); Inc(bucketpos, 2 * gutter_width);

View File

@ -184,20 +184,33 @@ end;
procedure TRendererMM64.CreateFilter; procedure TRendererMM64.CreateFilter;
var var
i, j: integer; i, j: integer;
fw: integer;
adjust: double;
ii, jj: double;
begin begin
oversample := fcp.spatial_oversample; oversample := fcp.spatial_oversample;
filter_width := Round(2.0 * FILTER_CUTOFF * oversample * fcp.spatial_filter_radius); fw := Trunc(2.0 * FILTER_CUTOFF * oversample * fcp.spatial_filter_radius);
filter_width := fw + 1;
// make sure it has same parity as oversample // make sure it has same parity as oversample
if odd(filter_width + oversample) then if odd(filter_width + oversample) then
inc(filter_width); inc(filter_width);
if (fw > 0.0) then
adjust := (1.0 * FILTER_CUTOFF * filter_width) / fw
else
adjust := 1.0;
setLength(filter, filter_width, filter_width); setLength(filter, filter_width, filter_width);
for i := 0 to filter_width - 1 do begin for i := 0 to filter_width - 1 do begin
for j := 0 to filter_width - 1 do begin for j := 0 to filter_width - 1 do begin
filter[i, j] := exp(-2.0 * power(((2.0 * i + 1.0) / filter_width - 1.0) * FILTER_CUTOFF, 2) * ii := ((2.0 * i + 1.0)/ filter_width - 1.0) * adjust;
power(((2.0 * j + 1.0) / filter_width - 1.0) * FILTER_CUTOFF, 2)); jj := ((2.0 * j + 1.0)/ filter_width - 1.0) * adjust;
filter[i, j] := exp(-2.0 * (ii * ii + jj * jj));
end; end;
end; end;
Normalizefilter; Normalizefilter;
end; end;
@ -549,6 +562,7 @@ begin
Inc(bucketpos, 2 * gutter_width); Inc(bucketpos, 2 * gutter_width);
Inc(bucketpos, (oversample - 1) * BucketWidth); Inc(bucketpos, (oversample - 1) * BucketWidth);
end; end;
bm.PixelFormat := pf24bit;
Progress(1); Progress(1);
end; end;

View File

@ -2693,7 +2693,8 @@ begin
Scripter.AddConstant('V_EXPONENTIAL', 18); Scripter.AddConstant('V_EXPONENTIAL', 18);
Scripter.AddConstant('V_POWER', 19); Scripter.AddConstant('V_POWER', 19);
Scripter.AddConstant('V_COSINE', 20); Scripter.AddConstant('V_COSINE', 20);
Scripter.AddConstant('V_SAWTOOTH', 21); Scripter.AddConstant('V_RINGS', 21);
Scripter.AddConstant('V_FAN', 22);
Scripter.AddConstant('V_RANDOM', -1); Scripter.AddConstant('V_RANDOM', -1);
{ Variables } { Variables }
Scripter.AddVariable('SelectedTransform', SelectedTriangle); Scripter.AddVariable('SelectedTransform', SelectedTriangle);

View File

@ -3,7 +3,7 @@ unit XForm;
interface interface
const const
NVARS = 22; NVARS = 23;
EPS = 1E-10; EPS = 1E-10;
type type
@ -57,7 +57,8 @@ type
procedure Exponential; // var[18] procedure Exponential; // var[18]
procedure Power; // var[19] procedure Power; // var[19]
procedure Cosine; // var[20] procedure Cosine; // var[20]
procedure SawTooth; // var[21] procedure Rings; // var[21]
procedure Fan; // var[22]
public public
@ -230,12 +231,17 @@ begin
end; end;
if (vars[21] <> 0.0) then begin if (vars[21] <> 0.0) then begin
FFunctionList[FNrFunctions] := SawTooth; FFunctionList[FNrFunctions] := Rings;
Inc(FNrFunctions);
end;
if (vars[22] <> 0.0) then begin
FFunctionList[FNrFunctions] := Fan;
Inc(FNrFunctions); Inc(FNrFunctions);
end; end;
CalculateAngle := (vars[5] <> 0.0) or (vars[6] <> 0.0) or (vars[7] <> 0.0) or (vars[8] <> 0.0) or CalculateAngle := (vars[5] <> 0.0) or (vars[6] <> 0.0) or (vars[7] <> 0.0) or (vars[8] <> 0.0) or
(vars[12] <> 0.0) or (vars[13] <> 0.0); (vars[12] <> 0.0) or (vars[13] <> 0.0) or (vars[21] <> 0.0) or (vars[22] <> 0.0);
CalculateLength := False; CalculateLength := False;
CalculateSinCos := (vars[4] <> 0.0) or (vars[9] <> 0.0) or (vars[10] <> 0.0) or CalculateSinCos := (vars[4] <> 0.0) or (vars[9] <> 0.0) or (vars[10] <> 0.0) or
(vars[11] <> 0.0) or (vars[16] <> 0.0) or (vars[19] <> 0.0) or (vars[11] <> 0.0) or (vars[16] <> 0.0) or (vars[19] <> 0.0) or
@ -495,21 +501,39 @@ begin
end; end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
procedure TXForm.SawTooth; procedure TXForm.Rings;
var var
r: double; r: double;
// nx, ny: double; dx: double;
begin begin
// r := sqrt(FTx * FTx + FTy * FTy); dx := sqr(c20) + EPS;
// r := fmod(r + 1.0, 2.0) - 1.0; r := FLength;
r := FLength + 1; r := r + dx - System.Int((r + dx)/(2 * dx)) * 2 * dx - dx + r * (1-dx);
r := r - System.Int(r/2) * 2.0 - 1;
// nx := cos(FAngle) * r; FPx := FPx + vars[21] * r * cos(FAngle);
// ny := sin(FAngle) * r; FPy := FPy + vars[21] * r * sin(FAngle);
end;
FPx := FPx + vars[21] * r * FCosA; ///////////////////////////////////////////////////////////////////////////////
FPy := FPy + vars[21] * r * FSinA; procedure TXForm.Fan;
var
r,t,a : double;
dx, dy, dx2: double;
begin
dy := c21;
dx := PI * (sqr(c20) + EPS);
dx2 := dx/2;
r := sqrt(FTx * FTx + FTy * FTy);
t := FAngle+dy - System.Int((FAngle + dy)/dx) * dx;
if (t > dx2) then
a := FAngle - dx2
else
a := FAngle + dx2;
FPx := FPx + vars[22] * r * cos(a);
FPy := FPy + vars[22] * r * sin(a);
end; end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////