Skip to content

Commit

Permalink
Projecting a 2D point with inclination assumes 0 for Z
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Jun 14, 2017
1 parent 41892d3 commit 96cf4b7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion python/core/geometry/qgspoint.sip
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ class QgsPoint: QgsAbstractGeometry
M value is preserved.
\param distance distance to project
\param azimuth angle to project in X Y, clockwise in degrees starting from north
\param inclination angle to project in Z (3D)
\param inclination angle to project in Z (3D). If the point is 2D, the Z value is assumed to be 0.
:return: The point projected. If a 2D point is projected a 3D point will be returned except if
inclination is 90. A 3D point is always returned if a 3D point is projected.
Example:
Expand Down
3 changes: 2 additions & 1 deletion src/core/geometry/qgspoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -546,5 +546,6 @@ QgsPoint QgsPoint::project( double distance, double azimuth, double inclination
pType = QgsWkbTypes::addM( pType );
}

return QgsPoint( mX + dx, mY + dy, mZ + dz, mM, pType );
double z = qIsNaN( mZ ) ? 0 : mZ;
return QgsPoint( mX + dx, mY + dy, z + dz, mM, pType );
}
2 changes: 1 addition & 1 deletion src/core/geometry/qgspoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ class CORE_EXPORT QgsPoint: public QgsAbstractGeometry
* M value is preserved.
* \param distance distance to project
* \param azimuth angle to project in X Y, clockwise in degrees starting from north
* \param inclination angle to project in Z (3D)
* \param inclination angle to project in Z (3D). If the point is 2D, the Z value is assumed to be 0.
* \returns The point projected. If a 2D point is projected a 3D point will be returned except if
* inclination is 90. A 3D point is always returned if a 3D point is projected.
* Example:
Expand Down

0 comments on commit 96cf4b7

Please sign in to comment.