QGIS/python/core/auto_generated/qgsvector.sip.in
Nyall Dawson 6a570f33eb Move QgsVector methods to header to allow better compiler optimisation,
also hold Python GIL when calling them
2020-10-16 12:18:33 +10:00

145 lines
3.8 KiB
Plaintext

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsvector.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsVector
{
%Docstring
A class to represent a vector.
Currently no Z axis / 2.5D support is implemented.
%End
%TypeHeaderCode
#include "qgsvector.h"
%End
public:
QgsVector();
%Docstring
Default constructor for QgsVector. Creates a vector with length of 0.0.
%End
QgsVector( double x, double y );
%Docstring
Constructor for QgsVector taking x and y component values.
:param x: x-component
:param y: y-component
%End
QgsVector operator-() const /HoldGIL/;
QgsVector operator*( double scalar ) const /HoldGIL/;
QgsVector operator/( double scalar ) const /HoldGIL/;
double operator*( QgsVector v ) const /HoldGIL/;
QgsVector operator+( QgsVector other ) const /HoldGIL/;
QgsVector &operator+=( QgsVector other ) /HoldGIL/;
QgsVector operator-( QgsVector other ) const /HoldGIL/;
QgsVector &operator-=( QgsVector other ) /HoldGIL/;
double length() const /HoldGIL/;
%Docstring
Returns the length of the vector.
.. seealso:: :py:func:`lengthSquared`
%End
double lengthSquared() const /HoldGIL/;
%Docstring
Returns the length of the vector.
.. seealso:: :py:func:`length`
.. versionadded:: 3.2
%End
double x() const /HoldGIL/;
%Docstring
Returns the vector's x-component.
.. seealso:: y
%End
double y() const /HoldGIL/;
%Docstring
Returns the vector's y-component.
.. seealso:: x
%End
QgsVector perpVector() const /HoldGIL/;
%Docstring
Returns the perpendicular vector to this vector (rotated 90 degrees counter-clockwise)
%End
double angle() const /HoldGIL/;
%Docstring
Returns the angle of the vector in radians.
%End
double angle( QgsVector v ) const /HoldGIL/;
%Docstring
Returns the angle between this vector and another vector in radians.
%End
double crossProduct( QgsVector v ) const /HoldGIL/;
%Docstring
Returns the 2D cross product of this vector and another vector ``v``. (This is sometimes
referred to as a "perpendicular dot product", and equals x1 * y1 - y1 * x2).
.. versionadded:: 3.2
%End
QgsVector rotateBy( double rot ) const /HoldGIL/;
%Docstring
Rotates the vector by a specified angle.
:param rot: angle in radians
%End
QgsVector normalized() const throw( QgsException );
%Docstring
Returns the vector's normalized (or "unit") vector (ie same angle but length of 1.0).
:raises QgsException: if called on a vector with length of 0.
%End
bool operator==( QgsVector other ) const /HoldGIL/;
bool operator!=( QgsVector other ) const;
QString toString( int precision = 17 ) const /HoldGIL/;
%Docstring
Returns a string representation of the vector.
Members will be truncated to the specified ``precision``.
%End
SIP_PYOBJECT __repr__();
%MethodCode
QString str = QStringLiteral( "<QgsVector: %1>" ).arg( sipCpp->toString() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsvector.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/