Hold GIL for more methods

This commit is contained in:
Nyall Dawson 2023-07-26 11:19:06 +10:00
parent c3159d5a28
commit 519c32a3ff
6 changed files with 116 additions and 116 deletions

View File

@ -229,7 +229,7 @@ It is NOT normalized.
.. versionadded:: 3.34
%End
void normalize();
void normalize() /HoldGIL/;
%Docstring
Normalize the box so it has non-negative width/height/depth.
%End
@ -273,7 +273,7 @@ Returns the center of the box as a vector.
Returns the volume of the box.
%End
QgsBox3D intersect( const QgsBox3D &other ) const;
QgsBox3D intersect( const QgsBox3D &other ) const /HoldGIL/;
%Docstring
Returns the intersection of this box and another 3D box.
%End
@ -293,17 +293,17 @@ If the box is not normalized, this returns ``False``.
.. versionadded:: 3.34
%End
bool intersects( const QgsBox3D &other ) const;
bool intersects( const QgsBox3D &other ) const /HoldGIL/;
%Docstring
Returns ``True`` if box intersects with another box.
%End
bool contains( const QgsBox3D &other ) const;
bool contains( const QgsBox3D &other ) const /HoldGIL/;
%Docstring
Returns ``True`` when box contains other box.
%End
bool contains( const QgsPoint &point ) const;
bool contains( const QgsPoint &point ) const /HoldGIL/;
%Docstring
Returns ``True`` when box contains a ``point``.
@ -311,7 +311,7 @@ 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
bool contains( double x, double y, double z ) const;
bool contains( double x, double y, double z ) const /HoldGIL/;
%Docstring
Returns ``True`` when box contains a point (``x``, ``y``, ``z``).
A point on the border of the box will also return ``True``
@ -322,26 +322,26 @@ will be performed on the x/y extent of the box only.
.. versionadded:: 3.34
%End
void combineWith( const QgsBox3D &box );
void combineWith( const QgsBox3D &box ) /HoldGIL/;
%Docstring
Expands the bbox so that it covers both the original rectangle and the given rectangle.
.. versionadded:: 3.34
%End
void combineWith( double x, double y, double z );
void combineWith( double x, double y, double z ) /HoldGIL/;
%Docstring
Expands the bbox so that it covers both the original rectangle and the given point.
.. versionadded:: 3.34
%End
QgsRectangle toRectangle() const;
QgsRectangle toRectangle() const /HoldGIL/;
%Docstring
Converts the box to a 2D rectangle.
%End
double distanceTo( const QVector3D &point ) const;
double distanceTo( const QVector3D &point ) const /HoldGIL/;
%Docstring
Returns the smallest distance between the box and the point ``point``
(returns 0 if the point is inside the box)
@ -349,9 +349,9 @@ Returns the smallest distance between the box and the point ``point``
.. versionadded:: 3.18
%End
bool operator==( const QgsBox3D &other ) const;
bool operator==( const QgsBox3D &other ) const /HoldGIL/;
void scale( double scaleFactor, const QgsPoint &center = QgsPoint() );
void scale( double scaleFactor, const QgsPoint &center = QgsPoint() ) /HoldGIL/;
%Docstring
Scale the rectangle around a ``center`` :py:class:`QgsPoint`.
@ -360,14 +360,14 @@ If no ``center`` point is specified then the current center of the box will be u
.. versionadded:: 3.26
%End
void scale( double scaleFactor, double centerX, double centerY, double centerZ );
void scale( double scaleFactor, double centerX, double centerY, double centerZ ) /HoldGIL/;
%Docstring
Scale the rectangle around a center coordinates.
.. versionadded:: 3.26
%End
bool isNull() const;
bool isNull() const /HoldGIL/;
%Docstring
Test if the box is null (all coordinates NaN or after call to :py:func:`~QgsBox3D.setMinimal`).
A null box is also an empty box.
@ -375,7 +375,7 @@ A null box is also an empty box.
.. versionadded:: 3.34
%End
bool isEmpty() const;
bool isEmpty() const /HoldGIL/;
%Docstring
Returns ``True`` if the box is empty.
An empty box may still be non-null if it contains valid information (e.g. bounding box of a point).
@ -383,7 +383,7 @@ An empty box may still be non-null if it contains valid information (e.g. boundi
.. versionadded:: 3.34
%End
QString toString( int precision = 16 ) const;
QString toString( int precision = 16 ) const /HoldGIL/;
%Docstring
Returns a string representation of form xmin,ymin,zmin : xmax,ymax,zmax
Coordinates will be truncated to the specified precision.
@ -392,18 +392,18 @@ If the specified precision is less than 0, a suitable minimum precision is used.
.. versionadded:: 3.34
%End
QVector< QgsVector3D > corners() const;
QVector< QgsVector3D > corners() const /HoldGIL/;
%Docstring
Returns an array of all box corners as 3D vectors.
%End
QgsBox3D operator-( const QgsVector3D &v ) const;
QgsBox3D operator-( const QgsVector3D &v ) const /HoldGIL/;
QgsBox3D operator+( const QgsVector3D &v ) const;
QgsBox3D operator+( const QgsVector3D &v ) const /HoldGIL/;
QgsBox3D &operator-=( const QgsVector3D &v );
QgsBox3D &operator-=( const QgsVector3D &v ) /HoldGIL/;
QgsBox3D &operator+=( const QgsVector3D &v );
QgsBox3D &operator+=( const QgsVector3D &v ) /HoldGIL/;
};

View File

@ -48,16 +48,16 @@ Constructor for a oriented box, with a specified center and half axes matrix.
Constructs an oriented box from an axis-aligned bounding box.
%End
bool operator==( const QgsOrientedBox3D &other ) const;
bool operator==( const QgsOrientedBox3D &other ) const /HoldGIL/;
bool operator!=( const QgsOrientedBox3D &other ) const;
bool operator!=( const QgsOrientedBox3D &other ) const /HoldGIL/;
bool isNull() const;
bool isNull() const /HoldGIL/;
%Docstring
Returns ``True`` if the box is a null box.
%End
double centerX() const;
double centerX() const /HoldGIL/;
%Docstring
Returns the center x-coordinate.
@ -66,7 +66,7 @@ Returns the center x-coordinate.
.. seealso:: :py:func:`centerZ`
%End
double centerY() const;
double centerY() const /HoldGIL/;
%Docstring
Returns the center y-coordinate.
@ -75,7 +75,7 @@ Returns the center y-coordinate.
.. seealso:: :py:func:`centerZ`
%End
double centerZ() const;
double centerZ() const /HoldGIL/;
%Docstring
Returns the center z-coordinate.
@ -84,33 +84,33 @@ Returns the center z-coordinate.
.. seealso:: :py:func:`centerY`
%End
QgsVector3D center() const;
QgsVector3D center() const /HoldGIL/;
%Docstring
Returns the vector to the center of the box.
%End
QList< double > halfAxesList() const /PyName=halfAxes/;
QList< double > halfAxesList() const /HoldGIL,PyName=halfAxes/;
%Docstring
Returns the half axes matrix;
%End
QgsBox3D extent() const;
QgsBox3D extent() const /HoldGIL/;
%Docstring
Returns the overall bounding box of the object.
%End
QVector< QgsVector3D > corners() const;
QVector< QgsVector3D > corners() const /HoldGIL/;
%Docstring
Returns an array of all corners as 3D vectors.
%End
QgsVector3D size() const;
QgsVector3D size() const /HoldGIL/;
%Docstring
Returns size of sides of the box.
%End
QgsBox3D reprojectedExtent( const QgsCoordinateTransform &ct ) const throw( QgsCsException );
QgsBox3D reprojectedExtent( const QgsCoordinateTransform &ct ) const throw( QgsCsException ) /HoldGIL/;
%Docstring
Reprojects corners of this box using the given coordinate ``transform``
and returns axis-aligned box containing reprojected corners.
@ -118,7 +118,7 @@ and returns axis-aligned box containing reprojected corners.
:raises QgsCsException:
%End
QgsOrientedBox3D transformed( const QgsMatrix4x4 &transform ) const;
QgsOrientedBox3D transformed( const QgsMatrix4x4 &transform ) const /HoldGIL/;
%Docstring
Returns box transformed by a 4x4 matrix.
%End

View File

@ -35,105 +35,105 @@ Constructs a vector from given coordinates
%Docstring
Constructs a vector from single-precision QVector3D
%End
bool isNull() const;
bool isNull() const /HoldGIL/;
%Docstring
Returns ``True`` if all three coordinates are zero
%End
double x() const;
double x() const /HoldGIL/;
%Docstring
Returns X coordinate
%End
double y() const;
double y() const /HoldGIL/;
%Docstring
Returns Y coordinate
%End
double z() const;
double z() const /HoldGIL/;
%Docstring
Returns Z coordinate
%End
void setX( double x );
void setX( double x ) /HoldGIL/;
%Docstring
Sets X coordinate
.. versionadded:: 3.34
%End
void setY( double y );
void setY( double y ) /HoldGIL/;
%Docstring
Sets Y coordinate
.. versionadded:: 3.34
%End
void setZ( double z );
void setZ( double z ) /HoldGIL/;
%Docstring
Sets Z coordinate
.. versionadded:: 3.34
%End
void set( double x, double y, double z );
void set( double x, double y, double z ) /HoldGIL/;
%Docstring
Sets vector coordinates
%End
bool operator==( const QgsVector3D &other ) const;
bool operator!=( const QgsVector3D &other ) const;
bool operator==( const QgsVector3D &other ) const /HoldGIL/;
bool operator!=( const QgsVector3D &other ) const /HoldGIL/;
QgsVector3D operator+( const QgsVector3D &other ) const;
QgsVector3D operator+( const QgsVector3D &other ) const /HoldGIL/;
QgsVector3D operator-( const QgsVector3D &other ) const;
QgsVector3D operator-( const QgsVector3D &other ) const /HoldGIL/;
QgsVector3D operator *( const double factor ) const;
QgsVector3D operator *( const double factor ) const /HoldGIL/;
QgsVector3D operator /( const double factor ) const;
QgsVector3D operator /( const double factor ) const /HoldGIL/;
static double dotProduct( const QgsVector3D &v1, const QgsVector3D &v2 );
static double dotProduct( const QgsVector3D &v1, const QgsVector3D &v2 ) /HoldGIL/;
%Docstring
Returns the dot product of two vectors
%End
static QgsVector3D crossProduct( const QgsVector3D &v1, const QgsVector3D &v2 );
static QgsVector3D crossProduct( const QgsVector3D &v1, const QgsVector3D &v2 ) /HoldGIL/;
%Docstring
Returns the cross product of two vectors
%End
QgsVector3D projectOnto( const QgsVector3D &other );
QgsVector3D projectOnto( const QgsVector3D &other ) /HoldGIL/;
%Docstring
Projects this vector onto an ``other`` vector.
.. versionadded:: 3.34
%End
double length() const;
double length() const /HoldGIL/;
%Docstring
Returns the length of the vector
%End
void normalize();
void normalize() /HoldGIL/;
%Docstring
Normalizes the current vector in place.
%End
double distance( const QgsVector3D &other ) const;
double distance( const QgsVector3D &other ) const /HoldGIL/;
%Docstring
Returns the distance with the ``other`` :py:class:`QgsVector3`
Returns the distance with the ``other`` QgsVector3D
%End
static QgsVector3D perpendicularPoint( const QgsVector3D &v1, const QgsVector3D &v2, const QgsVector3D &vp );
static QgsVector3D perpendicularPoint( const QgsVector3D &v1, const QgsVector3D &v2, const QgsVector3D &vp ) /HoldGIL/;
%Docstring
Returns the perpendicular point of vector ``vp`` from [``v1`` - ``v2``]
%End
QString toString( int precision = 17 ) const;
QString toString( int precision = 17 ) const /HoldGIL/;
%Docstring
Returns a string representation of the 3D vector.
Members will be truncated to the specified ``precision``.
%End
QVector3D toVector3D() const;
QVector3D toVector3D() const /HoldGIL/;
%Docstring
Converts the current object to QVector3D

View File

@ -237,7 +237,7 @@ class CORE_EXPORT QgsBox3D
/**
* Normalize the box so it has non-negative width/height/depth.
*/
void normalize();
void normalize() SIP_HOLDGIL;
/**
* Returns the width of the box.
@ -275,7 +275,7 @@ class CORE_EXPORT QgsBox3D
/**
* Returns the intersection of this box and another 3D box.
*/
QgsBox3D intersect( const QgsBox3D &other ) const;
QgsBox3D intersect( const QgsBox3D &other ) const SIP_HOLDGIL;
/**
* Returns TRUE if the box can be considered a 2-dimensional box, i.e.
@ -295,12 +295,12 @@ class CORE_EXPORT QgsBox3D
/**
* Returns TRUE if box intersects with another box.
*/
bool intersects( const QgsBox3D &other ) const;
bool intersects( const QgsBox3D &other ) const SIP_HOLDGIL;
/**
* Returns TRUE when box contains other box.
*/
bool contains( const QgsBox3D &other ) const;
bool contains( const QgsBox3D &other ) const SIP_HOLDGIL;
/**
* Returns TRUE when box contains a \a point.
@ -308,7 +308,7 @@ class CORE_EXPORT QgsBox3D
* 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.
*/
bool contains( const QgsPoint &point ) const;
bool contains( const QgsPoint &point ) const SIP_HOLDGIL;
/**
* Returns TRUE when box contains a point (\a x, \a y, \a z).
@ -319,26 +319,26 @@ class CORE_EXPORT QgsBox3D
*
* \since QGIS 3.34
*/
bool contains( double x, double y, double z ) const;
bool contains( double x, double y, double z ) const SIP_HOLDGIL;
/**
* Expands the bbox so that it covers both the original rectangle and the given rectangle.
*
* \since QGIS 3.34
*/
void combineWith( const QgsBox3D &box );
void combineWith( const QgsBox3D &box ) SIP_HOLDGIL;
/**
* Expands the bbox so that it covers both the original rectangle and the given point.
*
* \since QGIS 3.34
*/
void combineWith( double x, double y, double z );
void combineWith( double x, double y, double z ) SIP_HOLDGIL;
/**
* Converts the box to a 2D rectangle.
*/
QgsRectangle toRectangle() const { return mBounds2d; }
QgsRectangle toRectangle() const SIP_HOLDGIL { return mBounds2d; }
/**
* Returns the smallest distance between the box and the point \a point
@ -346,9 +346,9 @@ class CORE_EXPORT QgsBox3D
*
* \since QGIS 3.18
*/
double distanceTo( const QVector3D &point ) const;
double distanceTo( const QVector3D &point ) const SIP_HOLDGIL;
bool operator==( const QgsBox3D &other ) const;
bool operator==( const QgsBox3D &other ) const SIP_HOLDGIL;
/**
* Scale the rectangle around a \a center QgsPoint.
@ -357,14 +357,14 @@ class CORE_EXPORT QgsBox3D
*
* \since QGIS 3.26
*/
void scale( double scaleFactor, const QgsPoint &center = QgsPoint() );
void scale( double scaleFactor, const QgsPoint &center = QgsPoint() ) SIP_HOLDGIL;
/**
* Scale the rectangle around a center coordinates.
*
* \since QGIS 3.26
*/
void scale( double scaleFactor, double centerX, double centerY, double centerZ );
void scale( double scaleFactor, double centerX, double centerY, double centerZ ) SIP_HOLDGIL;
/**
* Test if the box is null (all coordinates NaN or after call to setMinimal()).
@ -372,7 +372,7 @@ class CORE_EXPORT QgsBox3D
*
* \since QGIS 3.34
*/
bool isNull() const;
bool isNull() const SIP_HOLDGIL;
/**
* Returns TRUE if the box is empty.
@ -380,7 +380,7 @@ class CORE_EXPORT QgsBox3D
*
* \since QGIS 3.34
*/
bool isEmpty() const;
bool isEmpty() const SIP_HOLDGIL;
/**
* Returns a string representation of form xmin,ymin,zmin : xmax,ymax,zmax
@ -389,36 +389,36 @@ class CORE_EXPORT QgsBox3D
*
* \since QGIS 3.34
*/
QString toString( int precision = 16 ) const;
QString toString( int precision = 16 ) const SIP_HOLDGIL;
/**
* Returns an array of all box corners as 3D vectors.
*/
QVector< QgsVector3D > corners() const;
QVector< QgsVector3D > corners() const SIP_HOLDGIL;
/**
* Returns a box offset from this one in the direction of the reversed vector.
* \since QGIS 3.34
*/
QgsBox3D operator-( const QgsVector3D &v ) const;
QgsBox3D operator-( const QgsVector3D &v ) const SIP_HOLDGIL;
/**
* Returns a box offset from this one in the direction of the vector.
* \since QGIS 3.34
*/
QgsBox3D operator+( const QgsVector3D &v ) const;
QgsBox3D operator+( const QgsVector3D &v ) const SIP_HOLDGIL;
/**
* Moves this box in the direction of the reversed vector.
* \since QGIS 3.34
*/
QgsBox3D &operator-=( const QgsVector3D &v );
QgsBox3D &operator-=( const QgsVector3D &v ) SIP_HOLDGIL;
/**
* Moves this box in the direction of the vector.
* \since QGIS 3.34
*/
QgsBox3D &operator+=( const QgsVector3D &v );
QgsBox3D &operator+=( const QgsVector3D &v ) SIP_HOLDGIL;
private:

View File

@ -64,7 +64,7 @@ class CORE_EXPORT QgsOrientedBox3D
*/
static QgsOrientedBox3D fromBox3D( const QgsBox3D &box );
bool operator==( const QgsOrientedBox3D &other ) const
bool operator==( const QgsOrientedBox3D &other ) const SIP_HOLDGIL
{
return qgsDoubleNear( mCenter[0], other.mCenter[0] )
&& qgsDoubleNear( mCenter[1], other.mCenter[1] )
@ -80,7 +80,7 @@ class CORE_EXPORT QgsOrientedBox3D
&& qgsDoubleNear( mHalfAxes[8], other.mHalfAxes[8] );
}
bool operator!=( const QgsOrientedBox3D &other ) const
bool operator!=( const QgsOrientedBox3D &other ) const SIP_HOLDGIL
{
return !( *this == other );
}
@ -88,7 +88,7 @@ class CORE_EXPORT QgsOrientedBox3D
/**
* Returns TRUE if the box is a null box.
*/
bool isNull() const;
bool isNull() const SIP_HOLDGIL;
/**
* Returns the center x-coordinate.
@ -96,7 +96,7 @@ class CORE_EXPORT QgsOrientedBox3D
* \see centerY()
* \see centerZ()
*/
double centerX() const { return mCenter[0]; }
double centerX() const SIP_HOLDGIL { return mCenter[0]; }
/**
* Returns the center y-coordinate.
@ -104,7 +104,7 @@ class CORE_EXPORT QgsOrientedBox3D
* \see centerX()
* \see centerZ()
*/
double centerY() const { return mCenter[1]; }
double centerY() const SIP_HOLDGIL { return mCenter[1]; }
/**
* Returns the center z-coordinate.
@ -112,12 +112,12 @@ class CORE_EXPORT QgsOrientedBox3D
* \see centerX()
* \see centerY()
*/
double centerZ() const { return mCenter[2]; }
double centerZ() const SIP_HOLDGIL { return mCenter[2]; }
/**
* Returns the vector to the center of the box.
*/
QgsVector3D center() const { return QgsVector3D( mCenter[0], mCenter[1], mCenter[2] ); }
QgsVector3D center() const SIP_HOLDGIL { return QgsVector3D( mCenter[0], mCenter[1], mCenter[2] ); }
/**
* Returns the half axes matrix;
@ -127,34 +127,34 @@ class CORE_EXPORT QgsOrientedBox3D
/**
* Returns the half axes matrix;
*/
QList< double > halfAxesList() const SIP_PYNAME( halfAxes );
QList< double > halfAxesList() const SIP_HOLDGIL SIP_PYNAME( halfAxes );
/**
* Returns the overall bounding box of the object.
*/
QgsBox3D extent() const;
QgsBox3D extent() const SIP_HOLDGIL;
/**
* Returns an array of all corners as 3D vectors.
*/
QVector< QgsVector3D > corners() const;
QVector< QgsVector3D > corners() const SIP_HOLDGIL;
/**
* Returns size of sides of the box.
*/
QgsVector3D size() const;
QgsVector3D size() const SIP_HOLDGIL;
/**
* Reprojects corners of this box using the given coordinate \a transform
* and returns axis-aligned box containing reprojected corners.
* \throws QgsCsException
*/
QgsBox3D reprojectedExtent( const QgsCoordinateTransform &ct ) const SIP_THROW( QgsCsException );
QgsBox3D reprojectedExtent( const QgsCoordinateTransform &ct ) const SIP_THROW( QgsCsException ) SIP_HOLDGIL;
/**
* Returns box transformed by a 4x4 matrix.
*/
QgsOrientedBox3D transformed( const QgsMatrix4x4 &transform ) const;
QgsOrientedBox3D transformed( const QgsMatrix4x4 &transform ) const SIP_HOLDGIL;
private:

View File

@ -43,35 +43,35 @@ class CORE_EXPORT QgsVector3D
: mX( v.x() ), mY( v.y() ), mZ( v.z() ) {}
//! Returns TRUE if all three coordinates are zero
bool isNull() const { return mX == 0 && mY == 0 && mZ == 0; }
bool isNull() const SIP_HOLDGIL { return mX == 0 && mY == 0 && mZ == 0; }
//! Returns X coordinate
double x() const { return mX; }
double x() const SIP_HOLDGIL { return mX; }
//! Returns Y coordinate
double y() const { return mY; }
double y() const SIP_HOLDGIL { return mY; }
//! Returns Z coordinate
double z() const { return mZ; }
double z() const SIP_HOLDGIL { return mZ; }
/**
* Sets X coordinate
* \since QGIS 3.34
*/
void setX( double x ) { mX = x; }
void setX( double x ) SIP_HOLDGIL { mX = x; }
/**
* Sets Y coordinate
* \since QGIS 3.34
*/
void setY( double y ) { mY = y; }
void setY( double y ) SIP_HOLDGIL { mY = y; }
/**
* Sets Z coordinate
* \since QGIS 3.34
*/
void setZ( double z ) { mZ = z; }
void setZ( double z ) SIP_HOLDGIL { mZ = z; }
//! Sets vector coordinates
void set( double x, double y, double z )
void set( double x, double y, double z ) SIP_HOLDGIL
{
mX = x;
mY = y;
@ -79,48 +79,48 @@ class CORE_EXPORT QgsVector3D
}
// TODO c++20 - replace with = default
bool operator==( const QgsVector3D &other ) const
bool operator==( const QgsVector3D &other ) const SIP_HOLDGIL
{
return mX == other.mX && mY == other.mY && mZ == other.mZ;
}
bool operator!=( const QgsVector3D &other ) const
bool operator!=( const QgsVector3D &other ) const SIP_HOLDGIL
{
return !operator==( other );
}
//! Returns sum of two vectors
QgsVector3D operator+( const QgsVector3D &other ) const
QgsVector3D operator+( const QgsVector3D &other ) const SIP_HOLDGIL
{
return QgsVector3D( mX + other.mX, mY + other.mY, mZ + other.mZ );
}
//! Returns difference of two vectors
QgsVector3D operator-( const QgsVector3D &other ) const
QgsVector3D operator-( const QgsVector3D &other ) const SIP_HOLDGIL
{
return QgsVector3D( mX - other.mX, mY - other.mY, mZ - other.mZ );
}
//! Returns a new vector multiplied by scalar
QgsVector3D operator *( const double factor ) const
QgsVector3D operator *( const double factor ) const SIP_HOLDGIL
{
return QgsVector3D( mX * factor, mY * factor, mZ * factor );
}
//! Returns a new vector divided by scalar
QgsVector3D operator /( const double factor ) const
QgsVector3D operator /( const double factor ) const SIP_HOLDGIL
{
return QgsVector3D( mX / factor, mY / factor, mZ / factor );
}
//! Returns the dot product of two vectors
static double dotProduct( const QgsVector3D &v1, const QgsVector3D &v2 )
static double dotProduct( const QgsVector3D &v1, const QgsVector3D &v2 ) SIP_HOLDGIL
{
return v1.x() * v2.x() + v1.y() * v2.y() + v1.z() * v2.z();
}
//! Returns the cross product of two vectors
static QgsVector3D crossProduct( const QgsVector3D &v1, const QgsVector3D &v2 )
static QgsVector3D crossProduct( const QgsVector3D &v1, const QgsVector3D &v2 ) SIP_HOLDGIL
{
return QgsVector3D( v1.y() * v2.z() - v1.z() * v2.y(),
v1.z() * v2.x() - v1.x() * v2.z(),
@ -132,7 +132,7 @@ class CORE_EXPORT QgsVector3D
*
* \since QGIS 3.34
*/
QgsVector3D projectOnto( const QgsVector3D &other )
QgsVector3D projectOnto( const QgsVector3D &other ) SIP_HOLDGIL
{
const double bbDotProduct = other.mX * other.mX + other.mY * other.mY + other.mZ * other.mZ;
const double abDotProduct = QgsVector3D::dotProduct( *this, other );
@ -140,13 +140,13 @@ class CORE_EXPORT QgsVector3D
}
//! Returns the length of the vector
double length() const
double length() const SIP_HOLDGIL
{
return sqrt( mX * mX + mY * mY + mZ * mZ );
}
//! Normalizes the current vector in place.
void normalize()
void normalize() SIP_HOLDGIL
{
const double len = length();
if ( !qgsDoubleNear( len, 0.0 ) )
@ -157,8 +157,8 @@ class CORE_EXPORT QgsVector3D
}
}
//! Returns the distance with the \a other QgsVector3
double distance( const QgsVector3D &other ) const
//! Returns the distance with the \a other QgsVector3D
double distance( const QgsVector3D &other ) const SIP_HOLDGIL
{
return std::sqrt( ( mX - other.x() ) * ( mX - other.x() ) +
( mY - other.y() ) * ( mY - other.y() ) +
@ -166,7 +166,7 @@ class CORE_EXPORT QgsVector3D
}
//! Returns the perpendicular point of vector \a vp from [\a v1 - \a v2]
static QgsVector3D perpendicularPoint( const QgsVector3D &v1, const QgsVector3D &v2, const QgsVector3D &vp )
static QgsVector3D perpendicularPoint( const QgsVector3D &v1, const QgsVector3D &v2, const QgsVector3D &vp ) SIP_HOLDGIL
{
const QgsVector3D d = ( v2 - v1 ) / v2.distance( v1 );
const QgsVector3D v = vp - v2;
@ -179,7 +179,7 @@ class CORE_EXPORT QgsVector3D
* Returns a string representation of the 3D vector.
* Members will be truncated to the specified \a precision.
*/
QString toString( int precision = 17 ) const
QString toString( int precision = 17 ) const SIP_HOLDGIL
{
QString str = "Vector3D (";
str += qgsDoubleToString( mX, precision );
@ -196,7 +196,7 @@ class CORE_EXPORT QgsVector3D
* \warning the conversion may decrease the accuracy (double to float values conversion)
* \since QGIS 3.24
*/
QVector3D toVector3D() const { return QVector3D( mX, mY, mZ ); }
QVector3D toVector3D() const SIP_HOLDGIL { return QVector3D( mX, mY, mZ ); }
#ifdef SIP_RUN
SIP_PYOBJECT __repr__();