more assembler - more speed...(?)

must test... and we really need some profiler :)
This commit is contained in:
zueuk 2005-11-06 10:47:13 +00:00
parent b4104e8185
commit 9abbe9b52e
15 changed files with 379 additions and 238 deletions

View File

@ -4,7 +4,7 @@ interface
uses uses
Classes, Windows, Classes, Windows,
Controlpoint,Render; ControlPoint, Render;
type type
TBucketFillerThread = class(TThread) TBucketFillerThread = class(TThread)

View File

@ -26,9 +26,10 @@ uses
const const
EPS = 1E-10; EPS = 1E-10;
NXFORMS = 100; // --Z-- I don't like limitations! 8-[] NXFORMS = 100;
SUB_BATCH_SIZE = 10000; SUB_BATCH_SIZE = 10000;
PROP_TABLE_SIZE = 1024;
PREFILTER_WHITE = (1 shl 26); PREFILTER_WHITE = (1 shl 26);
FILTER_CUTOFF = 1.8; FILTER_CUTOFF = 1.8;
BRIGHT_ADJUST = 2.3; BRIGHT_ADJUST = 2.3;
@ -116,7 +117,7 @@ type
pulse: array[0..1, 0..1] of double; // [i][0]=magnitute [i][1]=frequency */ pulse: array[0..1, 0..1] of double; // [i][0]=magnitute [i][1]=frequency */
wiggle: array[0..1, 0..1] of double; // frequency is /minute, assuming 30 frames/s */ wiggle: array[0..1, 0..1] of double; // frequency is /minute, assuming 30 frames/s */
PropTable: array of Integer; PropTable: array of ^TXForm;//Integer;
FAngle: Double; FAngle: Double;
FTwoColorDimensions: Boolean; FTwoColorDimensions: Boolean;
private private
@ -263,7 +264,7 @@ var
j: integer; j: integer;
TotValue: double; TotValue: double;
begin begin
SetLength(PropTable, 1024); SetLength(PropTable, PROP_TABLE_SIZE);
totValue := 0; totValue := 0;
for i := 0 to NXFORMS - 1 do begin for i := 0 to NXFORMS - 1 do begin
@ -278,8 +279,8 @@ begin
inc(j); inc(j);
propsum := propsum + xform[j].density; propsum := propsum + xform[j].density;
until (propsum > LoopValue) or (j = NXFORMS - 1); until (propsum > LoopValue) or (j = NXFORMS - 1);
PropTable[i] := j; PropTable[i] := @xform[j];
LoopValue := LoopValue + TotValue / 1024; LoopValue := LoopValue + TotValue / PROP_TABLE_SIZE;
end; end;
end; end;
@ -300,7 +301,8 @@ begin
PreparePropTable; PreparePropTable;
for i := -FUSE to NrPoints - 1 do begin for i := -FUSE to NrPoints - 1 do begin
with xform[PropTable[Random(1024)]] do begin //with xform[PropTable[Random(1024)]] do begin
with PropTable[Random(PROP_TABLE_SIZE)]^ do begin
// first compute the color coord // first compute the color coord
s := symmetry; s := symmetry;
@ -530,10 +532,10 @@ begin
try try
for i := 0 to FUSE do for i := 0 to FUSE do
xform[PropTable[Random(1024)]].NextPointXY(px,py); PropTable[Random(PROP_TABLE_SIZE)].NextPointXY(px,py);
for i := 0 to NrPoints - 1 do begin for i := 0 to NrPoints - 1 do begin
xform[PropTable[Random(1024)]].NextPointXY(px,py); PropTable[Random(PROP_TABLE_SIZE)].NextPointXY(px,py);
CurrentPoint := @Points[i]; CurrentPoint := @Points[i];
CurrentPoint.X := px; CurrentPoint.X := px;
CurrentPoint.Y := py; CurrentPoint.Y := py;
@ -563,10 +565,10 @@ begin
try try
for i := 0 to FUSE do for i := 0 to FUSE do
xform[PropTable[Random(1024)]].NextPoint(px,py,pc); PropTable[Random(PROP_TABLE_SIZE)].NextPoint(px,py,pc);
for i := 0 to NrPoints - 1 do begin for i := 0 to NrPoints - 1 do begin
xform[PropTable[Random(1024)]].NextPoint(px,py,pc); PropTable[Random(PROP_TABLE_SIZE)].NextPoint(px,py,pc);
CurrentPoint := @Points[i]; CurrentPoint := @Points[i];
CurrentPoint.X := px; CurrentPoint.X := px;
CurrentPoint.Y := py; CurrentPoint.Y := py;
@ -609,7 +611,7 @@ begin
pc := 0; pc := 0;
try try
xform[PropTable[Random(1024)]].NextPoint(px,py,pt); PropTable[Random(PROP_TABLE_SIZE)].NextPoint(px,py,pt);
except except
on EMathError do begin on EMathError do begin
exit; exit;
@ -644,10 +646,10 @@ begin
try try
for i := 0 to FUSE do for i := 0 to FUSE do
xform[PropTable[Random(1024)]].NextPoint2C(px, py, pc1, pc2); PropTable[Random(PROP_TABLE_SIZE)].NextPoint2C(px, py, pc1, pc2);
for i := 0 to NrPoints - 1 do begin for i := 0 to NrPoints - 1 do begin
xform[PropTable[Random(1024)]].NextPoint2C(px, py, pc1, pc2); PropTable[Random(PROP_TABLE_SIZE)].NextPoint2C(px, py, pc1, pc2);
CurrentPoint := @Points[i]; CurrentPoint := @Points[i];
CurrentPoint.X := px; CurrentPoint.X := px;
CurrentPoint.Y := py; CurrentPoint.Y := py;
@ -684,10 +686,10 @@ begin
try try
for i := 0 to FUSE do for i := 0 to FUSE do
xform[PropTable[Random(1024)]].NextPointXY(px,py); PropTable[Random(PROP_TABLE_SIZE)].NextPointXY(px,py);
for i := 0 to NrPoints - 1 do begin for i := 0 to NrPoints - 1 do begin
xform[PropTable[Random(1024)]].NextPointXY(px,py); PropTable[Random(PROP_TABLE_SIZE)].NextPointXY(px,py);
CurrentPoint := @Points[i]; CurrentPoint := @Points[i];
CurrentPoint.X := px; CurrentPoint.X := px;
CurrentPoint.Y := py; CurrentPoint.Y := py;

View File

@ -171,7 +171,7 @@ object EditForm: TEditForm
object tbSelect: TToolButton object tbSelect: TToolButton
Left = 166 Left = 166
Top = 0 Top = 0
Hint = 'Select triangle' Hint = 'Select mode'
Caption = 'Select' Caption = 'Select'
Down = True Down = True
ImageIndex = 6 ImageIndex = 6

View File

@ -22,8 +22,9 @@ interface
uses uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls, ComCtrls, Math, Menus, ToolWin, Registry, MyTypes, ExtCtrls, StdCtrls, ComCtrls, Math, Menus, ToolWin, Registry,
ControlPoint, Render, cmap, Grids, ValEdit, Buttons, ImgList, CustomDrawControl; ControlPoint, Render, cmap, Grids, ValEdit, Buttons, ImgList, CustomDrawControl,
Types;
const const
// PixelCountMax = 32768; // PixelCountMax = 32768;
@ -342,13 +343,15 @@ type
function GetPivot: TSPoint; overload; function GetPivot: TSPoint; overload;
function GetPivot(n: integer): TSPoint; overload; function GetPivot(n: integer): TSPoint; overload;
function GetTriangleColor(n: integer): TColor; //moved to public: function GetTriangleColor(n: integer): TColor;
// --Z-- functions moved from outside (?) // --Z-- functions moved from outside (?)
procedure ShowSelectedInfo; procedure ShowSelectedInfo;
procedure Scale(var fx, fy: double; x, y: integer); procedure Scale(var fx, fy: double; x, y: integer);
// procedure ReadjustWeights(var cp: TControlPoint); // procedure ReadjustWeights(var cp: TControlPoint);
procedure TriangleViewPaint(Sender: TObject);
procedure AutoZoom;
public public
cp: TControlPoint; cp: TControlPoint;
Render: TRenderer; Render: TRenderer;
@ -357,8 +360,8 @@ type
procedure UpdatePreview; procedure UpdatePreview;
procedure UpdateDisplay(PreviewOnly: boolean = false); //(?) procedure UpdateDisplay(PreviewOnly: boolean = false); //(?)
procedure AutoZoom;
procedure TriangleViewPaint(Sender: TObject); function GetTriangleColor(n: integer): TColor;
end; end;
const const
@ -551,12 +554,11 @@ begin
end; end;
end; end;
function ColorValToColor(c: TColorMap; index: double): TColor; function ColorValToColor(c: TColorMap; index: double): TColor;
var var
i: integer; i: integer;
begin begin
i := Trunc(Index * 255); i := Trunc(Index * 255); //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! >>TODO: check<<
result := c[i][2] shl 16 + c[i][1] shl 8 + c[i][0]; result := c[i][2] shl 16 + c[i][1] shl 8 + c[i][0];
end; end;
@ -589,7 +591,7 @@ end;
procedure TEditForm.UpdateDisplay(PreviewOnly: boolean = false); procedure TEditForm.UpdateDisplay(PreviewOnly: boolean = false);
var var
i: integer; i: integer;
pw, ph: integer; // pw, ph: integer;
r: double; r: double;
begin begin
// currently EditForm does not really know if we select another // currently EditForm does not really know if we select another
@ -1081,10 +1083,10 @@ begin
try try
tx := ax / d1; tx := ax / d1;
ty := ay / d1; ty := ay / d1;
for i := 1 to trkVarPreviewDepth.position do for i := trkVarPreviewDepth.position downto 1 do
cp.xform[SelectedTriangle].NextPoint(tx, ty, d); // d used as dummy var cp.xform[SelectedTriangle].PreviewPoint(tx, ty);
a := toscreen(tx,-ty); a := toscreen(tx, -ty);
Pixels[a.x, a.Y] := {Pixels[a.x, a.Y] xor} tc; Pixels[a.x, a.y] := tc;
except except
end; end;
end; end;
@ -1096,10 +1098,8 @@ begin
if HelpersEnabled then if HelpersEnabled then
begin begin
pen.Color := HelpersColor; pen.Color := HelpersColor;
//pen.Color := 0;
//brush.Color := $808080;
pen.Mode := pmMerge; pen.Mode := pmMerge;
pen.Style := psSolid;//psDot; pen.Style := psSolid;
a := ToScreen(Pivot.x, Pivot.y); a := ToScreen(Pivot.x, Pivot.y);
MoveTo(a.x, 0); MoveTo(a.x, 0);
LineTo(a.x, Height); LineTo(a.x, Height);
@ -1119,23 +1119,20 @@ begin
d := Hypot(dx, dy); d := Hypot(dx, dy);
for i := 1 to 2 do for i := 1 to 2 do
begin begin
d1 := Hypot(tx, ty);
d1 := dist(Pivot.x, Pivot.y, MainTriangles[SelectedTriangle].x[i], MainTriangles[SelectedTriangle].y[i]); d1 := dist(Pivot.x, Pivot.y, MainTriangles[SelectedTriangle].x[i], MainTriangles[SelectedTriangle].y[i]);
if d1 > d then begin if d1 > d then
begin
dx := dx/d*d1;
dy := dy/d*d1;
d := d1; d := d1;
end; end;
end; end;
d1 := Hypot(dx, dy);
if (d1 <> d) and (d1 <> 0) then
begin
dx := dx/d1 * d;
dy := dy/d1 * d;
end;
end; end;
//i := min( min(Width, Height), integer(round(dmax * sc))); //i := min( min(Width, Height), integer(round(dmax * sc)));
i := integer(round(d * sc)); i := integer(round(d * sc));
if i > 4 then begin if i > 4 then
begin
pen.Color := HelpersColor; pen.Color := HelpersColor;
brush.Style := bsClear; brush.Style := bsClear;
Ellipse(a.x - i, a.y - i, a.x + i, a.y + i); Ellipse(a.x - i, a.y - i, a.x + i, a.y + i);
@ -1150,20 +1147,6 @@ begin
// rotated axis // rotated axis
LineDxDy; LineDxDy;
{
if (dx <> 0) and (dy <> 0) then
begin
k := dy / dx;
if abs(k) < 1 then begin
MoveTo(0, round(iy - sc*(Pivot.y - ( ix/sc-GCenterX+Pivot.x)*k - GCenterY)));
LineTo(Width, round(iy - sc*(Pivot.y - (-ix/sc-GCenterX+Pivot.x)*k - GCenterY)));
end
else begin
MoveTo(round(ix + sc*(Pivot.x - (-iy/sc-GCenterY+Pivot.y)/k - GCenterX)), 0);
LineTo(round(ix + sc*(Pivot.x - ( iy/sc-GCenterY+Pivot.y)/k - GCenterX)), Height);
end;
end;
}
end end
else if (editMode = modeScale) then // draw lines else if (editMode = modeScale) then // draw lines
begin begin
@ -3424,14 +3407,9 @@ begin
end; end;
procedure TEditForm.mnuResetClick(Sender: TObject); procedure TEditForm.mnuResetClick(Sender: TObject);
var
i: integer;
begin begin
MainForm.UpdateUndo; MainForm.UpdateUndo;
MainTriangles[SelectedTriangle] := MainTriangles[-1]; MainTriangles[SelectedTriangle] := MainTriangles[-1];
// cp.xform[SelectedTriangle].vars[0] := 1;
// for i := 1 to NRVAR - 1 do
// cp.xform[SelectedTriangle].vars[i] := 0;
UpdateFlame(True); UpdateFlame(True);
end; end;
@ -3446,9 +3424,11 @@ begin
SelectedTriangle := 1; SelectedTriangle := 1;
MainTriangles[0] := MainTriangles[-1]; MainTriangles[0] := MainTriangles[-1];
cp.xform[0].density := 0.5; cp.xform[0].density := 0.5;
cp.xform[0].color := 0;
cp.xform[0].vars[0] := 1; cp.xform[0].vars[0] := 1;
MainTriangles[1] := MainTriangles[-1]; MainTriangles[1] := MainTriangles[-1];
cp.xform[1].density := 0.5; cp.xform[1].density := 0.5;
cp.xform[0].color := 1;
cp.xform[1].vars[0] := 1; cp.xform[1].vars[0] := 1;
for i := 1 to NRVAR - 1 do for i := 1 to NRVAR - 1 do
begin begin

View File

@ -323,6 +323,12 @@ object RenderForm: TRenderForm
Width = 126 Width = 126
Height = 13 Height = 13
Caption = 'Available physical memory:' Caption = 'Available physical memory:'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
end end
object Label9: TLabel object Label9: TLabel
Left = 8 Left = 8
@ -465,6 +471,6 @@ object RenderForm: TRenderForm
end end
object SaveDialog: TSaveDialog object SaveDialog: TSaveDialog
Left = 368 Left = 368
Top = 256 Top = 328
end end
end end

View File

@ -22,7 +22,8 @@ interface
uses uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ControlPoint, RenderThread, ComCtrls, Math, Buttons, Registry, cmap, StdCtrls, ControlPoint, RenderThread, ComCtrls, Math, Buttons, Registry, cmap,
ExtCtrls; ExtCtrls,
Render; // 'use'd only for SizeOf()
const const
WM_THREAD_COMPLETE = WM_APP + 5437; WM_THREAD_COMPLETE = WM_APP + 5437;
@ -157,20 +158,17 @@ begin
GlobalMemoryInfo.dwLength := SizeOf(GlobalMemoryInfo); GlobalMemoryInfo.dwLength := SizeOf(GlobalMemoryInfo);
GlobalMemoryStatus(GlobalMemoryInfo); GlobalMemoryStatus(GlobalMemoryInfo);
PhysicalMemory := GlobalMemoryInfo.dwAvailPhys div 1048576; PhysicalMemory := GlobalMemoryInfo.dwAvailPhys div 1048576;
ApproxMemory := 32 * Oversample * Oversample; ApproxMemory := ImageHeight * ImageWidth * Oversample * Oversample *
ApproxMemory := ApproxMemory * ImageHeight * ImageWidth; SizeOf(TBucket) div 1048576;
ApproxMemory := ApproxMemory div 1048576; lblPhysical.Caption := 'Physical memory available: ' + Format('%d', [PhysicalMemory]) + ' Mb';
// ApproxMemory := (32 * Oversample * Oversample * ImageHeight * ImageWidth) div 1048576; // or 1000000? lblApproxMem.Caption := 'Approximate memory required: ' + Format('%d', [ApproxMemory]) + ' Mb';
lblPhysical.Caption := 'Physical memory available: ' + Format('%d', [PhysicalMemory]) + ' MB'; if ApproxMemory > PhysicalMemory then lblPhysical.Font.Color := clRed
lblApproxMem.Caption := 'Approximate memory required: ' + Format('%d', [ApproxMemory]) + ' MB'; else lblPhysical.Font.Color := clWindowText;
if ApproxMemory > PhysicalMemory then
; // show warning icon.
end; end;
procedure TRenderForm.HandleThreadCompletion(var Message: TMessage); procedure TRenderForm.HandleThreadCompletion(var Message: TMessage);
begin begin
if not chkLimitMem.Checked and if not chkLimitMem.Checked and cbPostProcess.checked then
cbPostProcess.checked then
DoPostProcess; DoPostProcess;
Renderer.SaveImage(RenderForm.FileName); Renderer.SaveImage(RenderForm.FileName);

View File

@ -21,7 +21,7 @@ interface
uses uses
SysUtils, Classes, SyncObjs, Controls, Graphics, Math, SysUtils, Classes, SyncObjs, Controls, Graphics, Math,
cmap, MyTypes, controlpoint, Xform; cmap, ControlPoint, Xform;
type type
EFormatInvalid = class(Exception); EFormatInvalid = class(Exception);

View File

@ -27,7 +27,7 @@ object MainForm: TMainForm
Left = 160 Left = 160
Top = 28 Top = 28
Width = 4 Width = 4
Height = 554 Height = 540
end end
object ToolBar: TToolBar object ToolBar: TToolBar
Left = 0 Left = 0
@ -284,7 +284,7 @@ object MainForm: TMainForm
Left = 0 Left = 0
Top = 28 Top = 28
Width = 160 Width = 160
Height = 554 Height = 540
Align = alLeft Align = alLeft
Columns = < Columns = <
item item
@ -303,7 +303,7 @@ object MainForm: TMainForm
Left = 164 Left = 164
Top = 28 Top = 28
Width = 433 Width = 433
Height = 554 Height = 540
Align = alClient Align = alClient
BevelInner = bvLowered BevelInner = bvLowered
BevelOuter = bvNone BevelOuter = bvNone
@ -327,7 +327,7 @@ object MainForm: TMainForm
end end
object StatusBar: TStatusBar object StatusBar: TStatusBar
Left = 0 Left = 0
Top = 582 Top = 568
Width = 597 Width = 597
Height = 19 Height = 19
Panels = < Panels = <

View File

@ -25,7 +25,7 @@ interface
uses uses
Windows, Forms, Dialogs, Menus, Controls, ComCtrls, Windows, Forms, Dialogs, Menus, Controls, ComCtrls,
ToolWin, StdCtrls, Classes, Messages, ExtCtrls, ImgList, controlpoint, ToolWin, StdCtrls, Classes, Messages, ExtCtrls, ImgList, controlpoint,
Jpeg, SyncObjs, SysUtils, ClipBrd, Graphics, Math, Global, MyTypes, Jpeg, SyncObjs, SysUtils, ClipBrd, Graphics, Math, Global,
Registry, RenderThread, Cmap, ExtDlgs, AppEvnts, ShellAPI, Registry, RenderThread, Cmap, ExtDlgs, AppEvnts, ShellAPI,
LibXmlParser, LibXmlComps, Xform, XFormMan; LibXmlParser, LibXmlComps, Xform, XFormMan;

View File

@ -1,51 +0,0 @@
{
Apophysis Copyright (C) 2001-2004 Mark Townsend
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
}
unit MyTypes;
interface
{uses ControlPoint;
type
TTriangle = record
x: array[0..2] of double;
y: array[0..2] of double;
end;
TTriangles = array[-1..NXFORMS] of TTriangle;
TSPoint = record
x: double;
y: double;
end;
TMapPalette = record
Red: array[0..255] of byte;
Green: array[0..255] of byte;
Blue: array[0..255] of byte;
end;
TColorMaps = record
Identifier: string;
UGRFile: string;
end;
pPixArray = ^TPixArray;
TPixArray = array[0..1279, 0..1023, 0..3] of integer;
pPreviewPixArray = ^TPreviewPixArray;
TPreviewPixArray = array[0..159, 0..119, 0..3] of integer;
TFileType = (ftIfs, ftFla, ftXML);
}
implementation
end.

View File

@ -29,18 +29,18 @@ type
type type
TColorMapColor = Record TColorMapColor = Record
Red : Int64; Red,
Green: Int64; Green,
Blue : Int64; Blue: integer; //Int64;
// Count: Int64; // Count: Int64;
end; end;
PColorMapColor = ^TColorMapColor; PColorMapColor = ^TColorMapColor;
TColorMapArray = array[0..255] of TColorMapColor; TColorMapArray = array[0..255] of TColorMapColor;
TBucket = Record TBucket = Record
Red : Int64; Red,
Green: Int64; Green,
Blue : Int64; Blue,
Count: Int64; Count: Int64;
end; end;
PBucket = ^TBucket; PBucket = ^TBucket;

View File

@ -28,7 +28,7 @@ function RandomFlame(SourceCP: TControlPoint= nil; algorithm: integer = 0): TCon
implementation implementation
uses uses
SysUtils, Global, cmap, MyTypes, GradientHlpr, XFormMan; SysUtils, Global, cmap, GradientHlpr, XFormMan;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
procedure RandomGradient(SourceCP, DestCP: TControlPoint); procedure RandomGradient(SourceCP, DestCP: TControlPoint);

View File

@ -325,7 +325,7 @@ implementation
} }
uses Main, Editor, Adjust, Global, Mutate, Registry, Preview, uses Main, Editor, Adjust, Global, Mutate, Registry, Preview,
ScriptRender, ap_math, ap_classes, ap_sysutils, MyTypes, ScriptRender, ap_math, ap_classes, ap_sysutils,
SavePreset, ap_windows, ap_FileCtrl, bmdll32; SavePreset, ap_windows, ap_FileCtrl, bmdll32;
{$R *.DFM} {$R *.DFM}

View File

@ -27,7 +27,7 @@ procedure TVariationEyefish.CalcFunction;
var var
r: double; r: double;
begin begin
r := 2 * vvar / (sqrt(FTx^ * FTx^ + FTy^ * FTy^) + 1); r := 2 * vvar / (sqrt(sqr(FTx^) + sqr(FTy^)) + 1);
FPx^ := FPx^ + r * FTx^; FPx^ := FPx^ + r * FTx^;
FPy^ := FPy^ + r * FTy^; FPy^ := FPy^ + r * FTy^;
{$else} {$else}

View File

@ -34,14 +34,15 @@ type
FSinA: double; FSinA: double;
FCosA: double; FCosA: double;
FLength: double; FLength: double;
CalculateAngle: boolean; // CalculateAngle, CalculateLength, CalculateSinCos: boolean;
// CalculateLength: boolean;
CalculateSinCos: boolean;
PostTransformEnabled: boolean;
FRegVariations: array of TBaseVariation; FRegVariations: array of TBaseVariation;
procedure PrecalcAngle;
procedure PrecalcSinCos;
procedure PrecalcAll;
procedure DoPostTransform;
procedure Linear; // var[0] procedure Linear; // var[0]
procedure Sinusoidal; // var[1] procedure Sinusoidal; // var[1]
procedure Spherical; // var[2] procedure Spherical; // var[2]
@ -66,10 +67,10 @@ type
procedure Rings; // var[21] procedure Rings; // var[21]
procedure Fan; // var[22] procedure Fan; // var[22]
procedure Triblob; // var[23] // procedure Triblob; // var[23]
procedure Daisy; // var[24] // procedure Daisy; // var[24]
procedure Checkers; // var[25] // procedure Checkers; // var[25]
procedure CRot; // var[26] // procedure CRot; // var[26]
function Mul33(const M1, M2: TMatrix): TMatrix; function Mul33(const M1, M2: TMatrix): TMatrix;
function Identity: TMatrix; function Identity: TMatrix;
@ -99,9 +100,10 @@ type
procedure Assign(Xform: TXForm); procedure Assign(Xform: TXForm);
procedure PreviewPoint(var px, py: double);
procedure NextPoint(var px, py, pc: double); overload; procedure NextPoint(var px, py, pc: double); overload;
procedure NextPoint(var CPpoint: TCPpoint); overload; procedure NextPoint(var CPpoint: TCPpoint); overload;
procedure NextPoint(var px, py, pz, pc: double); overload; // procedure NextPoint(var px, py, pz, pc: double); overload;
procedure NextPointXY(var px, py: double); procedure NextPointXY(var px, py: double);
procedure NextPoint2C(var px, py, pc1, pc2: double); procedure NextPoint2C(var px, py, pc1, pc2: double);
@ -142,6 +144,8 @@ var
begin begin
density := 0; density := 0;
Color := 0; Color := 0;
Symmetry := 0;
c[0, 0] := 1; c[0, 0] := 1;
c[0, 1] := 0; c[0, 1] := 0;
c[1, 0] := 0; c[1, 0] := 0;
@ -155,7 +159,6 @@ begin
p[1, 1] := 1; p[1, 1] := 1;
p[2, 0] := 0; p[2, 0] := 0;
p[2, 1] := 0; p[2, 1] := 0;
Symmetry := 0;
AddRegVariations; AddRegVariations;
BuildFunctionlist; BuildFunctionlist;
@ -170,6 +173,7 @@ end;
procedure TXForm.Prepare; procedure TXForm.Prepare;
var var
i: integer; i: integer;
CalculateAngle, CalculateSinCos, CalculateLength: boolean;
begin begin
c00 := c[0][0]; c00 := c[0][0];
c01 := c[0][1]; c01 := c[0][1];
@ -178,17 +182,6 @@ begin
c20 := c[2][0]; c20 := c[2][0];
c21 := c[2][1]; c21 := c[2][1];
if (p[0,0]<>1) or (p[0,1]<>0) or(p[1,0]<>0) or (p[1,1]<>1) or (p[2,0]<>0) or (p[2,1]<>0) then
begin
p00 := p[0][0];
p01 := p[0][1];
p10 := p[1][0];
p11 := p[1][1];
p20 := p[2][0];
p21 := p[2][1];
PostTransformEnabled := true;
end;
FNrFunctions := 0; FNrFunctions := 0;
for i := 0 to High(FRegVariations) do begin for i := 0 to High(FRegVariations) do begin
@ -201,12 +194,42 @@ begin
FRegVariations[i].prepare; FRegVariations[i].prepare;
end; end;
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) or (vars[21] <> 0.0) or (vars[22] <> 0.0);
// CalculateLength := False;
CalculateSinCos := (vars[9] <> 0.0) or (vars[11] <> 0.0) or (vars[19] <> 0.0) or (vars[21] <> 0.0);
if CalculateAngle or CalculateSinCos then
begin
if CalculateAngle and CalculateSinCos then
FCalcFunctionList[FNrFunctions] := PrecalcAll
else if CalculateAngle then
FCalcFunctionList[FNrFunctions] := PrecalcAngle
else //if CalculateSinCos then
FCalcFunctionList[FNrFunctions] := PrecalcSinCos;
Inc(FNrFunctions);
end;
for i := 0 to NrVar - 1 do begin for i := 0 to NrVar - 1 do begin
if (vars[i] <> 0.0) then begin if (vars[i] <> 0.0) then begin
FCalcFunctionList[FNrFunctions] := FFunctionList[i]; FCalcFunctionList[FNrFunctions] := FFunctionList[i];
Inc(FNrFunctions); Inc(FNrFunctions);
end; end;
end; end;
if (p[0,0]<>1) or (p[0,1]<>0) or(p[1,0]<>0) or (p[1,1]<>1) or (p[2,0]<>0) or (p[2,1]<>0) then
begin
p00 := p[0][0];
p01 := p[0][1];
p10 := p[1][0];
p11 := p[1][1];
p20 := p[2][0];
p21 := p[2][1];
FCalcFunctionList[FNrFunctions] := DoPostTransform;
Inc(FNrFunctions);
end;
(* (*
if (vars[27] <> 0.0) then begin if (vars[27] <> 0.0) then begin
FFunctionList[FNrFunctions] := TestScript; FFunctionList[FNrFunctions] := TestScript;
@ -238,19 +261,95 @@ begin
Inc(FNrFunctions); Inc(FNrFunctions);
end; end;
*) *)
end;
CalculateAngle := (vars[5] <> 0.0) or (vars[6] <> 0.0) or (vars[7] <> 0.0) or (vars[8] <> 0.0) or procedure TXForm.PrecalcAngle;
(vars[12] <> 0.0) or (vars[13] <> 0.0) or (vars[21] <> 0.0) or (vars[22] <> 0.0); asm
// CalculateLength := False; fld qword ptr [eax + FTx]
CalculateSinCos := (vars[9] <> 0.0) or (vars[11] <> 0.0) or (vars[19] <> 0.0) or (vars[21] <> 0.0); fld qword ptr [eax + FTy]
fpatan
fstp qword ptr [eax + FAngle]
fwait
end;
procedure TXForm.PrecalcSinCos;
asm
fld qword ptr [eax + FTx]
fld qword ptr [eax + FTy]
fld st(1)
fmul st, st
fld st(1)
fmul st, st
faddp
fsqrt
fdiv st(1), st
fdiv st(2), st
fstp qword ptr [eax + FLength]
fstp qword ptr [eax + FCosA]
fstp qword ptr [eax + FSinA]
fwait
end;
procedure TXForm.PrecalcAll;
asm
fld qword ptr [eax + FTx]
fld qword ptr [eax + FTy]
fld st(1)
fld st(1)
fpatan
fstp qword ptr [eax + FAngle]
fld st(1)
fmul st, st
fld st(1)
fmul st, st
faddp
fsqrt
fdiv st(1), st
fdiv st(2), st
fstp qword ptr [eax + FLength]
fstp qword ptr [eax + FCosA]
fstp qword ptr [eax + FSinA]
fwait
end;
procedure TXForm.DoPostTransform;
// x := p00 * FPx + p10 * FPy + p20;
// y := p01 * FPx + p11 * FPy + p21;
asm
fld qword ptr [eax + FPy]
fld qword ptr [eax + FPx]
fld st(1)
fmul qword ptr [eax + p10]
fld st(1)
fmul qword ptr [eax + p00]
faddp
fadd qword ptr [eax + p20]
fstp qword ptr [eax + FPx] // + px]
fmul qword ptr [eax + p01]
fld qword ptr [eax + p11]
fmulp st(2), st
faddp
fadd qword ptr [eax + p21]
fstp qword ptr [eax + FPy] // + py]
fwait
end; end;
//--0--//////////////////////////////////////////////////////////////////////// //--0--////////////////////////////////////////////////////////////////////////
procedure TXForm.Linear; procedure TXForm.Linear;
begin //begin
FPx := FPx + vars[0] * FTx; // FPx := FPx + vars[0] * FTx;
FPy := FPy + vars[0] * FTy; // FPy := FPy + vars[0] * FTy;
asm
mov edx, [eax + vars]
fld qword ptr [edx]
fld st
fmul qword ptr [eax + FTx]
fadd qword ptr [eax + FPx]
fstp qword ptr [eax + FPx]
fmul qword ptr [eax + FTy]
fadd qword ptr [eax + FPy]
fstp qword ptr [eax + FPy]
fwait
end; end;
//--1--//////////////////////////////////////////////////////////////////////// //--1--////////////////////////////////////////////////////////////////////////
@ -265,7 +364,7 @@ procedure TXForm.Spherical;
var var
r: double; r: double;
begin begin
r := vars[2] / (FTx * FTx + FTy * FTy + 1E-6); r := vars[2] / (sqr(FTx) + sqr(FTy) + 1E-6);
FPx := FPx + FTx * r; FPx := FPx + FTx * r;
FPy := FPy + FTy * r; FPy := FPy + FTy * r;
end; end;
@ -273,7 +372,7 @@ end;
//--3--//////////////////////////////////////////////////////////////////////// //--3--////////////////////////////////////////////////////////////////////////
procedure TXForm.Swirl; procedure TXForm.Swirl;
var var
rsin, rcos: double; sinr, cosr: double;
begin begin
{ {
r2 := FTx * FTx + FTy * FTy; r2 := FTx * FTx + FTy * FTy;
@ -282,9 +381,20 @@ begin
FPx := FPx + vars[3] * (c1 * FTx - c2 * FTy); FPx := FPx + vars[3] * (c1 * FTx - c2 * FTy);
FPy := FPy + vars[3] * (c2 * FTx + c1 * FTy); FPy := FPy + vars[3] * (c2 * FTx + c1 * FTy);
} }
SinCos(FTx * FTx + FTy * FTy, rsin, rcos); // SinCos(sqr(FTx) + sqr(FTy), rsin, rcos);
FPx := FPx + vars[3] * (rsin * FTx - rcos * FTy); asm
FPy := FPy + vars[3] * (rcos * FTx + rsin * FTy); fld qword ptr [eax + FTx]
fmul st, st
fld qword ptr [eax + FTy]
fmul st, st
faddp
fsincos
fstp qword ptr [cosr]
fstp qword ptr [sinr]
fwait
end;
FPx := FPx + vars[3] * (sinr * FTx - cosr * FTy);
FPy := FPy + vars[3] * (cosr * FTx + sinr * FTy);
end; end;
//--4--//////////////////////////////////////////////////////////////////////// //--4--////////////////////////////////////////////////////////////////////////
@ -342,8 +452,22 @@ procedure TXForm.Heart;
var var
r, sinr, cosr: double; r, sinr, cosr: double;
begin begin
r := sqrt(sqr(FTx) + sqr(FTy)); // r := sqrt(sqr(FTx) + sqr(FTy));
Sincos(r*FAngle, sinr, cosr); // Sincos(r*FAngle, sinr, cosr);
asm
fld qword ptr [eax + FTx]
fmul st, st
fld qword ptr [eax + FTy]
fmul st, st
faddp
fsqrt
fstp qword ptr [r]
fmul qword ptr [eax + FAngle]
fsincos
fstp qword ptr [cosr]
fstp qword ptr [sinr]
fwait
end;
r := r * vars[7]; r := r * vars[7];
FPx := FPx + r * sinr; FPx := FPx + r * sinr;
FPy := FPy - r * cosr; FPy := FPy - r * cosr;
@ -360,7 +484,21 @@ begin
// ny := FTy * PI; // ny := FTy * PI;
// r := sqrt(nx * nx + ny * ny); // r := sqrt(nx * nx + ny * ny);
SinCos(PI * sqrt(sqr(FTx) + sqr(FTy)), sinr, cosr); // SinCos(PI * sqrt(sqr(FTx) + sqr(FTy)), sinr, cosr);
asm
fld qword ptr [eax + FTx]
fmul st, st
fld qword ptr [eax + FTy]
fmul st, st
faddp
fsqrt
fldpi
fmulp
fsincos
fstp qword ptr [cosr]
fstp qword ptr [sinr]
fwait
end;
r := vars[8] * FAngle / PI; r := vars[8] * FAngle / PI;
FPx := FPx + sinr * r; FPx := FPx + sinr * r;
@ -372,9 +510,15 @@ procedure TXForm.Spiral;
var var
r, sinr, cosr: double; r, sinr, cosr: double;
begin begin
// r := sqrt(FTx * FTx + FTy * FTy) + 1E-6;
r := Flength + 1E-6; r := Flength + 1E-6;
SinCos(r, sinr, cosr); // SinCos(r, sinr, cosr);
asm
fld qword ptr [r]
fsincos
fstp qword ptr [cosr]
fstp qword ptr [sinr]
fwait
end;
r := vars[9] / r; r := vars[9] / r;
FPx := FPx + (FCosA + sinr) * r; FPx := FPx + (FCosA + sinr) * r;
FPy := FPy + (FsinA - cosr) * r; FPy := FPy + (FsinA - cosr) * r;
@ -398,18 +542,23 @@ begin
// Now watch and learn how to do this WITHOUT calculating sin and cos: // Now watch and learn how to do this WITHOUT calculating sin and cos:
begin begin
FPx := FPx + vars[10] * FTx / (FTx * FTx + FTy * FTy + 1E-6); FPx := FPx + vars[10] * FTx / (sqr(FTx) + sqr(FTy) + 1E-6);
FPy := FPy + vars[10] * FTy; FPy := FPy + vars[10] * FTy;
end; end;
//--11--/////////////////////////////////////////////////////////////////////// //--11--///////////////////////////////////////////////////////////////////////
procedure TXForm.Square; procedure TXForm.Square;
var var
// r: double;
sinr, cosr: double; sinr, cosr: double;
begin begin
// r := sqrt(FTx * FTx + FTy * FTy); // SinCos(FLength, sinr, cosr);
SinCos(FLength, sinr, cosr); asm
fld qword ptr [eax + FLength]
fsincos
fstp qword ptr [cosr]
fstp qword ptr [sinr]
fwait
end;
FPx := FPx + vars[11] * FSinA * cosr; FPx := FPx + vars[11] * FSinA * cosr;
FPy := FPy + vars[11] * FCosA * sinr; FPy := FPy + vars[11] * FCosA * sinr;
end; end;
@ -441,7 +590,14 @@ begin
a := FAngle/2 + PI a := FAngle/2 + PI
else else
a := FAngle/2; a := FAngle/2;
SinCos(a, sinr, cosr); // SinCos(a, sinr, cosr);
asm
fld qword ptr [a]
fsincos
fstp qword ptr [cosr]
fstp qword ptr [sinr]
fwait
end;
r := vars[13] * sqrt(sqrt(sqr(FTx) + sqr(FTy))); //Math.power(FTx * FTx + FTy * FTy, 0.25); r := vars[13] * sqrt(sqrt(sqr(FTx) + sqr(FTy))); //Math.power(FTx * FTx + FTy * FTy, 0.25);
FPx := FPx + r * cosr; FPx := FPx + r * cosr;
FPy := FPy + r * sinr; FPy := FPy + r * sinr;
@ -449,6 +605,7 @@ end;
//--14--/////////////////////////////////////////////////////////////////////// //--14--///////////////////////////////////////////////////////////////////////
procedure TXForm.Bent; procedure TXForm.Bent;
{
var var
nx, ny: double; nx, ny: double;
begin begin
@ -460,6 +617,17 @@ begin
ny := ny / 2; ny := ny / 2;
FPx := FPx + vars[14] * nx; FPx := FPx + vars[14] * nx;
FPy := FPy + vars[14] * ny; FPy := FPy + vars[14] * ny;
}
// --Z-- This variation is kinda weird...
begin
if FTx < 0 then
FPx := FPx + vars[14] * (FTx*2)
else
FPx := FPx + vars[14] * FTx;
if FTy < 0 then
FPy := FPy + vars[14] * (FTy/2)
else
FPy := FPy + vars[14] * FTy;
end; end;
//--15--/////////////////////////////////////////////////////////////////////// //--15--///////////////////////////////////////////////////////////////////////
@ -476,8 +644,8 @@ begin
FPy := FPy + vars[15] * ny; FPy := FPy + vars[15] * ny;
} }
begin begin
FPx := FPx + vars[15] * (FTx + c10 * sin(FTy / ((c20 * c20) + EPS))); FPx := FPx + vars[15] * (FTx + c10 * sin(FTy / (sqr(c20) + EPS)));
FPy := FPy + vars[15] * (FTy + c11 * sin(FTx / ((c21 * c21) + EPS))); FPy := FPy + vars[15] * (FTy + c11 * sin(FTx / (sqr(c21) + EPS)));
end; end;
//--16--/////////////////////////////////////////////////////////////////////// //--16--///////////////////////////////////////////////////////////////////////
@ -527,7 +695,16 @@ var
d: double; d: double;
sinr, cosr: double; sinr, cosr: double;
begin begin
SinCos(PI * FTy, sinr, cosr); // SinCos(PI * FTy, sinr, cosr);
asm
fld qword ptr [eax + FTy]
fldpi
fmulp
fsincos
fstp qword ptr [cosr]
fstp qword ptr [sinr]
fwait
end;
d := vars[18] * exp(FTx - 1); // --Z-- (e^x)/e = e^(x-1), isn't it?! d := vars[18] * exp(FTx - 1); // --Z-- (e^x)/e = e^(x-1), isn't it?!
FPx := FPx + cosr * d; FPx := FPx + cosr * d;
FPy := FPy + sinr * d; FPy := FPy + sinr * d;
@ -551,16 +728,31 @@ end;
//--20--/////////////////////////////////////////////////////////////////////// //--20--///////////////////////////////////////////////////////////////////////
procedure TXForm.Cosine; procedure TXForm.Cosine;
var var
// nx, ny: double;
sinr, cosr: double; sinr, cosr: double;
e1, e2: double;
begin begin
SinCos(FTx * PI, sinr, cosr); // SinCos(FTx * PI, sinr, cosr);
// nx := cosr * cosh(FTy); asm
// ny := -sinr * sinh(FTy); fld qword ptr [eax + FTx]
// FPx := FPx + vars[20] * nx; fldpi
// FPy := FPy + vars[20] * ny; fmulp
FPx := FPx + vars[20] * cosr * cosh(FTy); fsincos
FPy := FPy - vars[20] * sinr * sinh(FTy); fstp qword ptr [cosr]
fstp qword ptr [sinr]
fwait
end;
// FPx := FPx + vars[20] * cosr * cosh(FTy);
// FPy := FPy - vars[20] * sinr * sinh(FTy);
// --Z-- sinh() and cosh() both calculate exp(x) and exp(-x)
if FTy = 0 then
begin
FPx := FPx + vars[20] * cosr;
exit;
end;
e1 := exp(FTy);
e2 := exp(-FTy);
FPx := FPx + vars[20] * cosr * (e1 + e2)/2;
FPy := FPy - vars[20] * sinr * (e1 - e2)/2;
end; end;
//--21--/////////////////////////////////////////////////////////////////////// //--21--///////////////////////////////////////////////////////////////////////
@ -590,7 +782,7 @@ end;
//--22--/////////////////////////////////////////////////////////////////////// //--22--///////////////////////////////////////////////////////////////////////
procedure TXForm.Fan; procedure TXForm.Fan;
var var
r,t,a : double; r, a : double;
dx, dy, dx2: double; dx, dy, dx2: double;
sinr, cosr: double; sinr, cosr: double;
begin begin
@ -600,17 +792,24 @@ begin
r := vars[22] * sqrt(sqr(FTx) + sqr(FTy)); r := vars[22] * sqrt(sqr(FTx) + sqr(FTy));
t := FAngle+dy - System.Int((FAngle + dy)/dx) * dx; if (FAngle+dy - System.Int((FAngle + dy)/dx) * dx) > dx2 then
if (t > dx2) then
a := FAngle - dx2 a := FAngle - dx2
else else
a := FAngle + dx2; a := FAngle + dx2;
SinCos(a, sinr, cosr); // SinCos(a, sinr, cosr);
asm
fld qword ptr [a]
fsincos
fstp qword ptr [cosr]
fstp qword ptr [sinr]
fwait
end;
FPx := FPx + r * cosr; FPx := FPx + r * cosr;
FPy := FPy + r * sinr; FPy := FPy + r * sinr;
end; end;
(*
//--23--/////////////////////////////////////////////////////////////////////// //--23--///////////////////////////////////////////////////////////////////////
procedure TXForm.Triblob; procedure TXForm.Triblob;
@ -690,18 +889,40 @@ begin
FPy := FPy + vars[26] * r * sinr; FPy := FPy + vars[26] * r * sinr;
end; end;
*)
//***************************************************************************// //***************************************************************************//
procedure TXForm.NextPoint(var px,py,pc: double); procedure TXForm.PreviewPoint(var px, py: double);
var
i: Integer;
begin
FTx := c00 * px + c10 * py + c20;
FTy := c01 * px + c11 * py + c21;
Fpx := 0;
Fpy := 0;
for i := 0 to FNrFunctions - 1 do
FCalcFunctionList[i];
px := FPx;
py := FPy;
end;
procedure TXForm.NextPoint(var px, py, pc: double);
var var
i: Integer; i: Integer;
begin begin
// first compute the color coord // first compute the color coord
pc := (pc + color) * 0.5 * (1 - symmetry) + symmetry * pc; if symmetry = 0 then
pc := (pc + color) / 2
else
pc := (pc + color) * 0.5 * (1 - symmetry) + symmetry * pc;
FTx := c00 * px + c10 * py + c20; FTx := c00 * px + c10 * py + c20;
FTy := c01 * px + c11 * py + c21; FTy := c01 * px + c11 * py + c21;
(*
if CalculateAngle then begin if CalculateAngle then begin
if (FTx < -EPS) or (FTx > EPS) or (FTy < -EPS) or (FTy > EPS) then if (FTx < -EPS) or (FTx > EPS) or (FTy < -EPS) or (FTy > EPS) then
FAngle := arctan2(FTx, FTy) FAngle := arctan2(FTx, FTy)
@ -723,21 +944,15 @@ begin
// if CalculateLength then begin // if CalculateLength then begin
// FLength := sqrt(FTx * FTx + FTy * FTy); // FLength := sqrt(FTx * FTx + FTy * FTy);
// end; // end;
*)
Fpx := 0; Fpx := 0;
Fpy := 0; Fpy := 0;
for i := 0 to FNrFunctions - 1 do for i := 0 to FNrFunctions - 1 do
FCalcFunctionList[i]; FCalcFunctionList[i];
if PostTransformEnabled then begin px := FPx;
px := p00 * FPx + p10 * FPy + p20; py := FPy;
py := p01 * FPx + p11 * FPy + p21;
end
else begin
px := FPx;
py := FPy;
end;
// px := p[0,0] * FPx + p[1,0] * FPy + p[2,0]; // px := p[0,0] * FPx + p[1,0] * FPy + p[2,0];
// py := p[0,1] * FPx + p[1,1] * FPy + p[2,1]; // py := p[0,1] * FPx + p[1,1] * FPy + p[2,1];
end; end;
@ -748,11 +963,15 @@ var
i: Integer; i: Integer;
begin begin
// first compute the color coord // first compute the color coord
CPpoint.c := (CPpoint.c + color) * 0.5 * (1 - symmetry) + symmetry * CPpoint.c; if symmetry = 0 then
CPpoint.c := (CPpoint.c + color) / 2
else
CPpoint.c := (CPpoint.c + color) * 0.5 * (1 - symmetry) + symmetry * CPpoint.c;
FTx := c00 * CPpoint.x + c10 * CPpoint.y + c20; FTx := c00 * CPpoint.x + c10 * CPpoint.y + c20;
FTy := c01 * CPpoint.x + c11 * CPpoint.y + c21; FTy := c01 * CPpoint.x + c11 * CPpoint.y + c21;
(*
if CalculateAngle then begin if CalculateAngle then begin
if (FTx < -EPS) or (FTx > EPS) or (FTy < -EPS) or (FTy > EPS) then if (FTx < -EPS) or (FTx > EPS) or (FTy < -EPS) or (FTy > EPS) then
FAngle := arctan2(FTx, FTy) FAngle := arctan2(FTx, FTy)
@ -774,6 +993,7 @@ begin
// if CalculateLength then begin // if CalculateLength then begin
// FLength := sqrt(FTx * FTx + FTy * FTy); // FLength := sqrt(FTx * FTx + FTy * FTy);
// end; // end;
*)
Fpx := 0; Fpx := 0;
Fpy := 0; Fpy := 0;
@ -781,19 +1001,14 @@ begin
for i:= 0 to FNrFunctions-1 do for i:= 0 to FNrFunctions-1 do
FFunctionList[i]; FFunctionList[i];
if PostTransformEnabled then begin CPpoint.x := FPx;
CPpoint.x := p00 * FPx + p10 * FPy + p20; CPpoint.y := FPy;
CPpoint.y := p01 * FPx + p11 * FPy + p21;
end
else begin
CPpoint.x := FPx;
CPpoint.y := FPy;
end;
// CPpoint.x := p[0,0] * FPx + p[1,0] * FPy + p[2,0]; // CPpoint.x := p[0,0] * FPx + p[1,0] * FPy + p[2,0];
// CPpoint.y := p[0,1] * FPx + p[1,1] * FPy + p[2,1]; // CPpoint.y := p[0,1] * FPx + p[1,1] * FPy + p[2,1];
end; end;
{
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
procedure TXForm.NextPoint(var px, py, pz, pc: double); procedure TXForm.NextPoint(var px, py, pz, pc: double);
var var
@ -822,6 +1037,7 @@ begin
FTx := c00 * tpx + c10 * tpy + c20; FTx := c00 * tpx + c10 * tpy + c20;
FTy := c01 * tpx + c11 * tpy + c21; FTy := c01 * tpx + c11 * tpy + c21;
(*
if CalculateAngle then begin if CalculateAngle then begin
if (FTx < -EPS) or (FTx > EPS) or (FTy < -EPS) or (FTy > EPS) then if (FTx < -EPS) or (FTx > EPS) or (FTy < -EPS) or (FTy > EPS) then
FAngle := arctan2(FTx, FTy) FAngle := arctan2(FTx, FTy)
@ -843,6 +1059,7 @@ begin
// if CalculateLength then begin // if CalculateLength then begin
// FLength := sqrt(FTx * FTx + FTy * FTy); // FLength := sqrt(FTx * FTx + FTy * FTy);
// end; // end;
*)
Fpx := 0; Fpx := 0;
Fpy := 0; Fpy := 0;
@ -866,6 +1083,7 @@ begin
py := FPy; py := FPy;
end; end;
end; end;
}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
procedure TXForm.NextPoint2C(var px, py, pc1, pc2: double); procedure TXForm.NextPoint2C(var px, py, pc1, pc2: double);
@ -879,6 +1097,7 @@ begin
FTx := c00 * px + c10 * py + c20; FTx := c00 * px + c10 * py + c20;
FTy := c01 * px + c11 * py + c21; FTy := c01 * px + c11 * py + c21;
(*
if CalculateAngle then begin if CalculateAngle then begin
if (FTx < -EPS) or (FTx > EPS) or (FTy < -EPS) or (FTy > EPS) then if (FTx < -EPS) or (FTx > EPS) or (FTy < -EPS) or (FTy > EPS) then
FAngle := arctan2(FTx, FTy) FAngle := arctan2(FTx, FTy)
@ -900,6 +1119,7 @@ begin
// if CalculateLength then begin // if CalculateLength then begin
// FLength := sqrt(FTx * FTx + FTy * FTy); // FLength := sqrt(FTx * FTx + FTy * FTy);
// end; // end;
*)
Fpx := 0; Fpx := 0;
Fpy := 0; Fpy := 0;
@ -907,16 +1127,8 @@ begin
for i:= 0 to FNrFunctions-1 do for i:= 0 to FNrFunctions-1 do
FFunctionList[i]; FFunctionList[i];
// px := FPx; px := FPx;
// py := FPy; py := FPy;
if PostTransformEnabled then begin
px := p00 * FPx + p10 * FPy + p20;
py := p01 * FPx + p11 * FPy + p21;
end
else begin
px := FPx;
py := FPy;
end;
// px := p[0,0] * FPx + p[1,0] * FPy + p[2,0]; // px := p[0,0] * FPx + p[1,0] * FPy + p[2,0];
// py := p[0,1] * FPx + p[1,1] * FPy + p[2,1]; // py := p[0,1] * FPx + p[1,1] * FPy + p[2,1];
end; end;
@ -929,6 +1141,7 @@ begin
FTx := c00 * px + c10 * py + c20; FTx := c00 * px + c10 * py + c20;
FTy := c01 * px + c11 * py + c21; FTy := c01 * px + c11 * py + c21;
(*
if CalculateAngle then begin if CalculateAngle then begin
if (FTx < -EPS) or (FTx > EPS) or (FTy < -EPS) or (FTy > EPS) then if (FTx < -EPS) or (FTx > EPS) or (FTy < -EPS) or (FTy > EPS) then
FAngle := arctan2(FTx, FTy) FAngle := arctan2(FTx, FTy)
@ -946,6 +1159,7 @@ begin
FCosA := FTy/FLength; FCosA := FTy/FLength;
end; end;
end; end;
*)
Fpx := 0; Fpx := 0;
Fpy := 0; Fpy := 0;
@ -953,16 +1167,8 @@ begin
for i:= 0 to FNrFunctions-1 do for i:= 0 to FNrFunctions-1 do
FFunctionList[i]; FFunctionList[i];
// px := FPx; px := FPx;
// py := FPy; py := FPy;
if PostTransformEnabled then begin
px := p00 * FPx + p10 * FPy + p20;
py := p01 * FPx + p11 * FPy + p21;
end
else begin
px := FPx;
py := FPy;
end;
// px := p[0,0] * FPx + p[1,0] * FPy + p[2,0]; // px := p[0,0] * FPx + p[1,0] * FPy + p[2,0];
// py := p[0,1] * FPx + p[1,1] * FPy + p[2,1]; // py := p[0,1] * FPx + p[1,1] * FPy + p[2,1];
end; end;