Skip to content

Commit

Permalink
chore(optimization): Tiny optimization with pre-computed cos/sin from…
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti authored and nyalldawson committed Feb 19, 2025
1 parent fee07f9 commit e50a331
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/core/geometry/qgsellipse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,12 @@ void QgsEllipse::pointsInternal( unsigned int segments, QVector<double> &x, QVec
const double sinAzimuth = std::sin( azimuth );
for ( double it : t )
{
*xOut++ = centerX +
mSemiMajorAxis * std::cos( it ) * cosAzimuth -
mSemiMinorAxis * std::sin( it ) * sinAzimuth;
*yOut++ = centerY +
mSemiMajorAxis * std::cos( it ) * sinAzimuth +
mSemiMinorAxis * std::sin( it ) * cosAzimuth;
const double cosT{ std::cos( it ) };
const double sinT{ std::sin( it ) };
*xOut++ = centerX + mSemiMajorAxis * cosT * cosAzimuth -
mSemiMinorAxis * sinT * sinAzimuth;
*yOut++ = centerY + mSemiMajorAxis * cosT * sinAzimuth +
mSemiMinorAxis * sinT * cosAzimuth;
if ( zOut )
*zOut++ = centerZ;
if ( mOut )
Expand Down

0 comments on commit e50a331

Please sign in to comment.