mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-03 22:58:22 +02:00
TAChart: Replace separate sin() and cos() calls by sincos(). Issue #40473.
This commit is contained in:
parent
ffe2e33f69
commit
493a568bb0
@ -83,8 +83,7 @@ begin
|
||||
|
||||
t := (Now() - FStartTime) * SecsPerDay;
|
||||
exp_factor := exp(-t/td);
|
||||
sin_factor := sin(TWO_PI * t / t0);
|
||||
cos_factor := cos(TWO_PI * t / t0);
|
||||
SinCols(TWO_PI * t / t0, sin_factor, cos_factor);
|
||||
|
||||
// Position: an exponentially damped sinusoidal motion
|
||||
x := A0 * sin_factor * exp_factor;
|
||||
|
@ -65,6 +65,9 @@
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf3"/>
|
||||
</Debugging>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
|
@ -21,7 +21,6 @@ type
|
||||
FInterpolate: Boolean;
|
||||
FNumXCountNeeded: Integer;
|
||||
FNumYCountNeeded: Integer;
|
||||
FOwnerSeries: TCustomChartSeries;
|
||||
FPaletteMax: Double;
|
||||
FPaletteMin: Double;
|
||||
FOnChanged: TNotifyEvent;
|
||||
|
@ -1383,6 +1383,7 @@ function TPolarSeries.GetNearestPoint(const AParams: TNearestPointParams;
|
||||
var
|
||||
dist: Integer;
|
||||
gp: TDoublePoint;
|
||||
sin_gpx, cos_gpx: Double;
|
||||
i: Integer;
|
||||
begin
|
||||
Result := false;
|
||||
@ -1406,9 +1407,10 @@ begin
|
||||
if dist >= AResults.FDist then
|
||||
continue;
|
||||
|
||||
SinCos(gp.x, sin_gpx, cos_gpx);
|
||||
AResults.FDist := dist;
|
||||
AResults.FIndex := i;
|
||||
AResults.FValue := DoublePoint(gp.y*cos(gp.x), gp.y*sin(gp.x));
|
||||
AResults.FValue := DoublePoint(gp.y*cos_gpx, gp.y*sin_gpx);
|
||||
AResults.FImg := ParentChart.GraphToImage(gp);
|
||||
if dist = 0 then break;
|
||||
end;
|
||||
|
@ -893,12 +893,16 @@ procedure TGenericChartMarks.DrawLink(
|
||||
ADrawer: IChartDrawer; ADataPoint, ALabelCenter: TPoint);
|
||||
var
|
||||
phi: Double;
|
||||
sinPhi, cosPhi: Double;
|
||||
begin
|
||||
if ADataPoint = ALabelCenter then exit;
|
||||
|
||||
with (ADataPoint - ALabelCenter) do phi := ArcTan2(Y, X);
|
||||
if (FLinkDistance <> 0) then
|
||||
ADataPoint := ADataPoint + Point(round(FLinkDistance*cos(phi)), -round(FLinkDistance*sin(phi)));
|
||||
begin
|
||||
SinCos(phi, sinPhi, cosPhi);
|
||||
ADataPoint := ADataPoint + Point(round(FLinkDistance*cosPhi), -round(FLinkDistance*sinPhi));
|
||||
end;
|
||||
|
||||
inherited;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user