Sin/cos combinations to math.sincos. resolves gitlab #40288 by Alexey T minus the Amiga parts.

This commit is contained in:
marcoonthegit 2023-07-10 17:18:24 +02:00
parent 032158d943
commit fa44cd9da6
4 changed files with 16 additions and 9 deletions

View File

@ -252,8 +252,7 @@ begin
else
begin
OneOverSqrt2 := 1.0 / sqrt(2.0);
sinx := sin(x);
cosx := cos(x);
SinCos(x,sinx,cosx);
result := sqrt(2.0/(PI*x)) *
( P1(x)*(OneOverSqrt2*(sinx-cosx))
- 8.0/x*Q1(x)*(-OneOverSqrt2*(sinx+cosx))

View File

@ -19,7 +19,7 @@ unit freetype;
interface
uses sysutils, classes, {$IFDEF DYNAMIC}freetypehdyn{$ELSE}freetypeh{$ENDIF}, FPImgCmn;
uses sysutils, classes, math, {$IFDEF DYNAMIC}freetypehdyn{$ELSE}freetypeh{$ENDIF}, FPImgCmn;
{ TODO : take resolution in account to find the size }
{ TODO : speed optimization: search glyphs with a hash-function/tree/binary search/... }
@ -542,13 +542,20 @@ begin
end;
procedure TFontManager.MakeTransformation (angle:real; out Transformation:FT_Matrix);
var ScaledAngle,asin,acos : Real;
begin
ScaledAngle :=Angle*$10000;
with Transformation do
begin
xx := round( cos(angle)*$10000);
sincos(ScaledAngle,asin,acos);
yx:=round(asin);
xx:=round(acos);
xy:=-yx; yy:=xx;
{ xx := round( cos(angle)*$10000);
xy := round(-sin(angle)*$10000);
yx := round( sin(angle)*$10000);
yy := round( cos(angle)*$10000);
}
end;
end;

View File

@ -18,7 +18,7 @@ unit PolygonFillTools;
interface
uses
Classes, FPImage, FPCanvas, PixTools;
Math, Classes, FPImage, FPCanvas, PixTools;
procedure FillPolygonSolid(Canv: TFPCustomCanvas; const Points: array of TPoint;
Winding: Boolean; Color: TFPColor);
@ -103,8 +103,7 @@ function RotatePoint(const APoint: TPoint; Angle: Double): TPoint;
var
sa, ca: Double;
begin
sa := sin(Angle);
ca := cos(Angle);
sincos(Angle,sa,ca);
Result.X := Round( ca * APoint.X + sa * APoint.Y);
Result.Y := Round(-sa * APoint.X + ca * APoint.Y);
end;

View File

@ -516,9 +516,11 @@ Unit UComplex;
{ sinus complex }
{ sin(x+iy) = sin(x).cos(iy) + cos(x).sin(iy) }
{ cos(ix) = cosh(x) et sin(ix) = i.sinh(x) }
var sinre,cosre : real;
begin
csin.re := sin(z.re) * cosh(z.im);
csin.im := cos(z.re) * sinh(z.im);
sincos(z.re,sinre,cosre);
csin.re := sinre * cosh(z.im);
csin.im := cosre * sinh(z.im);
end;
function ctg (const z : complex) : complex;