Cause of sometimes 'invalid floating point' message

This commit is contained in:
ronaldhordijk 2005-03-23 13:28:13 +00:00
parent c9b167ae79
commit b53b214b20
3 changed files with 38 additions and 17 deletions

View File

@ -57,6 +57,9 @@ object AdjustForm: TAdjustForm
BevelOuter = bvLowered
Color = clAppWorkSpace
TabOrder = 0
DesignSize = (
162
122)
object PreviewImage: TImage
Left = 1
Top = 1
@ -312,7 +315,6 @@ object AdjustForm: TAdjustForm
end
end
object ColorDialog: TColorDialog
Ctl3D = True
Options = [cdFullOpen]
Left = 376
Top = 8

View File

@ -157,8 +157,13 @@ begin
scrollBrightness.Position := trunc(cp.Brightness * 100);
scrollVibrancy.Position := trunc(cp.vibrancy * 100);
scrollZoom.Position := trunc(cp.zoom * 100);
if (abs(cp.Center[0]) < 1000) and (abs(cp.Center[0]) < 1000) then begin
scrollCenterX.Position := trunc(cp.Center[0] * 100);
scrollCenterY.Position := trunc(cp.Center[1] * 100);
end else begin
scrollCenterX.Position := 0;
scrollCenterY.Position := 0;
end;
ColorPanel.color := cp.background[2] shl 16 +
cp.background[1] shl 8 + cp.background[0];
Resetting := False;

View File

@ -878,18 +878,17 @@ begin
xform[i].vars[j] := 0;
end;
if rv < 0 then
begin
if rv < 0 then begin
repeat
v := Mixed_var_distrib[random(Length(mixed_var_distrib))];
until Variations[v]; // use only variations set in options
xform[i].vars[v] := 1
end
else
end else
xform[i].vars[rv] := 1;
end;
if calc then CalcBoundbox;
if calc then
CalcBoundbox;
end;
procedure TControlPoint.RandomCP1;
@ -927,10 +926,10 @@ begin
LimitOutSidePoints := Round(0.05 * SUB_BATCH_SIZE);
minx := 1E10;
maxx := -1E10;
miny := 1E10;
maxy := -1E10;
minx := 1E99;
maxx := -1E99;
miny := 1E99;
maxy := -1E99;
for i := 0 to SUB_BATCH_SIZE - 1 do begin
minx := min(minx, Points[i].x);
maxx := max(maxx, Points[i].x);
@ -986,6 +985,11 @@ begin
deltay := deltay / 2;
end;
if ((maxx - minx) > 1000) or
((maxy - miny) > 1000) then
raise Exception.Create('Flame area to large');
center[0] := (minx + maxx) / 2;
center[1] := (miny + maxy) / 2;
if ((maxx - minx) > 0.001) and ((maxy - miny) > 0.001) then
@ -1018,10 +1022,10 @@ begin
LimitOutSidePoints := Round(0.05 * SUB_BATCH_SIZE);
minx := 1E10;
maxx := -1E10;
miny := 1E10;
maxy := -1E10;
minx := 1E99;
maxx := -1E99;
miny := 1E99;
maxy := -1E99;
for i := 0 to SUB_BATCH_SIZE - 1 do begin
minx := min(minx, Points[i].x);
maxx := max(maxx, Points[i].x);
@ -1077,6 +1081,11 @@ begin
deltay := deltay / 2;
end;
if ((maxx - minx) > 1000) or
((maxy - miny) > 1000) then
raise Exception.Create('Flame area to large');
cp.center[0] := (minx + maxx) / 2;
cp.center[1] := (miny + maxy) / 2;
if ((maxx - minx) > 0.001) and ((maxy - miny) > 0.001) then
@ -1097,8 +1106,13 @@ begin
end;
except on E: EMathError do
begin// default
cp.center[0] := 0;
cp.center[1] := 0;
cp.pixels_per_unit := 10;
raise Exception.Create('CalcUPRMagn: ' +e.Message);
end;
end;
end;