Skip to content
Permalink
Browse files

(q)cos -> std::cos

  • Loading branch information
nyalldawson committed Aug 24, 2017
1 parent 7c5aa05 commit 2e5d1abbb18aa9c32de65068e3f8d300435cb99c
Showing with 188 additions and 188 deletions.
  1. +1 −1 src/analysis/raster/qgshillshadefilter.cpp
  2. +1 −1 src/analysis/raster/qgsrastermatrix.cpp
  3. +1 −1 src/analysis/raster/qgsrastermatrix.h
  4. +1 −1 src/analysis/raster/qgsrelief.cpp
  5. +3 −3 src/app/dwg/libdxfrw/drw_entities.cpp
  6. +6 −6 src/app/dwg/qgsdwgimporter.cpp
  7. +1 −1 src/app/nodetool/qgsnodetool.cpp
  8. +2 −2 src/app/qgsdecorationnortharrow.cpp
  9. +2 −2 src/app/qgsdecorationnortharrowdialog.cpp
  10. +2 −2 src/app/qgsmaptoollabel.cpp
  11. +1 −1 src/app/qgsmaptooloffsetpointsymbol.cpp
  12. +4 −4 src/app/qgsmaptoolrotatefeature.cpp
  13. +2 −2 src/app/qgsmaptoolrotatelabel.cpp
  14. +1 −1 src/app/qgsmaptoolselectradius.cpp
  15. +1 −1 src/app/qgspointrotationitem.cpp
  16. +1 −1 src/app/qgsrastercalcdialog.cpp
  17. +2 −2 src/core/composer/qgscomposerarrow.cpp
  18. +7 −7 src/core/composer/qgscomposerutils.cpp
  19. +5 −5 src/core/composer/qgscomposition.cpp
  20. +1 −1 src/core/effects/qgsshadoweffect.cpp
  21. +1 −1 src/core/expression/qgsexpressionfunction.cpp
  22. +5 −5 src/core/geometry/qgsellipse.cpp
  23. +1 −1 src/core/geometry/qgsgeometryutils.cpp
  24. +2 −2 src/core/geometry/qgsinternalgeometryengine.cpp
  25. +3 −3 src/core/geometry/qgspoint.cpp
  26. +2 −2 src/core/geometry/qgsregularpolygon.cpp
  27. +1 −1 src/core/geometry/qgsregularpolygon.h
  28. +25 −25 src/core/pal/feature.cpp
  29. +2 −2 src/core/pal/geomfunction.cpp
  30. +2 −2 src/core/pal/labelposition.cpp
  31. +2 −2 src/core/pal/pointset.cpp
  32. +16 −16 src/core/qgsdistancearea.cpp
  33. +4 −4 src/core/qgsmapsettingsutils.cpp
  34. +2 −2 src/core/qgspallabeling.cpp
  35. +1 −1 src/core/qgspointxy.cpp
  36. +1 −1 src/core/qgsscalecalculator.cpp
  37. +3 −3 src/core/qgstextrenderer.cpp
  38. +1 −1 src/core/qgsvector.cpp
  39. +2 −2 src/core/qgsvectorlayerlabelprovider.cpp
  40. +8 −8 src/core/raster/qgshillshaderenderer.cpp
  41. +4 −4 src/core/symbology/qgs25drenderer.cpp
  42. +1 −1 src/core/symbology/qgsarrowsymbollayer.cpp
  43. +1 −1 src/core/symbology/qgsellipsesymbollayer.cpp
  44. +9 −9 src/core/symbology/qgsfillsymbollayer.cpp
  45. +2 −2 src/core/symbology/qgslinesymbollayer.cpp
  46. +21 −21 src/core/symbology/qgsmarkersymbollayer.cpp
  47. +2 −2 src/core/symbology/qgspointdisplacementrenderer.cpp
  48. +1 −1 src/core/symbology/qgssymbollayer.cpp
  49. +1 −1 src/core/symbology/qgsvectorfieldsymbollayer.cpp
  50. +3 −3 src/gui/qgsadvanceddigitizingcanvasitem.cpp
  51. +2 −2 src/gui/qgsadvanceddigitizingdockwidget.cpp
  52. +5 −5 src/gui/qgscolorwidgets.cpp
  53. +2 −2 src/plugins/georeferencer/qgsgeorefplugingui.cpp
  54. +4 −4 src/plugins/georeferencer/qgsgeoreftransform.cpp
  55. +1 −1 tests/src/core/testqgsgeometry.cpp
@@ -49,5 +49,5 @@ float QgsHillshadeFilter::processNineCellWindow( float *x11, float *x21, float *
{
aspect_rad = M_PI + std::atan2( derX, derY );
}
return qMax( 0.0, 255.0 * ( ( cos( zenith_rad ) * cos( slope_rad ) ) + ( sin( zenith_rad ) * sin( slope_rad ) * cos( azimuth_rad - aspect_rad ) ) ) );
return qMax( 0.0, 255.0 * ( ( std::cos( zenith_rad ) * std::cos( slope_rad ) ) + ( sin( zenith_rad ) * sin( slope_rad ) * std::cos( azimuth_rad - aspect_rad ) ) ) );
}
@@ -223,7 +223,7 @@ bool QgsRasterMatrix::oneArgumentOperation( OneArgOperator op )
mData[i] = sin( value );
break;
case opCOS:
mData[i] = cos( value );
mData[i] = std::cos( value );
break;
case opTAN:
mData[i] = tan( value );
@@ -124,7 +124,7 @@ class ANALYSIS_EXPORT QgsRasterMatrix
bool twoArgumentOperation( TwoArgOperator op, const QgsRasterMatrix &other );
double calculateTwoArgumentOp( TwoArgOperator op, double arg1, double arg2 ) const;

/*sqrt, sin, cos, tan, asin, acos, atan*/
/*sqrt, sin, std::cos, tan, asin, acos, atan*/
bool oneArgumentOperation( OneArgOperator op );
bool testPowerValidity( double base, double power ) const;
};
@@ -362,7 +362,7 @@ bool QgsRelief::processNineCellWindow( float *x1, float *x2, float *x3, float *x
int r3, g3, b3;
if ( angle_diff < 90 )
{
int aspectVal = ( 1 - cos( angle_diff * M_PI / 180 ) ) * 255;
int aspectVal = ( 1 - std::cos( angle_diff * M_PI / 180 ) ) * 255;
r3 = 0.5 * 255 + hillShadeValue315 * 0.5;
g3 = 0.5 * 255 + hillShadeValue315 * 0.5;
b3 = 0.5 * aspectVal + hillShadeValue315 * 0.5;
@@ -956,9 +956,9 @@ void DRW_Ellipse::toPolyline( DRW_Polyline *pol, int parts ) const
{
double radMajor = sqrt( secPoint.x * secPoint.x + secPoint.y * secPoint.y );
double radMinor = radMajor * ratio;
//calculate sin & cos of included angle
//calculate sin & std::cos of included angle
double incAngle = std::atan2( secPoint.y, secPoint.x );
double cosRot = cos( incAngle );
double cosRot = std::cos( incAngle );
double sinRot = sin( incAngle );

incAngle = M_PIx2 / parts;
@@ -969,7 +969,7 @@ void DRW_Ellipse::toPolyline( DRW_Polyline *pol, int parts ) const

while ( curAngle < endAngle )
{
double cosCurr = cos( curAngle );
double cosCurr = std::cos( curAngle );
double sinCurr = sin( curAngle );
double x = basePoint.x + cosCurr * cosRot * radMajor - sinCurr * sinRot * radMinor;
double y = basePoint.y + cosCurr * sinRot * radMajor + sinCurr * cosRot * radMinor;
@@ -1341,9 +1341,9 @@ void QgsDwgImporter::addArc( const DRW_Arc &data )

QgsCircularString c;
c.setPoints( QgsPointSequence()
<< QgsPoint( QgsWkbTypes::PointZ, data.basePoint.x + cos( a0 ) * data.mRadius, data.basePoint.y + sin( a0 ) * data.mRadius )
<< QgsPoint( QgsWkbTypes::PointZ, data.basePoint.x + cos( a1 ) * data.mRadius, data.basePoint.y + sin( a1 ) * data.mRadius )
<< QgsPoint( QgsWkbTypes::PointZ, data.basePoint.x + cos( a2 ) * data.mRadius, data.basePoint.y + sin( a2 ) * data.mRadius )
<< QgsPoint( QgsWkbTypes::PointZ, data.basePoint.x + std::cos( a0 ) * data.mRadius, data.basePoint.y + sin( a0 ) * data.mRadius )
<< QgsPoint( QgsWkbTypes::PointZ, data.basePoint.x + std::cos( a1 ) * data.mRadius, data.basePoint.y + sin( a1 ) * data.mRadius )
<< QgsPoint( QgsWkbTypes::PointZ, data.basePoint.x + std::cos( a2 ) * data.mRadius, data.basePoint.y + sin( a2 ) * data.mRadius )
);

if ( !createFeature( layer, f, c ) )
@@ -1446,7 +1446,7 @@ bool QgsDwgImporter::curveFromLWPolyline( const DRW_LWPolyline &data, QgsCompoun
double dy = data.vertlist[i1]->y - data.vertlist[i0]->y;
double c = sqrt( dx * dx + dy * dy );
double r = c / 2.0 / sin( a );
double h = r * ( 1 - cos( a ) );
double h = r * ( 1 - std::cos( a ) );

s << QgsPoint( QgsWkbTypes::PointZ,
data.vertlist[i0]->x + 0.5 * dx + h * dy / c,
@@ -1557,7 +1557,7 @@ void QgsDwgImporter::addLWPolyline( const DRW_LWPolyline &data )
double dy = p1.y() - p0.y();
double c = sqrt( dx * dx + dy * dy );
double r = c / 2.0 / sin( a );
double h = r * ( 1 - cos( a ) );
double h = r * ( 1 - std::cos( a ) );

s << QgsPoint( QgsWkbTypes::PointZ,
p0.x() + 0.5 * dx + h * dy / c,
@@ -1759,7 +1759,7 @@ void QgsDwgImporter::addPolyline( const DRW_Polyline &data )
double dz = p1.z() - p0.z();
double c = sqrt( dx * dx + dy * dy );
double r = c / 2.0 / sin( a );
double h = r * ( 1 - cos( a ) );
double h = r * ( 1 - std::cos( a ) );

s << QgsPoint( QgsWkbTypes::PointZ,
p0.x() + 0.5 * dx + h * dy / c,
@@ -682,7 +682,7 @@ QgsPointXY QgsNodeTool::positionForEndpointMarker( const QgsPointLocator::Match
double dy = pt1.y() - pt0.y();
double dist = 15 * canvas()->mapSettings().mapUnitsPerPixel();
double angle = std::atan2( dy, dx ); // to the top: angle=0, to the right: angle=90, to the left: angle=-90
double x = pt1.x() + cos( angle ) * dist;
double x = pt1.x() + std::cos( angle ) * dist;
double y = pt1.y() + sin( angle ) * dist;
return QgsPointXY( x, y );
}
@@ -137,12 +137,12 @@ void QgsDecorationNorthArrow::render( const QgsMapSettings &mapSettings, QgsRend

double myRadiansDouble = mRotationInt * M_PI / 180.0;
int xShift = static_cast<int>( (
( centerXDouble * cos( myRadiansDouble ) ) +
( centerXDouble * std::cos( myRadiansDouble ) ) +
( centerYDouble * sin( myRadiansDouble ) )
) - centerXDouble );
int yShift = static_cast<int>( (
( -centerXDouble * sin( myRadiansDouble ) ) +
( centerYDouble * cos( myRadiansDouble ) )
( centerYDouble * std::cos( myRadiansDouble ) )
) - centerYDouble );

// need width/height of paint device
@@ -155,12 +155,12 @@ void QgsDecorationNorthArrowDialog::drawNorthArrow()
const double PI = 3.14159265358979323846;
double myRadiansDouble = ( PI / 180 ) * rotation;
int xShift = static_cast<int>( (
( centerXDouble * cos( myRadiansDouble ) ) +
( centerXDouble * std::cos( myRadiansDouble ) ) +
( centerYDouble * sin( myRadiansDouble ) )
) - centerXDouble );
int yShift = static_cast<int>( (
( -centerXDouble * sin( myRadiansDouble ) ) +
( centerYDouble * cos( myRadiansDouble ) )
( centerYDouble * std::cos( myRadiansDouble ) )
) - centerYDouble );

//draw the pixmap in the proper position
@@ -376,8 +376,8 @@ bool QgsMapToolLabel::currentLabelRotationPoint( QgsPointXY &pos, bool ignoreUps
}

double angle = mCurrentLabel.pos.rotation;
double xd = xdiff * cos( angle ) - ydiff * sin( angle );
double yd = xdiff * sin( angle ) + ydiff * cos( angle );
double xd = xdiff * std::cos( angle ) - ydiff * sin( angle );
double yd = xdiff * sin( angle ) + ydiff * std::cos( angle );
if ( mCurrentLabel.pos.upsideDown && !ignoreUpsideDown )
{
pos.setX( pos.x() - xd );
@@ -270,7 +270,7 @@ QPointF QgsMapToolOffsetPointSymbol::calculateOffset( const QgsPointXY &startPoi
QPointF QgsMapToolOffsetPointSymbol::rotatedOffset( QPointF offset, double angle ) const
{
angle = DEG2RAD( 360 - angle );
double c = cos( angle ), s = sin( angle );
double c = std::cos( angle ), s = sin( angle );
return QPointF( offset.x() * c - offset.y() * s, offset.x() * s + offset.y() * c );
}

@@ -351,12 +351,12 @@ void QgsMapToolRotateFeature::applyRotation( double rotation )
//calculations for affine transformation
double angle = -1 * mRotation * ( PI / 180 );
QgsPointXY anchorPoint = toLayerCoordinates( vlayer, mStartPointMapCoords );
double a = cos( angle );
double a = std::cos( angle );
double b = -1 * sin( angle );
double c = anchorPoint.x() - cos( angle ) * anchorPoint.x() + sin( angle ) * anchorPoint.y();
double c = anchorPoint.x() - std::cos( angle ) * anchorPoint.x() + sin( angle ) * anchorPoint.y();
double d = sin( angle );
double ee = cos( angle );
double f = anchorPoint.y() - sin( angle ) * anchorPoint.x() - cos( angle ) * anchorPoint.y();
double ee = std::cos( angle );
double f = anchorPoint.y() - sin( angle ) * anchorPoint.x() - std::cos( angle ) * anchorPoint.y();

vlayer->beginEditCommand( tr( "Features Rotated" ) );

@@ -230,8 +230,8 @@ QgsPointXY QgsMapToolRotateLabel::rotatePointCounterClockwise( const QgsPointXY
double v1x = input.x() - centerPoint.x();
double v1y = input.y() - centerPoint.y();

double v2x = cos( rad ) * v1x - sin( rad ) * v1y;
double v2y = sin( rad ) * v1x + cos( rad ) * v1y;
double v2x = std::cos( rad ) * v1x - sin( rad ) * v1y;
double v2y = sin( rad ) * v1x + std::cos( rad ) * v1y;

return QgsPointXY( centerPoint.x() + v2x, centerPoint.y() + v2y );
}
@@ -107,7 +107,7 @@ void QgsMapToolSelectRadius::setRadiusRubberBand( QgsPointXY &radiusEdge )
for ( int i = 0; i <= RADIUS_SEGMENTS; ++i )
{
double theta = i * ( 2.0 * M_PI / RADIUS_SEGMENTS );
QgsPointXY radiusPoint( mRadiusCenter.x() + r * cos( theta ),
QgsPointXY radiusPoint( mRadiusCenter.x() + r * std::cos( theta ),
mRadiusCenter.y() + r * sin( theta ) );
mRubberBand->addPoint( radiusPoint, false );
}
@@ -56,7 +56,7 @@ void QgsPointRotationItem::paint( QPainter *painter )
{
h = sqrt( ( double ) mPixmap.width() * mPixmap.width() + mPixmap.height() * mPixmap.height() ) / 2; //the half of the item diagonal
dAngel = acos( mPixmap.width() / ( h * 2 ) ) * 180 / M_PI; //the diagonal angel of the original rect
x = h * cos( ( painterRotation( mRotation ) - dAngel ) * M_PI / 180 );
x = h * std::cos( ( painterRotation( mRotation ) - dAngel ) * M_PI / 180 );
y = h * sin( ( painterRotation( mRotation ) - dAngel ) * M_PI / 180 );
}

@@ -355,7 +355,7 @@ void QgsRasterCalcDialog::on_mSqrtButton_clicked()

void QgsRasterCalcDialog::on_mCosButton_clicked()
{
mExpressionTextEdit->insertPlainText( QStringLiteral( " cos ( " ) );
mExpressionTextEdit->insertPlainText( QStringLiteral( " std::cos ( " ) );
}

void QgsRasterCalcDialog::on_mSinButton_clicked()
@@ -280,8 +280,8 @@ void QgsComposerArrow::drawSVGMarker( QPainter *p, MarkerType type, const QStrin
}
QPointF rotatedFixPoint;
double angleRad = angle / 180 * M_PI;
rotatedFixPoint.setX( fixPoint.x() * cos( angleRad ) + fixPoint.y() * -sin( angleRad ) );
rotatedFixPoint.setY( fixPoint.x() * sin( angleRad ) + fixPoint.y() * cos( angleRad ) );
rotatedFixPoint.setX( fixPoint.x() * std::cos( angleRad ) + fixPoint.y() * -sin( angleRad ) );
rotatedFixPoint.setY( fixPoint.x() * sin( angleRad ) + fixPoint.y() * std::cos( angleRad ) );
p->translate( canvasPoint.x() - rotatedFixPoint.x(), canvasPoint.y() - rotatedFixPoint.y() );
}
else
@@ -42,10 +42,10 @@ void QgsComposerUtils::drawArrowHead( QPainter *p, const double x, const double
QPointF p2 = QPointF( arrowHeadWidth / 2.0, arrowHeadWidth );

QPointF p1Rotated, p2Rotated;
p1Rotated.setX( p1.x() * cos( angleRad ) + p1.y() * -sin( angleRad ) );
p1Rotated.setY( p1.x() * sin( angleRad ) + p1.y() * cos( angleRad ) );
p2Rotated.setX( p2.x() * cos( angleRad ) + p2.y() * -sin( angleRad ) );
p2Rotated.setY( p2.x() * sin( angleRad ) + p2.y() * cos( angleRad ) );
p1Rotated.setX( p1.x() * std::cos( angleRad ) + p1.y() * -sin( angleRad ) );
p1Rotated.setY( p1.x() * sin( angleRad ) + p1.y() * std::cos( angleRad ) );
p2Rotated.setX( p2.x() * std::cos( angleRad ) + p2.y() * -sin( angleRad ) );
p2Rotated.setY( p2.x() * sin( angleRad ) + p2.y() * std::cos( angleRad ) );

QPolygonF arrowHeadPoly;
arrowHeadPoly << middlePoint;
@@ -88,8 +88,8 @@ void QgsComposerUtils::rotate( const double angle, double &x, double &y )
{
double rotToRad = angle * M_PI / 180.0;
double xRot, yRot;
xRot = x * cos( rotToRad ) - y * sin( rotToRad );
yRot = x * sin( rotToRad ) + y * cos( rotToRad );
xRot = x * std::cos( rotToRad ) - y * sin( rotToRad );
yRot = x * sin( rotToRad ) + y * std::cos( rotToRad );
x = xRot;
y = yRot;
}
@@ -185,7 +185,7 @@ QRectF QgsComposerUtils::largestRotatedRectWithinBounds( const QRectF &originalR

//convert angle to radians and flip
double angleRad = -clippedRotation * M_DEG2RAD;
double cosAngle = cos( angleRad );
double cosAngle = std::cos( angleRad );
double sinAngle = sin( angleRad );

//calculate size of bounds of rotated rectangle
@@ -3012,7 +3012,7 @@ double *QgsComposition::computeGeoTransform( const QgsComposerMap *map, const QR
double mapYCenter = mapExtent.center().y();
double alpha = - map->mapRotation() / 180 * M_PI;
double sinAlpha = sin( alpha );
double cosAlpha = cos( alpha );
double cosAlpha = std::cos( alpha );

// get the extent (in map units) for the exported region
QPointF mapItemPos = map->pos();
@@ -3151,12 +3151,12 @@ void QgsComposition::computeWorldFileParameters( const QRectF &exportRegion, dou

// rotation matrix
double r[6];
r[0] = cos( alpha );
r[0] = std::cos( alpha );
r[1] = -sin( alpha );
r[2] = xCenter * ( 1 - cos( alpha ) ) + yCenter * sin( alpha );
r[2] = xCenter * ( 1 - std::cos( alpha ) ) + yCenter * sin( alpha );
r[3] = sin( alpha );
r[4] = cos( alpha );
r[5] = - xCenter * sin( alpha ) + yCenter * ( 1 - cos( alpha ) );
r[4] = std::cos( alpha );
r[5] = - xCenter * sin( alpha ) + yCenter * ( 1 - std::cos( alpha ) );

// result = rotation x scaling = rotation(scaling(X))
a = r[0] * s[0] + r[1] * s[3];
@@ -56,7 +56,7 @@ void QgsShadowEffect::draw( QgsRenderContext &context )
double offsetDist = context.convertToPainterUnits( mOffsetDist, mOffsetUnit, mOffsetMapUnitScale );

double angleRad = mOffsetAngle * M_PI / 180; // to radians
QPointF transPt( -offsetDist * cos( angleRad + M_PI / 2 ),
QPointF transPt( -offsetDist * std::cos( angleRad + M_PI / 2 ),
-offsetDist * sin( angleRad + M_PI / 2 ) );

//transparency, scale
@@ -262,7 +262,7 @@ static QVariant fcnSin( const QVariantList &values, const QgsExpressionContext *
static QVariant fcnCos( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent )
{
double x = QgsExpressionUtils::getDoubleValue( values.at( 0 ), parent );
return QVariant( cos( x ) );
return QVariant( std::cos( x ) );
}
static QVariant fcnTan( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent )
{
@@ -208,11 +208,11 @@ QgsPointSequence QgsEllipse::points( unsigned int segments ) const
for ( QVector<double>::const_iterator it = t.constBegin(); it != t.constEnd(); ++it )
{
double x = mCenter.x() +
mSemiMajorAxis * cos( *it ) * cos( azimuth ) -
mSemiMajorAxis * std::cos( *it ) * std::cos( azimuth ) -
mSemiMinorAxis * sin( *it ) * sin( azimuth );
double y = mCenter.y() +
mSemiMajorAxis * cos( *it ) * sin( azimuth ) +
mSemiMinorAxis * sin( *it ) * cos( azimuth );
mSemiMajorAxis * std::cos( *it ) * sin( azimuth ) +
mSemiMinorAxis * sin( *it ) * std::cos( azimuth );
pts.push_back( QgsPoint( pType, x, y, z, m ) );
}

@@ -257,10 +257,10 @@ QgsRectangle QgsEllipse::boundingBox() const

double angle = mAzimuth * M_PI / 180.0;

double ux = mSemiMajorAxis * cos( angle );
double ux = mSemiMajorAxis * std::cos( angle );
double uy = mSemiMinorAxis * sin( angle );
double vx = mSemiMajorAxis * sin( angle );
double vy = mSemiMinorAxis * cos( angle );
double vy = mSemiMinorAxis * std::cos( angle );

double halfHeight = sqrt( ux * ux + uy * uy );
double halfWidth = sqrt( vx * vx + vy * vy );
@@ -703,7 +703,7 @@ void QgsGeometryUtils::segmentizeArc( const QgsPoint &p1, const QgsPoint &p2, co
addP2 = false;
}

x = centerX + radius * cos( angle );
x = centerX + radius * std::cos( angle );
y = centerY + radius * sin( angle );

if ( !hasZ && !hasM )
@@ -491,8 +491,8 @@ QgsGeometry QgsInternalGeometryEngine::orthogonalize( double tolerance, int maxI
return QgsGeometry();
}

double lowerThreshold = cos( ( 90 - angleThreshold ) * M_PI / 180.00 );
double upperThreshold = cos( angleThreshold * M_PI / 180.0 );
double lowerThreshold = std::cos( ( 90 - angleThreshold ) * M_PI / 180.00 );
double upperThreshold = std::cos( angleThreshold * M_PI / 180.0 );

if ( const QgsGeometryCollection *gc = qgsgeometry_cast< const QgsGeometryCollection *>( mGeometry ) )
{
@@ -567,14 +567,14 @@ QgsPoint QgsPoint::project( double distance, double azimuth, double inclination
if ( !is3D() && qgsDoubleNear( inclination, 90.0 ) )
{
dx = distance * sin( radsXy );
dy = distance * cos( radsXy );
dy = distance * std::cos( radsXy );
}
else
{
double radsZ = inclination * M_PI / 180.0;
dx = distance * sin( radsZ ) * sin( radsXy );
dy = distance * sin( radsZ ) * cos( radsXy );
dz = distance * cos( radsZ );
dy = distance * sin( radsZ ) * std::cos( radsXy );
dz = distance * std::cos( radsZ );
}

return QgsPoint( mX + dx, mY + dy, mZ + dz, mM, pType );
@@ -113,7 +113,7 @@ QgsRegularPolygon::QgsRegularPolygon( const QgsPoint &pt1, const QgsPoint &pt2,
double length = pt1.distance( pm );

double angle = ( 180 - ( 360 / numSides ) ) / 2.0;
double hypothenuse = length / cos( angle * M_PI / 180 );
double hypothenuse = length / std::cos( angle * M_PI / 180 );
// TODO: inclination

mCenter = pt1.project( hypothenuse, azimuth + angle );
@@ -327,7 +327,7 @@ double QgsRegularPolygon::length() const

double QgsRegularPolygon::apothemToRadius( const double apothem, const unsigned int numSides ) const
{
return apothem / cos( M_PI / numSides );
return apothem / std::cos( M_PI / numSides );
}

double QgsRegularPolygon::interiorAngle( const unsigned int nbSides ) const
@@ -104,7 +104,7 @@ class CORE_EXPORT QgsRegularPolygon
* The apothem is the radius of the inscribed circle.
* \see radius()
*/
double apothem() const { return mRadius * cos( M_PI / mNumberSides ); }
double apothem() const { return mRadius * std::cos( M_PI / mNumberSides ); }

/** Returns the number of sides of the regular polygon.
* \see setNumberSides()

0 comments on commit 2e5d1ab

Please sign in to comment.
You can’t perform that action at this time.