From 0073c35b6562ef480e25b8f98c42bb45df120c92 Mon Sep 17 00:00:00 2001 From: Belgacem Date: Mon, 11 Jan 2021 17:20:35 +0100 Subject: [PATCH] remove distanceFromPoint --- python/core/auto_generated/geometry/qgsbox3d.sip.in | 7 ------- src/core/geometry/qgsbox3d.cpp | 8 -------- src/core/geometry/qgsbox3d.h | 6 ------ src/core/geometry/qgsray3d.cpp | 6 +++--- 4 files changed, 3 insertions(+), 24 deletions(-) diff --git a/python/core/auto_generated/geometry/qgsbox3d.sip.in b/python/core/auto_generated/geometry/qgsbox3d.sip.in index 2e29ada5cc5..e5acb8b9c08 100644 --- a/python/core/auto_generated/geometry/qgsbox3d.sip.in +++ b/python/core/auto_generated/geometry/qgsbox3d.sip.in @@ -217,13 +217,6 @@ Returns ``True`` when box contains a ``point``. If the point is a 2D point (no z-coordinate), then the containment test will be performed on the x/y extent of the box only. -%End - - float distanceFromPoint( double x, double y, double z ) const; -%Docstring -Returns shortest distance from the box to a point (returns 0 if the point is inside the box) - -.. versionadded:: 3.18 %End QgsRectangle toRectangle() const; diff --git a/src/core/geometry/qgsbox3d.cpp b/src/core/geometry/qgsbox3d.cpp index 2b6107d2e9b..3a8a974cd63 100644 --- a/src/core/geometry/qgsbox3d.cpp +++ b/src/core/geometry/qgsbox3d.cpp @@ -124,11 +124,3 @@ bool QgsBox3d::operator==( const QgsBox3d &other ) const qgsDoubleNear( mZmin, other.mZmin ) && qgsDoubleNear( mZmax, other.mZmax ); } - -float QgsBox3d::distanceFromPoint( double x, double y, double z ) const -{ - float dx = std::max( mBounds2d.xMinimum() - x, std::max( 0., x - mBounds2d.xMaximum() ) ); - float dy = std::max( mBounds2d.yMinimum() - y, std::max( 0., y - mBounds2d.yMaximum() ) ); - float dz = std::max( mZmin - z, std::max( 0., z - mZmax ) ); - return sqrt( dx * dx + dy * dy + dz * dz ); -} diff --git a/src/core/geometry/qgsbox3d.h b/src/core/geometry/qgsbox3d.h index b4a85176984..9b4d02ff91f 100644 --- a/src/core/geometry/qgsbox3d.h +++ b/src/core/geometry/qgsbox3d.h @@ -198,12 +198,6 @@ class CORE_EXPORT QgsBox3d */ bool contains( const QgsPoint &point ) const; - /** - * Returns shortest distance from the box to a point (returns 0 if the point is inside the box) - * \since QGIS 3.18 - */ - float distanceFromPoint( double x, double y, double z ) const; - /** * Converts the box to a 2D rectangle. */ diff --git a/src/core/geometry/qgsray3d.cpp b/src/core/geometry/qgsray3d.cpp index e19af981597..b9553fb5936 100644 --- a/src/core/geometry/qgsray3d.cpp +++ b/src/core/geometry/qgsray3d.cpp @@ -81,8 +81,8 @@ double QgsRay3D::angleToPoint( const QVector3D &point ) const double QgsRay3D::distanceTo( const QgsBox3d &box ) const { - float dx = std::max( box.xMinimum() - mOrigin.x(), std::max( 0., mOrigin.x() - box.xMaximum() ) ); - float dy = std::max( box.yMinimum() - mOrigin.y(), std::max( 0., mOrigin.y() - box.yMaximum() ) ); - float dz = std::max( box.zMinimum() - mOrigin.z(), std::max( 0., mOrigin.z() - box.zMaximum() ) ); + double dx = std::max( box.xMinimum() - mOrigin.x(), std::max( 0., mOrigin.x() - box.xMaximum() ) ); + double dy = std::max( box.yMinimum() - mOrigin.y(), std::max( 0., mOrigin.y() - box.yMaximum() ) ); + double dz = std::max( box.zMinimum() - mOrigin.z(), std::max( 0., mOrigin.z() - box.zMaximum() ) ); return sqrt( dx * dx + dy * dy + dz * dz ); }