mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-22 00:06:12 -05:00
chore(optimization): Tiny optimization with pre-computed cos/sin from angle for QgsEllipse
Some benchmarks here: https://github.com/lbartoletti/lbartoletti.github.io/tree/master/archives/qgis/ellipse_benchmark
This commit is contained in:
parent
3ee8614932
commit
f08eda1fcc
@ -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 )
|
||||
|
Loading…
x
Reference in New Issue
Block a user