Skip to content

Commit

Permalink
remove distanceFromPoint
Browse files Browse the repository at this point in the history
  • Loading branch information
NEDJIMAbelgacem authored and wonder-sk committed Jan 13, 2021
1 parent 4e2133f commit 0073c35
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 24 deletions.
7 changes: 0 additions & 7 deletions python/core/auto_generated/geometry/qgsbox3d.sip.in
Expand Up @@ -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;
Expand Down
8 changes: 0 additions & 8 deletions src/core/geometry/qgsbox3d.cpp
Expand Up @@ -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 );
}
6 changes: 0 additions & 6 deletions src/core/geometry/qgsbox3d.h
Expand Up @@ -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.
*/
Expand Down
6 changes: 3 additions & 3 deletions src/core/geometry/qgsray3d.cpp
Expand Up @@ -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 );
}

0 comments on commit 0073c35

Please sign in to comment.