91    static double distToInfiniteLine( 
const QgsPoint &point, 
const QgsPoint &linePoint1, 
const QgsPoint &linePoint2, 
double epsilon = 1e-7 );
 
  104    static bool lineCircleIntersection( 
const QgsPointXY ¢er, 
double radius,
 
  118    static int circleCircleIntersections( 
const QgsPointXY ¢er1, 
double radius1,
 
  130    static bool tangentPointAndCircle( 
const QgsPointXY ¢er, 
double radius,
 
  150    static int circleCircleOuterTangents(
 
  173    static int circleCircleInnerTangents(
 
  187      const double nx = s2.
y() - s1.y();
 
  188      const double ny = -( s2.x() - s1.x() );
 
  189      const double t = ( p.
x() * ny - p.
y() * nx - s1.x() * ny + s1.y() * nx ) / ( ( s2.x() - s1.x() ) * ny - ( s2.y() - s1.y() ) * nx );
 
  190      return t < 0. ? s1 : t > 1. ? s2 : 
QgsPoint( s1.x() + ( s2.x() - s1.x() ) * t, s1.y() + ( s2.y() - s1.y() ) * t );
 
 
  210    static QVector<SelfIntersection> selfIntersections( 
const QgsAbstractGeometry *geom, 
int part, 
int ring, 
double tolerance ) 
SIP_SKIP;
 
  268                               bool hasZ = false, 
bool hasM = false );
 
  340    static QPair<
Qgis::WkbType, QString> wktReadBlock( const QString &wkt ) 
SIP_SKIP;
 
  349    static QStringList wktGetChildBlocks( const QString &wkt, const QString &defaultType = QString() ) 
SIP_SKIP;
 
  387    static 
QgsPointXY interpolatePointOnLine( 
double x1, 
double y1, 
double x2, 
double y2, 
double fraction ) 
SIP_HOLDGIL;
 
  417    static 
QgsPointXY interpolatePointOnLineByValue( 
double x1, 
double y1, 
double v1, 
double x2, 
double y2, 
double v2, 
double value ) 
SIP_HOLDGIL;
 
  464      return transferFirstZValueToPoint( points, point );
 
 
  524      for ( 
auto it = verticesBegin ; it != verticesEnd ; ++it )
 
  526        if ( !mFound && ( *it ).isMeasure() )
 
  529          point.
setM( ( *it ).m() );
 
  532        if ( !zFound && ( *it ).is3D() )
 
  535          point.
setZ( ( *it ).z() );
 
  538        if ( zFound && mFound )
 
  542      return zFound || mFound;
 
 
  598      double minDist = std::numeric_limits<double>::max();
 
  599      double minDistSegmentX = 0.0, minDistSegmentY = 0.0;
 
  601      int minDistLeftOf = 0;
 
  602      double sqrDist = 0.0;
 
  603      int vertexOffset = 0;
 
  607      for ( 
int i = 0; i < container.size(); ++i )
 
  609        sqrDist = container.at( i )->closestSegment( pt, segmentPt, vertexAfter, leftOf, epsilon );
 
  610        if ( sqrDist >= 0 && sqrDist < minDist )
 
  613          minDistSegmentX = segmentPt.x();
 
  614          minDistSegmentY = segmentPt.y();
 
  615          minDistVertexAfter = vertexAfter;
 
  616          minDistVertexAfter.
vertex = vertexAfter.vertex + vertexOffset;
 
  617          minDistVertexAfter.
part = vertexAfter.part + partOffset;
 
  618          minDistVertexAfter.
ring = vertexAfter.ring + ringOffset;
 
  621            minDistLeftOf = *leftOf;
 
  625        if ( ctype == Vertex )
 
  628          vertexOffset += container.at( i )->nCoordinates() - 1;
 
  630        else if ( ctype == Ring )
 
  634        else if ( ctype == Part )
 
  640      if ( minDist == std::numeric_limits<double>::max() )
 
  643      segmentPt.setX( minDistSegmentX );
 
  644      segmentPt.setY( minDistSegmentY );
 
  645      vertexAfter = minDistVertexAfter;
 
  648        *leftOf = minDistLeftOf;
 
 
  741    Q_DECL_DEPRECATED 
static void pointOnLineWithDistance( 
double x1, 
double y1, 
double x2, 
double y2, 
double distance, 
double &x, 
double &y,
 
  742        double *z1 = 
nullptr, 
double *z2 = 
nullptr, 
double *z = 
nullptr,
 
  743        double *m1 = 
nullptr, 
double *m2 = 
nullptr, 
double *m = 
nullptr ) 
SIP_SKIP 
 
  969    Q_DECL_DEPRECATED 
static int closestSideOfRectangle( 
double right, 
double bottom, 
double left, 
double top, 
double x, 
double y )
 
 
  998        double segmentPoint1x, 
double segmentPoint1y,
 
  999        double segmentPoint2x, 
double segmentPoint2y,
 
 1000        double &perpendicularSegmentPoint1x 
SIP_OUT, 
double &perpendicularSegmentPoint1y 
SIP_OUT,
 
 1001        double &perpendicularSegmentPoint2x 
SIP_OUT, 
double &perpendicularSegmentPoint2y 
SIP_OUT,
 
 1004      return QgsGeometryUtilsBase::perpendicularCenterSegment( centerPointX, centerPointY, segmentPoint1x, segmentPoint1y, segmentPoint2x, segmentPoint2y, perpendicularSegmentPoint1x, perpendicularSegmentPoint1y, perpendicularSegmentPoint2x, perpendicularSegmentPoint2y, segmentLength );
 
 
 1145    Q_DECL_DEPRECATED 
static bool pointsAreCollinear( 
double x1, 
double y1, 
double x2, 
double y2, 
double x3, 
double y3, 
double epsilon )
 
 
 1171    Q_DECL_DEPRECATED 
static bool angleBisector( 
double aX, 
double aY, 
double bX, 
double bY, 
double cX, 
double cY, 
double dX, 
double dY,
 
 1174      return QgsGeometryUtilsBase::angleBisector( aX, aY, bX, bY, cX, cY, dX, dY, pointX, pointY, angle );
 
 
 1194    Q_DECL_DEPRECATED 
static bool bisector( 
double aX, 
double aY, 
double bX, 
double bY, 
double cX, 
double cY,
 
 
 1222      double intersectionX = 0.0, intersectionY = 0.0;
 
 1224      intersection = 
QgsPoint( intersectionX, intersectionY );
 
 
 1270      double intersectionPointX = 0.0, intersectionPointY = 0.0;
 
 1271      bool result = 
QgsGeometryUtilsBase::segmentIntersection( p1.
x(), p1.
y(), p2.
x(), p2.
y(), q1.
x(), q1.
y(), q2.
x(), q2.
y(), intersectionPointX, intersectionPointY, isIntersection, tolerance, acceptImproperIntersection );
 
 1272      intersectionPoint.setX( intersectionPointX );
 
 1273      intersectionPoint.setY( intersectionPointY );
 
 
 
The Qgis class provides global constants for use throughout the application.
 
Abstract base class for all geometries.
 
Qgis::WkbType wkbType() const
Returns the WKB type of the geometry.
 
static double circleLength(double x1, double y1, double x2, double y2, double x3, double y3)
Length of a circular string segment defined by pt1, pt2, pt3.
 
static double sqrDistance2D(double x1, double y1, double x2, double y2)
Returns the squared 2D distance between (x1, y1) and (x2, y2).
 
static void pointOnLineWithDistance(double x1, double y1, double x2, double y2, double distance, double &x, double &y, double *z1=nullptr, double *z2=nullptr, double *z=nullptr, double *m1=nullptr, double *m2=nullptr, double *m=nullptr)
Calculates the point a specified distance from (x1, y1) toward a second point (x2,...
 
static double angleBetweenThreePoints(double x1, double y1, double x2, double y2, double x3, double y3)
Calculates the angle between the lines AB and BC, where AB and BC described by points a,...
 
static double ccwAngle(double dy, double dx)
Returns the counter clockwise angle between a line with components dx, dy and the line with dx > 0 an...
 
static bool circleClockwise(double angle1, double angle2, double angle3)
Returns true if the circle defined by three angles is ordered clockwise.
 
static double distance2D(double x1, double y1, double x2, double y2)
Returns the 2D distance between (x1, y1) and (x2, y2).
 
static double sweepAngle(double centerX, double centerY, double x1, double y1, double x2, double y2, double x3, double y3)
Calculates angle of a circular string part defined by pt1, pt2, pt3.
 
static double linePerpendicularAngle(double x1, double y1, double x2, double y2)
Calculates the perpendicular angle to a line joining two points.
 
static bool bisector(double aX, double aY, double bX, double bY, double cX, double cY, double &pointX, double &pointY)
Returns the point (pointX, pointY) forming the bisector from point (aX, aY) to the segment (bX,...
 
static double lineAngle(double x1, double y1, double x2, double y2)
Calculates the direction of line joining two points in radians, clockwise from the north direction.
 
static double averageAngle(double x1, double y1, double x2, double y2, double x3, double y3)
Calculates the average angle (in radians) between the two linear segments from (x1,...
 
static bool skewLinesProjection(const QgsVector3D &P1, const QgsVector3D &P12, const QgsVector3D &P2, const QgsVector3D &P22, QgsVector3D &X1, double epsilon=0.0001)
A method to project one skew line onto another.
 
static int closestSideOfRectangle(double right, double bottom, double left, double top, double x, double y)
Returns a number representing the closest side of a rectangle defined by /a right,...
 
static double interpolateArcValue(double angle, double a1, double a2, double a3, double zm1, double zm2, double zm3)
Interpolate a value at given angle on circular arc given values (zm1, zm2, zm3) at three different an...
 
static void perpendicularOffsetPointAlongSegment(double x1, double y1, double x2, double y2, double proportion, double offset, double *x, double *y)
Calculates a point a certain proportion of the way along the segment from (x1, y1) to (x2,...
 
static double skewLinesDistance(const QgsVector3D &P1, const QgsVector3D &P12, const QgsVector3D &P2, const QgsVector3D &P22)
An algorithm to calculate the shortest distance between two skew lines.
 
static double pointFractionAlongLine(double x1, double y1, double x2, double y2, double px, double py)
Given the line (x1, y1) to (x2, y2) and a point (px, py) returns the fraction of the line length at w...
 
static double normalizedAngle(double angle)
Ensures that an angle is in the range 0 <= angle < 2 pi.
 
static void weightedPointInTriangle(double aX, double aY, double bX, double bY, double cX, double cY, double weightB, double weightC, double &pointX, double &pointY)
Returns a weighted point inside the triangle denoted by the points (aX, aY), (bX, bY) and (cX,...
 
static void perpendicularCenterSegment(double centerPointX, double centerPointY, double segmentPoint1x, double segmentPoint1y, double segmentPoint2x, double segmentPoint2y, double &perpendicularSegmentPoint1x, double &perpendicularSegmentPoint1y, double &perpendicularSegmentPoint2x, double &perpendicularSegmentPoint2y, double segmentLength=0)
Create a perpendicular line segment to a given segment [segmentPoint1,segmentPoint2] with its center ...
 
static double distance3D(double x1, double y1, double z1, double x2, double y2, double z2)
Returns the 3D distance between (x1, y1, z1) and (x2, y2, z2).
 
static bool circleAngleBetween(double angle, double angle1, double angle2, bool clockwise)
Returns true if, in a circle, angle is between angle1 and angle2.
 
static double triangleArea(double aX, double aY, double bX, double bY, double cX, double cY)
Returns the area of the triangle denoted by the points (aX, aY), (bX, bY) and (cX,...
 
static bool angleBisector(double aX, double aY, double bX, double bY, double cX, double cY, double dX, double dY, double &pointX, double &pointY, double &angle)
Returns the point (pointX, pointY) forming the bisector from segment (aX aY) (bX bY) and segment (bX,...
 
static double sqrDistance3D(double x1, double y1, double z1, double x2, double y2, double z2)
Returns the squared 3D distance between (x1, y1, z1) and (x2, y2, z2).
 
static double sqrDistToLine(double ptX, double ptY, double x1, double y1, double x2, double y2, double &minDistX, double &minDistY, double epsilon)
Returns the squared distance between a point and a line.
 
static bool angleOnCircle(double angle, double angle1, double angle2, double angle3)
Returns true if an angle is between angle1 and angle3 on a circle described by angle1,...
 
static bool segmentIntersection(double p1x, double p1y, double p2x, double p2y, double q1x, double q1y, double q2x, double q2y, double &intersectionPointX, double &intersectionPointY, bool &isIntersection, double tolerance=1e-8, bool acceptImproperIntersection=false)
Compute the intersection between two segments.
 
static int leftOfLine(const double x, const double y, const double x1, const double y1, const double x2, const double y2)
Returns a value < 0 if the point (x, y) is left of the line from (x1, y1) -> (x2, y2).
 
static bool linesIntersection3D(const QgsVector3D &La1, const QgsVector3D &La2, const QgsVector3D &Lb1, const QgsVector3D &Lb2, QgsVector3D &intersection)
An algorithm to calculate an (approximate) intersection of two lines in 3D.
 
static bool pointsAreCollinear(double x1, double y1, double x2, double y2, double x3, double y3, double epsilon)
Given the points (x1, y1), (x2, y2) and (x3, y3) returns true if these points can be considered colli...
 
static void circleCenterRadius(double x1, double y1, double x2, double y2, double x3, double y3, double &radius, double ¢erX, double ¢erY)
Returns radius and center of the circle through (x1 y1), (x2 y2), (x3 y3)
 
static bool lineIntersection(double p1x, double p1y, QgsVector v1, double p2x, double p2y, QgsVector v2, double &intersectionX, double &intersectionY)
Computes the intersection between two lines.
 
Contains various geometry utility functions.
 
static Q_DECL_DEPRECATED double linePerpendicularAngle(double x1, double y1, double x2, double y2)
Calculates the perpendicular angle to a line joining two points.
 
static bool lineIntersection(const QgsPoint &p1, QgsVector v1, const QgsPoint &p2, QgsVector v2, QgsPoint &intersection)
Computes the intersection between two lines.
 
static Q_DECL_DEPRECATED double triangleArea(double aX, double aY, double bX, double bY, double cX, double cY)
Returns the area of the triangle denoted by the points (aX, aY), (bX, bY) and (cX,...
 
static Q_DECL_DEPRECATED double lineAngle(double x1, double y1, double x2, double y2)
Calculates the direction of line joining two points in radians, clockwise from the north direction.
 
static Q_DECL_DEPRECATED bool circleClockwise(double angle1, double angle2, double angle3)
Returns true if the circle defined by three angles is ordered clockwise.
 
static Q_DECL_DEPRECATED void pointOnLineWithDistance(double x1, double y1, double x2, double y2, double distance, double &x, double &y, double *z1=nullptr, double *z2=nullptr, double *z=nullptr, double *m1=nullptr, double *m2=nullptr, double *m=nullptr)
Calculates the point a specified distance from (x1, y1) toward a second point (x2,...
 
static bool transferFirstZOrMValueToPoint(const QgsPointSequence &points, QgsPoint &point)
A Z or M dimension is added to point if one of the points in the list points contains Z or M value.
 
static QgsPoint projectPointOnSegment(const QgsPoint &p, const QgsPoint &s1, const QgsPoint &s2)
Project the point on a segment.
 
static Q_DECL_DEPRECATED double sqrDistToLine(double ptX, double ptY, double x1, double y1, double x2, double y2, double &minDistX, double &minDistY, double epsilon)
Returns the squared distance between a point and a line.
 
static bool segmentIntersection(const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &q1, const QgsPoint &q2, QgsPoint &intersectionPoint, bool &isIntersection, double tolerance=1e-8, bool acceptImproperIntersection=false)
Compute the intersection between two segments.
 
static Q_DECL_DEPRECATED void perpendicularOffsetPointAlongSegment(double x1, double y1, double x2, double y2, double proportion, double offset, double *x, double *y)
Calculates a point a certain proportion of the way along the segment from (x1, y1) to (x2,...
 
static Q_DECL_DEPRECATED double interpolateArcValue(double angle, double a1, double a2, double a3, double zm1, double zm2, double zm3)
Interpolate a value at given angle on circular arc given values (zm1, zm2, zm3) at three different an...
 
static Q_DECL_DEPRECATED double averageAngle(double a1, double a2)
Averages two angles, correctly handling negative angles and ensuring the result is between 0 and 2 pi...
 
static void circleCenterRadius(const QgsPoint &pt1, const QgsPoint &pt2, const QgsPoint &pt3, double &radius, double ¢erX, double ¢erY)
Returns radius and center of the circle through pt1, pt2, pt3.
 
static Q_DECL_DEPRECATED double ccwAngle(double dy, double dx)
Returns the counter clockwise angle between a line with components dx, dy and the line with dx > 0 an...
 
static Q_DECL_DEPRECATED double sweepAngle(double centerX, double centerY, double x1, double y1, double x2, double y2, double x3, double y3)
Calculates angle of a circular string part defined by pt1, pt2, pt3.
 
static Q_DECL_DEPRECATED double distance2D(double x1, double y1, double x2, double y2)
Returns the 2D distance between (x1, y1) and (x2, y2).
 
static bool transferFirstZOrMValueToPoint(const QgsGeometry &geom, QgsPoint &point)
A Z or M dimension is added to point if one of the points in the list points contains Z or M value.
 
static Q_DECL_DEPRECATED void perpendicularCenterSegment(double centerPointX, double centerPointY, double segmentPoint1x, double segmentPoint1y, double segmentPoint2x, double segmentPoint2y, double &perpendicularSegmentPoint1x, double &perpendicularSegmentPoint1y, double &perpendicularSegmentPoint2x, double &perpendicularSegmentPoint2y, double segmentLength=0)
Create a perpendicular line segment to a given segment [segmentPoint1,segmentPoint2] with its center ...
 
static Q_DECL_DEPRECATED double circleLength(double x1, double y1, double x2, double y2, double x3, double y3)
Length of a circular string segment defined by pt1, pt2, pt3.
 
static Q_DECL_DEPRECATED bool angleOnCircle(double angle, double angle1, double angle2, double angle3)
Returns true if an angle is between angle1 and angle3 on a circle described by angle1,...
 
static Q_DECL_DEPRECATED bool linesIntersection3D(const QgsVector3D &La1, const QgsVector3D &La2, const QgsVector3D &Lb1, const QgsVector3D &Lb2, QgsVector3D &intersection)
An algorithm to calculate an (approximate) intersection of two lines in 3D.
 
static Q_DECL_DEPRECATED bool pointsAreCollinear(double x1, double y1, double x2, double y2, double x3, double y3, double epsilon)
Given the points (x1, y1), (x2, y2) and (x3, y3) returns true if these points can be considered colli...
 
static double closestSegmentFromComponents(T &container, ComponentType ctype, const QgsPoint &pt, QgsPoint &segmentPt, QgsVertexId &vertexAfter, int *leftOf, double epsilon)
 
static double distance2D(const QgsPoint &pt1, const QgsPoint &pt2)
Returns the 2D distance between two points.
 
static double sqrDistance2D(const QgsPoint &pt1, const QgsPoint &pt2)
Returns the squared 2D distance between two points.
 
static Q_DECL_DEPRECATED bool angleBisector(double aX, double aY, double bX, double bY, double cX, double cY, double dX, double dY, double &pointX, double &pointY, double &angle)
Returns the point (pointX, pointY) forming the bisector from segment (aX aY) (bX bY) and segment (bX,...
 
static Q_DECL_DEPRECATED double normalizedAngle(double angle)
Ensures that an angle is in the range 0 <= angle < 2 pi.
 
static Q_DECL_DEPRECATED bool circleAngleBetween(double angle, double angle1, double angle2, bool clockwise)
Returns true if, in a circle, angle is between angle1 and angle2.
 
static Q_DECL_DEPRECATED double sqrDistance2D(double x1, double y1, double x2, double y2)
Returns the squared 2D distance between (x1, y1) and (x2, y2).
 
static bool transferFirstZOrMValueToPoint(Iterator verticesBegin, Iterator verticesEnd, QgsPoint &point)
A Z or M dimension is added to point if one of the points in the list points contains Z or M value.
 
static Q_DECL_DEPRECATED int leftOfLine(const double x, const double y, const double x1, const double y1, const double x2, const double y2)
Returns a value < 0 if the point (x, y) is left of the line from (x1, y1) -> (x2, y2).
 
static Q_DECL_DEPRECATED double averageAngle(double x1, double y1, double x2, double y2, double x3, double y3)
Calculates the average angle (in radians) between the two linear segments from (x1,...
 
static Q_DECL_DEPRECATED bool skewLinesProjection(const QgsVector3D &P1, const QgsVector3D &P12, const QgsVector3D &P2, const QgsVector3D &P22, QgsVector3D &X1, double epsilon=0.0001)
A method to project one skew line onto another.
 
static double distance3D(const QgsPoint &pt1, const QgsPoint &pt2)
Returns the 3D distance between two points.
 
static Q_DECL_DEPRECATED int closestSideOfRectangle(double right, double bottom, double left, double top, double x, double y)
Returns a number representing the closest side of a rectangle defined by /a right,...
 
static Q_DECL_DEPRECATED double angleBetweenThreePoints(double x1, double y1, double x2, double y2, double x3, double y3)
Calculates the angle between the lines AB and BC, where AB and BC described by points a,...
 
static Q_DECL_DEPRECATED double pointFractionAlongLine(double x1, double y1, double x2, double y2, double px, double py)
Given the line (x1, y1) to (x2, y2) and a point (px, py) returns the fraction of the line length at w...
 
static Q_DECL_DEPRECATED bool bisector(double aX, double aY, double bX, double bY, double cX, double cY, double &pointX, double &pointY)
Returns the point (pointX, pointY) forming the bisector from point (aX, aY) to the segment (bX,...
 
static double sqrDistance3D(const QgsPoint &pt1, const QgsPoint &pt2)
Returns the squared 3D distance between two points.
 
static Q_DECL_DEPRECATED double skewLinesDistance(const QgsVector3D &P1, const QgsVector3D &P12, const QgsVector3D &P2, const QgsVector3D &P22)
An algorithm to calculate the shortest distance between two skew lines.
 
static Q_DECL_DEPRECATED void weightedPointInTriangle(double aX, double aY, double bX, double bY, double cX, double cY, double weightB, double weightC, double &pointX, double &pointY)
Returns a weighted point inside the triangle denoted by the points (aX, aY), (bX, bY) and (cX,...
 
A geometry is the spatial representation of a feature.
 
QgsAbstractGeometry::vertex_iterator vertices_begin() const
Returns STL-style iterator pointing to the first vertex of the geometry.
 
QgsAbstractGeometry::vertex_iterator vertices_end() const
Returns STL-style iterator pointing to the imaginary vertex after the last vertex of the geometry.
 
Line string geometry type, with support for z-dimension and m-values.
 
A class to represent a 2D point.
 
Point geometry type, with support for z-dimension and m-values.
 
void setM(double m)
Sets the point's m-value.
 
bool convertTo(Qgis::WkbType type) override
Converts the geometry to a specified type.
 
void setZ(double z)
Sets the point's z-coordinate.
 
Class for storage of 3D vectors similar to QVector3D, with the difference that it uses double precisi...
 
A class to represent a vector.
 
static Qgis::WkbType addM(Qgis::WkbType type)
Adds the m dimension to a WKB type and returns the new type.
 
static Qgis::WkbType addZ(Qgis::WkbType type)
Adds the z dimension to a WKB type and returns the new type.
 
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
 
#define SIP_PYALTERNATIVETYPE(type)
 
QVector< QgsPoint > QgsPointSequence
 
Utility class for identifying a unique vertex within a geometry.