Skip to content

Commit 96cf4b7

Browse files
committedJun 14, 2017
Projecting a 2D point with inclination assumes 0 for Z
1 parent 41892d3 commit 96cf4b7

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed
 

‎python/core/geometry/qgspoint.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ class QgsPoint: QgsAbstractGeometry
269269
M value is preserved.
270270
\param distance distance to project
271271
\param azimuth angle to project in X Y, clockwise in degrees starting from north
272-
\param inclination angle to project in Z (3D)
272+
\param inclination angle to project in Z (3D). If the point is 2D, the Z value is assumed to be 0.
273273
:return: The point projected. If a 2D point is projected a 3D point will be returned except if
274274
inclination is 90. A 3D point is always returned if a 3D point is projected.
275275
Example:

‎src/core/geometry/qgspoint.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,5 +546,6 @@ QgsPoint QgsPoint::project( double distance, double azimuth, double inclination
546546
pType = QgsWkbTypes::addM( pType );
547547
}
548548

549-
return QgsPoint( mX + dx, mY + dy, mZ + dz, mM, pType );
549+
double z = qIsNaN( mZ ) ? 0 : mZ;
550+
return QgsPoint( mX + dx, mY + dy, z + dz, mM, pType );
550551
}

‎src/core/geometry/qgspoint.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ class CORE_EXPORT QgsPoint: public QgsAbstractGeometry
294294
* M value is preserved.
295295
* \param distance distance to project
296296
* \param azimuth angle to project in X Y, clockwise in degrees starting from north
297-
* \param inclination angle to project in Z (3D)
297+
* \param inclination angle to project in Z (3D). If the point is 2D, the Z value is assumed to be 0.
298298
* \returns The point projected. If a 2D point is projected a 3D point will be returned except if
299299
* inclination is 90. A 3D point is always returned if a 3D point is projected.
300300
* Example:

0 commit comments

Comments
 (0)
Please sign in to comment.