Class: QgsGeometryUtils¶
Contains various geometry utility functions.
Methods
Applies chamfer to a vertex in a curve geometry. |
|
Creates a complete chamfer geometry connecting two segments. |
|
Creates a complete fillet geometry connecting two segments. |
|
Applies fillet to a vertex in a curve geometry. |
|
Returns a point a specified distance toward a second point. |
Static Methods
Calculates the angle between the lines AB and BC, where AB and BC described by points a, b and b, c. |
|
Returns the point (pointX, pointY) forming the bisector from segment (aX aY) (bX bY) and segment (bX, bY) (dX, dY). |
|
Returns |
|
Calculates the average angle (in radians) between the two linear segments from (x1, y1) to (x2, y2) and (x2, y2) to (x3, y3). |
|
Returns the point (pointX, pointY) forming the bisector from point (aX, aY) to the segment (bX, bY) (cX, cY). |
|
Returns the counter clockwise angle between a line with components dx, dy and the line with dx > 0 and dy = 0 |
|
Returns |
|
Returns radius and center of the circle through pt1, pt2, pt3 |
|
Calculates the inner tangent points for two circles, centered at a center1 and center2 and with radii of radius1 and radius2 respectively. |
|
Calculates the intersections points between the circle with center center1 and radius radius1 and the circle with center center2 and radius radius2. |
|
Calculates the outer tangent points for two circles, centered at center1 and center2 and with radii of radius1 and radius2 respectively. |
|
Returns |
|
Length of a circular string segment defined by pt1, pt2, pt3 |
|
Calculates the direction angle of a circle tangent (clockwise from north in radians) |
|
Returns the nearest point on a segment of a geometry for the specified point. |
|
Returns a number representing the closest side of a rectangle defined by /a right, bottom, left, top to the point at (x, y), where the point may be in the interior of the rectangle or outside it. |
|
Returns the closest vertex to a geometry for a specified point. |
|
Returns the coefficients (a, b, c for equation "ax + by + c = 0") of a line defined by points pt1 and pt2. |
|
Creates a chamfer between two line segments using |
|
Creates a fillet (rounded corner) between two line segments using |
|
Creates a |
|
Returns the distance between a point and an infinite line. |
|
Returns the 2D distance between (x1, y1) and (x2, y2). |
|
Returns the 3D distance between two points. |
|
Returns the distance along a geometry from its first vertex to the specified vertex. |
|
Returns list of linestrings extracted from the passed geometry. |
|
Returns the gradient of a line defined by points pt1 and pt2. |
|
Interpolate a value at given angle on circular arc given values (zm1, zm2, zm3) at three different angles (a1, a2, a3). |
|
Interpolates a point on an arc defined by three points, pt1, pt2 and pt3. |
|
Interpolates the position of a point a fraction of the way along the line from (x1, y1) to (x2, y2). |
|
Interpolates the position of a point along the line from (x1, y1) to (x2, y2). |
|
Interpolates a point on a segment with proper Z and M value interpolation. |
|
Returns a value < 0 if the point point is left of the line from p1 -> p2. |
|
Calculates the direction of line joining two points in radians, clockwise from the north direction. |
|
Compute the intersection of a line and a circle. |
|
Computes the intersection between two lines. |
|
Calculates the perpendicular angle to a line joining two points. |
|
An algorithm to calculate an (approximate) intersection of two lines in 3D. |
|
Returns a middle point between points pt1 and pt2. |
|
Ensures that an angle is in the range 0 <= angle < 2 pi. |
|
Create a perpendicular line segment to a given segment [segmentPoint1,`segmentPoint2`] with its center at centerPoint. |
|
Calculates a point a certain proportion of the way along the segment from (x1, y1) to (x2, y2), offset from the segment by the specified offset amount. |
|
Create a perpendicular line segment from p to segment [s1, s2] |
|
Returns |
|
Given the line (x1, y1) to (x2, y2) and a point (px, py) returns the fraction of the line length at which the point lies. |
|
Given the points (x1, y1), (x2, y2) and (x3, y3) returns |
|
Project the point on a segment |
|
Compute the intersection between two segments |
|
Calculates midpoint on circle passing through p1 and p2, closest to the given coordinate mousePos. |
|
Calculates the midpoint on the circle passing through p1 and p2, with the specified center coordinate. |
|
For line defined by points pt1 and pt3, find out on which side of the line is point pt2. |
|
Convert circular arc defined by p1, p2, p3 (p1/p3 being start resp. |
|
A Z dimension is added to point if one of the point in the list points is in 3D. |
|
An algorithm to calculate the shortest distance between two skew lines. |
|
A method to project one skew line onto another. |
|
Returns the squared distance between a point and a line. |
|
Returns the squared 2D distance between (x1, y1) and (x2, y2). |
|
Returns the squared 3D distance between two points. |
|
Calculates angle of a circular string part defined by pt1, pt2, pt3 |
|
Calculates the tangent points between the circle with the specified center and radius and the point p. |
|
A M dimension is added to point if one of the points in the list points contains an M value. |
|
A Z or M dimension is added to point if one of the points in the list points contains Z or M value. |
|
A Z dimension is added to point if one of the point in the list points is in 3D. |
|
Returns the area of the triangle denoted by the points (aX, aY), (bX, bY) and (cX, cY). |
|
Retrieves the vertices which are before and after the interpolated point at a specified distance along a linestring (or polygon boundary). |
|
Returns a weighted point inside the triangle denoted by the points (aX, aY), (bX, bY) and (cX, cY). |
- class qgis.core.QgsGeometryUtils[source]¶
Bases:
object
- static angleBetweenThreePoints(x1: float, y1: float, x2: float, y2: float, x3: float, y3: float) float [source]¶
Calculates the angle between the lines AB and BC, where AB and BC described by points a, b and b, c.
- Parameters:
x1 (float) – x-coordinate of point a
y1 (float) – y-coordinate of point a
x2 (float) – x-coordinate of point b
y2 (float) – y-coordinate of point b
x3 (float) – x-coordinate of point c
y3 (float) – y-coordinate of point c
- Return type:
float
- Returns:
angle between lines in radians. Returned value is undefined if two or more points are equal.
Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.
- static angleBisector(aX: float, aY: float, bX: float, bY: float, cX: float, cY: float, dX: float, dY: float)[source]¶
Returns the point (
pointX
,pointY
) forming the bisector from segment (aX
aY
) (bX
bY
) and segment (bX
,bY
) (dX
,dY
). The bisector segment of AB-CD is (point, projection of point byangle
)- Parameters:
aX (float) – x-coordinate of first vertex of the segment ab
aY (float) – y-coordinate of first vertex of the segment ab
bX (float) – x-coordinate of second vertex of the segment ab
bY (float) – y-coordinate of second vertex of the segment ab
cX (float) – x-coordinate of first vertex of the segment cd
cY (float) – y-coordinate of first vertex of the segment cd
dX (float) – x-coordinate of second vertex of the segment cd
dY (float) -> (bool) – y-coordinate of second vertex of the segment cd
- Returns:
True
if the bisector exists (A B and C D are not collinear)pointX: x-coordinate of generated point
pointY: y-coordinate of generated point
angle: angle of the bisector from pointX, pointY origin on [ab-cd]
Added in version 3.18.
Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.
- static angleOnCircle(angle: float, angle1: float, angle2: float, angle3: float) bool [source]¶
Returns
True
if an angle is between angle1 and angle3 on a circle described by angle1, angle2 and angle3.Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.- Parameters:
angle (float)
angle1 (float)
angle2 (float)
angle3 (float)
- Return type:
bool
- static averageAngle(x1: float, y1: float, x2: float, y2: float, x3: float, y3: float) float [source]¶
Calculates the average angle (in radians) between the two linear segments from (
x1
,y1
) to (x2
,y2
) and (x2
,y2
) to (x3
,y3
).Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.- Parameters:
x1 (float)
y1 (float)
x2 (float)
y2 (float)
x3 (float)
y3 (float)
- Return type:
float
- static averageAngle(a1: float, a2: float) float [source]
Averages two angles, correctly handling negative angles and ensuring the result is between 0 and 2 pi.
- Parameters:
a1 (float) – first angle (in radians)
a2 (float) – second angle (in radians)
- Return type:
float
- Returns:
average angle (in radians)
Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.
- static bisector(aX: float, aY: float, bX: float, bY: float, cX: float, cY: float)[source]¶
Returns the point (
pointX
,pointY
) forming the bisector from point (aX
,aY
) to the segment (bX
,bY
) (cX
,cY
). The bisector segment of ABC is (A-point)- Parameters:
aX (float) – x-coordinate of first vertex in triangle
aY (float) – y-coordinate of first vertex in triangle
bX (float) – x-coordinate of second vertex in triangle
bY (float) – y-coordinate of second vertex in triangle
cX (float) – x-coordinate of third vertex in triangle
cY (float) -> (bool) – y-coordinate of third vertex in triangle
- Returns:
True
if the bisector exists (A B and C are not collinear)pointX: x-coordinate of generated point
pointY: y-coordinate of generated point
Added in version 3.18.
Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.
- static ccwAngle(dy: float, dx: float) float [source]¶
Returns the counter clockwise angle between a line with components dx, dy and the line with dx > 0 and dy = 0
Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.- Parameters:
dy (float)
dx (float)
- Return type:
float
- chamferVertex(curve: QgsCurve | None, vertexIndex: int, distance1: float, distance2: float) QgsAbstractGeometry | None ¶
Applies chamfer to a vertex in a curve geometry.
- Parameters:
curve (Optional[QgsCurve]) – input curve geometry
vertexIndex (int) – index of vertex to chamfer
distance1 (float) – chamfer distance along first segment
distance2 (float) – chamfer distance along second segment
- Return type:
Optional[QgsAbstractGeometry]
- Returns:
new geometry with chamfer applied, or None on failure
Added in version 4.0.
- static circleAngleBetween(angle: float, angle1: float, angle2: float, clockwise: bool) bool [source]¶
Returns
True
if, in a circle, angle is between angle1 and angle2Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.- Parameters:
angle (float)
angle1 (float)
angle2 (float)
clockwise (bool)
- Return type:
bool
- static circleCenterRadius(pt1: QgsPoint, pt2: QgsPoint, pt3: QgsPoint)[source]¶
Returns radius and center of the circle through pt1, pt2, pt3
- static circleCircleInnerTangents(center1: QgsPointXY, radius1: float, center2: QgsPointXY, radius2: float)[source]¶
Calculates the inner tangent points for two circles, centered at a center1 and
center2
and with radii ofradius1
andradius2
respectively.The inner tangent points correspond to the points at which the two lines which are drawn so that they are tangential to both circles and are crossing each other.
The first tangent line is described by the points stored in
line1P1
andline1P2
, and the second line is described by the points stored inline2P1
andline2P2
.Returns the number of tangents (either 0 or 2).
Added in version 3.6.
- Parameters:
center1 (QgsPointXY)
radius1 (float)
center2 (QgsPointXY)
radius2 (float) -> (int)
- static circleCircleIntersections(center1: QgsPointXY, radius1: float, center2: QgsPointXY, radius2: float)[source]¶
Calculates the intersections points between the circle with center
center1
and radiusradius1
and the circle with centercenter2
and radiusradius2
.If found, the intersection points will be stored in
intersection1
andintersection2
.- Returns:
number of intersection points found.
Added in version 3.2.
- Parameters:
center1 (QgsPointXY)
radius1 (float)
center2 (QgsPointXY)
radius2 (float) -> (int)
- static circleCircleOuterTangents(center1: QgsPointXY, radius1: float, center2: QgsPointXY, radius2: float)[source]¶
Calculates the outer tangent points for two circles, centered at
center1
andcenter2
and with radii ofradius1
andradius2
respectively.The outer tangent points correspond to the points at which the two lines which are drawn so that they are tangential to both circles touch the circles.
The first tangent line is described by the points stored in
line1P1
andline1P2
, and the second line is described by the points stored inline2P1
andline2P2
.Returns the number of tangents (either 0 or 2).
Added in version 3.2.
- Parameters:
center1 (QgsPointXY)
radius1 (float)
center2 (QgsPointXY)
radius2 (float) -> (int)
- static circleClockwise(angle1: float, angle2: float, angle3: float) bool [source]¶
Returns
True
if the circle defined by three angles is ordered clockwise.The angles are defined counter-clockwise from the origin, i.e. using Euclidean angles as opposed to geographic “North up” angles.
Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.- Parameters:
angle1 (float)
angle2 (float)
angle3 (float)
- Return type:
bool
- static circleLength(x1: float, y1: float, x2: float, y2: float, x3: float, y3: float) float [source]¶
Length of a circular string segment defined by pt1, pt2, pt3
Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.- Parameters:
x1 (float)
y1 (float)
x2 (float)
y2 (float)
x3 (float)
y3 (float)
- Return type:
float
- static circleTangentDirection(tangentPoint: QgsPoint, cp1: QgsPoint, cp2: QgsPoint, cp3: QgsPoint) float [source]¶
Calculates the direction angle of a circle tangent (clockwise from north in radians)
- static closestPoint(geometry: QgsAbstractGeometry, point: QgsPoint) QgsPoint [source]¶
Returns the nearest point on a segment of a
geometry
for the specifiedpoint
. The z and m values will be linearly interpolated between the two neighbouring vertices.- Parameters:
geometry (QgsAbstractGeometry)
point (QgsPoint)
- Return type:
- static closestSideOfRectangle(right: float, bottom: float, left: float, top: float, x: float, y: float) int [source]¶
Returns a number representing the closest side of a rectangle defined by /a right,
bottom
,left
,top
to the point at (x
,y
), where the point may be in the interior of the rectangle or outside it.The returned value may be:
Point is closest to top side of rectangle
Point is located on the top-right diagonal of rectangle, equally close to the top and right sides
Point is closest to right side of rectangle
Point is located on the bottom-right diagonal of rectangle, equally close to the bottom and right sides
Point is closest to bottom side of rectangle
Point is located on the bottom-left diagonal of rectangle, equally close to the bottom and left sides
Point is closest to left side of rectangle
Point is located on the top-left diagonal of rectangle, equally close to the top and left sides
Note
This method effectively partitions the space outside of the rectangle into Voronoi cells, so a point to the top left of the rectangle may be assigned to the left or top sides based on its position relative to the diagonal line extended from the rectangle’s top-left corner.
Added in version 3.20.
Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.- Parameters:
right (float)
bottom (float)
left (float)
top (float)
x (float)
y (float)
- Return type:
int
- static closestVertex(geom: QgsAbstractGeometry, pt: QgsPoint)[source]¶
Returns the closest vertex to a geometry for a specified point. On error null point will be returned and “id” argument will be invalid.
- Parameters:
geom (QgsAbstractGeometry)
pt (
QgsPoint
) -> (QgsPoint)
- static coefficients(pt1: QgsPoint, pt2: QgsPoint)[source]¶
Returns the coefficients (a, b, c for equation “ax + by + c = 0”) of a line defined by points
pt1
andpt2
.
- static createChamfer(segment1Start: QgsPoint, segment1End: QgsPoint, segment2Start: QgsPoint, segment2End: QgsPoint, distance1: float, distance2: float, epsilon: float = 1e-08)[source]¶
Creates a chamfer between two line segments using
QgsPoint
.- Parameters:
segment1Start (QgsPoint) – start point of first segment
segment1End (QgsPoint) – end point of first segment
segment2Start (QgsPoint) – start point of second segment
segment2End (QgsPoint) – end point of second segment
distance1 (float) – chamfer distance along first segment
distance2 (float) – chamfer distance along second segment (if negative, uses distance1)
epsilon (float = 1e-08) -> (bool) – tolerance for geometric calculations
- Returns:
true if chamfer was successfully created
chamferStart: calculated start point of the chamfer
chamferEnd: calculated end point of the chamfer
Added in version 4.0.
- createChamferGeometry(segment1Start: QgsPoint, segment1End: QgsPoint, segment2Start: QgsPoint, segment2End: QgsPoint, distance1: float, distance2: float) QgsLineString | None ¶
Creates a complete chamfer geometry connecting two segments.
- Parameters:
segment1Start (QgsPoint) – start point of first segment
segment1End (QgsPoint) – end point of first segment
segment2Start (QgsPoint) – start point of second segment
segment2End (QgsPoint) – end point of second segment
distance1 (float) – chamfer distance along first segment
distance2 (float) – chamfer distance along second segment (if negative, uses distance1)
- Return type:
Optional[QgsLineString]
- Returns:
QgsLineString
geometry connecting the segments through the chamfer
Added in version 4.0.
- static createFillet(segment1Start: QgsPoint, segment1End: QgsPoint, segment2Start: QgsPoint, segment2End: QgsPoint, radius: float, epsilon: float = 1e-08)[source]¶
Creates a fillet (rounded corner) between two line segments using
QgsPoint
. Returns the three fillet arc points (filletPoint1
,filletMidPoint
,filletPoint2
) via output parameters to define a CircularString.- Parameters:
segment1Start (QgsPoint) – start point of first segment
segment1End (QgsPoint) – end point of first segment
segment2Start (QgsPoint) – start point of second segment
segment2End (QgsPoint) – end point of second segment
radius (float) – fillet radius
epsilon (float = 1e-08) -> (bool) – tolerance for geometric calculations
- Returns:
true if fillet was successfully created
filletPoint1: first tangent point of the fillet arc
filletMidPoint: midpoint of the fillet arc
filletPoint2: second tangent point of the fillet arc
Added in version 4.0.
- createFilletGeometry(segment1Start: QgsPoint, segment1End: QgsPoint, segment2Start: QgsPoint, segment2End: QgsPoint, radius: float, segments: int) QgsAbstractGeometry | None ¶
Creates a complete fillet geometry connecting two segments.
- Parameters:
segment1Start (QgsPoint) – start point of first segment
segment1End (QgsPoint) – end point of first segment
segment2Start (QgsPoint) – start point of second segment
segment2End (QgsPoint) – end point of second segment
radius (float) – fillet radius
segments (int) – number of segments for arc discretization (≤0 for circular arc)
- Return type:
Optional[QgsAbstractGeometry]
- Returns:
geometry connecting the segments through the fillet
Added in version 4.0.
- static createPointWithMatchingDimensions(x: float, y: float, reference: QgsPoint) QgsPoint [source]¶
Creates a
QgsPoint
with dimensions matching a reference point.- Parameters:
x (float) – x-coordinate for the new point
y (float) – y-coordinate for the new point
reference (QgsPoint) – reference point providing dimension information (Z, M)
- Return type:
- Returns:
QgsPoint
with matching dimensions, Z and M values set to 0.0
Added in version 4.0.
- static distToInfiniteLine(point: QgsPoint, linePoint1: QgsPoint, linePoint2: QgsPoint, epsilon: float = 1e-07) float [source]¶
Returns the distance between a point and an infinite line.
- Parameters:
Added in version 3.26.
- Return type:
float
- static distance2D(x1: float, y1: float, x2: float, y2: float) float [source]¶
Returns the 2D distance between (
x1
,y1
) and (x2
,y2
).Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.- Parameters:
x1 (float)
y1 (float)
x2 (float)
y2 (float)
- Return type:
float
- static distance2D(pt1: QgsPoint, pt2: QgsPoint) float [source]
Returns the 2D distance between two points.
- static distance3D(pt1: QgsPoint, pt2: QgsPoint) float [source]¶
Returns the 3D distance between two points.
Warning
No check is done if z contains NaN value. This is the caller’s responsibility.
Added in version 3.36.
- static distanceToVertex(geom: QgsAbstractGeometry, id: QgsVertexId) float [source]¶
Returns the distance along a geometry from its first vertex to the specified vertex.
- Parameters:
geom (QgsAbstractGeometry) – geometry
id (QgsVertexId) – vertex id to find distance to
- Return type:
float
- Returns:
distance to vertex (following geometry)
- static extractLineStrings(geom: QgsAbstractGeometry | None) List[QgsLineString] ¶
Returns list of linestrings extracted from the passed geometry. The returned objects have to be deleted by the caller.
- Parameters:
geom (Optional[QgsAbstractGeometry])
- Return type:
List[QgsLineString]
- filletVertex(curve: QgsCurve | None, vertexIndex: int, radius: float, segments: int) QgsAbstractGeometry | None ¶
Applies fillet to a vertex in a curve geometry.
- Parameters:
curve (Optional[QgsCurve]) – input curve geometry
vertexIndex (int) – index of vertex to fillet
radius (float) – fillet radius
segments (int) – number of segments for arc discretization (≤0 for circular arc)
- Return type:
Optional[QgsAbstractGeometry]
- Returns:
new geometry with fillet applied, or None on failure
Added in version 4.0.
- static gradient(pt1: QgsPoint, pt2: QgsPoint) float [source]¶
Returns the gradient of a line defined by points
pt1
andpt2
.
- static interpolateArcValue(angle: float, a1: float, a2: float, a3: float, zm1: float, zm2: float, zm3: float) float [source]¶
Interpolate a value at given angle on circular arc given values (zm1, zm2, zm3) at three different angles (a1, a2, a3).
Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.- Parameters:
angle (float)
a1 (float)
a2 (float)
a3 (float)
zm1 (float)
zm2 (float)
zm3 (float)
- Return type:
float
- static interpolatePointOnArc(pt1: QgsPoint, pt2: QgsPoint, pt3: QgsPoint, distance: float) QgsPoint [source]¶
Interpolates a point on an arc defined by three points,
pt1
,pt2
andpt3
. The arc will be interpolated by the specifieddistance
frompt1
.Any z or m values present in the points will also be linearly interpolated in the output.
Added in version 3.4.
- static interpolatePointOnLine(x1: float, y1: float, x2: float, y2: float, fraction: float) QgsPointXY [source]¶
Interpolates the position of a point a
fraction
of the way along the line from (x1
,y1
) to (x2
,y2
).Usually the
fraction
should be between 0 and 1, where 0 represents the point at the start of the line (x1
,y1
) and 1 represents the end of the line (x2
,y2
). However, it is possible to use afraction
< 0 or > 1, in which case the returned point is extrapolated from the supplied line.See also
- Parameters:
x1 (float)
y1 (float)
x2 (float)
y2 (float)
fraction (float)
- Return type:
- static interpolatePointOnLine(p1: QgsPoint, p2: QgsPoint, fraction: float) QgsPoint [source]
Interpolates the position of a point a
fraction
of the way along the line fromp1
top2
.Usually the
fraction
should be between 0 and 1, where 0 represents the point at the start of the line (p1
) and 1 represents the end of the line (p2
). However, it is possible to use afraction
< 0 or > 1, in which case the returned point is extrapolated from the supplied line.Any Z or M values present in the input points will also be interpolated and present in the returned point.
See also
- static interpolatePointOnLineByValue(x1: float, y1: float, v1: float, x2: float, y2: float, v2: float, value: float) QgsPointXY [source]¶
Interpolates the position of a point along the line from (
x1
,y1
) to (x2
,y2
).The position is interpolated using a supplied target
value
and the value at the start of the line (v1
) and end of the line (v2
). The returned point will be linearly interpolated to match position corresponding to the targetvalue
.See also
- Parameters:
x1 (float)
y1 (float)
v1 (float)
x2 (float)
y2 (float)
v2 (float)
value (float)
- Return type:
- static interpolatePointOnSegment(x: float, y: float, segmentStart: QgsPoint, segmentEnd: QgsPoint) QgsPoint [source]¶
Interpolates a point on a segment with proper Z and M value interpolation.
- Parameters:
- Return type:
- Returns:
QgsPoint
with proper Z and M interpolation
Added in version 4.0.
- static leftOfLine(point: QgsPoint, p1: QgsPoint, p2: QgsPoint) int [source]¶
Returns a value < 0 if the point
point
is left of the line fromp1
->p2
. A positive return value indicates the point is to the right of the line.If the return value is 0, then the test was unsuccessful (e.g. due to testing a point exactly on the line, or exactly in line with the segment) and the result is undefined.
Added in version 3.6.
- static leftOfLine(x: float, y: float, x1: float, y1: float, x2: float, y2: float) int [source]
Returns a value < 0 if the point (
x
,y
) is left of the line from (x1
,y1
) -> (x2
,y2
). A positive return value indicates the point is to the right of the line.If the return value is 0, then the test was unsuccessful (e.g. due to testing a point exactly on the line, or exactly in line with the segment) and the result is undefined.
Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.- Parameters:
x (float)
y (float)
x1 (float)
y1 (float)
x2 (float)
y2 (float)
- Return type:
int
- static lineAngle(x1: float, y1: float, x2: float, y2: float) float [source]¶
Calculates the direction of line joining two points in radians, clockwise from the north direction.
- Parameters:
x1 (float) – x-coordinate of line start
y1 (float) – y-coordinate of line start
x2 (float) – x-coordinate of line end
y2 (float) – y-coordinate of line end
- Return type:
float
- Returns:
angle in radians. Returned value is undefined if start and end point are the same.
Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.
- static lineCircleIntersection(center: QgsPointXY, radius: float, linePoint1: QgsPointXY, linePoint2: QgsPointXY, intersection: QgsPointXY)[source]¶
Compute the intersection of a line and a circle. If the intersection has two solutions (points), the closest point to the initial
intersection
point is returned.- Parameters:
center (QgsPointXY) – the center of the circle
radius (float) – the radius of the circle
linePoint1 (QgsPointXY) – a first point on the line
linePoint2 (QgsPointXY) – a second point on the line
intersection (
QgsPointXY
) -> (bool) – the initial point and the returned intersection point
- Returns:
True
if an intersection has been found
- static lineIntersection(p1: QgsPoint, v1: QgsVector, p2: QgsPoint, v2: QgsVector)[source]¶
Computes the intersection between two lines. Z dimension is supported and is retrieved from the first 3D point amongst
p1
andp2
.
- static linePerpendicularAngle(x1: float, y1: float, x2: float, y2: float) float [source]¶
Calculates the perpendicular angle to a line joining two points. Returned angle is in radians, clockwise from the north direction.
- Parameters:
x1 (float) – x-coordinate of line start
y1 (float) – y-coordinate of line start
x2 (float) – x-coordinate of line end
y2 (float) – y-coordinate of line end
- Return type:
float
- Returns:
angle in radians. Returned value is undefined if start and end point are the same.
Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.
- static linesIntersection3D(La1: QgsVector3D, La2: QgsVector3D, Lb1: QgsVector3D, Lb2: QgsVector3D)[source]¶
An algorithm to calculate an (approximate) intersection of two lines in 3D.
- Parameters:
La1 (QgsVector3D) – is the first point on the first line,
La2 (QgsVector3D) – is the second point on the first line,
Lb1 (QgsVector3D) – is the first point on the second line,
Lb2 (
QgsVector3D
) -> (bool) – is the second point on the second line,
- Returns:
True
if the intersection can be found,False
- otherwise.intersection: is the result intersection, of it can be found.
Example¶
QgsGeometryUtils.linesIntersection3D(QgsVector3D(0,0,0), QgsVector3D(5,0,0), QgsVector3D(2,1,0), QgsVector3D(2,3,0)) # (True, PyQt5.QtGui.QgsVector3D(2.0, 0.0, 0.0)) QgsGeometryUtils.linesIntersection3D(QgsVector3D(0,0,0), QgsVector3D(5,0,0), QgsVector3D(2,1,0), QgsVector3D(2,0,0)) # (True, PyQt5.QtGui.QgsVector3D(2.0, 0.0, 0.0)) QgsGeometryUtils.linesIntersection3D(QgsVector3D(0,0,0), QgsVector3D(5,0,0), QgsVector3D(0,1,0), QgsVector3D(0,3,0)) # (True, PyQt5.QtGui.QgsVector3D(0.0, 0.0, 0.0)) QgsGeometryUtils.linesIntersection3D(QgsVector3D(0,0,0), QgsVector3D(5,0,0), QgsVector3D(0,1,0), QgsVector3D(0,0,0)) # (True, PyQt5.QtGui.QgsVector3D(0.0, 0.0, 0.0)) QgsGeometryUtils.linesIntersection3D(QgsVector3D(0,0,0), QgsVector3D(5,0,0), QgsVector3D(5,1,0), QgsVector3D(5,3,0)) # (False, PyQt5.QtGui.QgsVector3D(0.0, 0.0, 0.0)) QgsGeometryUtils.linesIntersection3D(QgsVector3D(0,0,0), QgsVector3D(5,0,0), QgsVector3D(5,1,0), QgsVector3D(5,0,0)) # (False, PyQt5.QtGui.QgsVector3D(0.0, 0.0, 0.0)) QgsGeometryUtils.linesIntersection3D(QgsVector3D(1,1,0), QgsVector3D(2,2,0), QgsVector3D(3,1,0), QgsVector3D(3,2,0)) # (True, PyQt5.QtGui.QgsVector3D(3.0, 3.0, 0.0)) QgsGeometryUtils.linesIntersection3D(QgsVector3D(1,1,0), QgsVector3D(2,2,0), QgsVector3D(3,2,0), QgsVector3D(3,1,0)) # (True, PyQt5.QtGui.QgsVector3D(3.0, 3.0, 0.0)) QgsGeometryUtils.linesIntersection3D(QgsVector3D(5,5,5), QgsVector3D(0,0,0), QgsVector3D(0,5,5), QgsVector3D(5,0,0)) # (True, PyQt5.QtGui.QgsVector3D(2.5, 2.5, 2.5)) QgsGeometryUtils.linesIntersection3D(QgsVector3D(2.5,2.5,2.5), QgsVector3D(0,5,0), QgsVector3D(2.5,2.5,2.5), QgsVector3D(5,0,0)) # (True, PyQt5.QtGui.QgsVector3D(2.5, 2.5, 2.5)) QgsGeometryUtils.linesIntersection3D(QgsVector3D(2.5,2.5,2.5), QgsVector3D(5,0,0), QgsVector3D(0,5,5), QgsVector3D(5,5,5)) # (True, PyQt5.QtGui.QgsVector3D(0.0, 5.0, 5.0))
Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.
- static midpoint(pt1: QgsPoint, pt2: QgsPoint) QgsPoint [source]¶
Returns a middle point between points pt1 and pt2. Z value is computed if one of this point have Z. M value is computed if one of this point have M.
- Parameters:
- Return type:
- Returns:
New point at middle between points pt1 and pt2.
Example¶
p = QgsPoint( 4, 6 ) # 2D point pr = midpoint ( p, QgsPoint( 2, 2 ) ) # pr is a 2D point: 'Point (3 4)' pr = midpoint ( p, QgsPoint( QgsWkbTypes.PointZ, 2, 2, 2 ) ) # pr is a 3D point: 'PointZ (3 4 1)' pr = midpoint ( p, QgsPoint( QgsWkbTypes.PointM, 2, 2, 0, 2 ) ) # pr is a 3D point: 'PointM (3 4 1)' pr = midpoint ( p, QgsPoint( QgsWkbTypes.PointZM, 2, 2, 2, 2 ) ) # pr is a 3D point: 'PointZM (3 4 1 1)'
- static normalizedAngle(angle: float) float [source]¶
Ensures that an angle is in the range 0 <= angle < 2 pi.
- Parameters:
angle (float) – angle in radians
- Return type:
float
- Returns:
equivalent angle within the range [0, 2 pi)
Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.
- static perpendicularCenterSegment(centerPointX: float, centerPointY: float, segmentPoint1x: float, segmentPoint1y: float, segmentPoint2x: float, segmentPoint2y: float, segmentLength: float = 0)[source]¶
Create a perpendicular line segment to a given segment [
segmentPoint1
,``segmentPoint2``] with its center atcenterPoint
.May be used to split geometries. Unless
segmentLength
is specified the new centered perpendicular line segment will have double the length of the input segment.The result is a line (segment) centered in point p and perpendicular to segment [segmentPoint1, segmentPoint2].
- Parameters:
centerPointX (float) – x-coordinate of the point where the center of the perpendicular should be located
centerPointY (float) – y-coordinate of the point where the center of the perpendicular should be located
segmentPoint1x (float) – : x-coordinate of segmentPoint1, the segment’s start point
segmentPoint1y (float) – : y-coordinate of segmentPoint1, the segment’s start point
segmentPoint2x (float) – : x-coordinate of segmentPoint2, the segment’s end point
segmentPoint2y (float) – : y-coordinate of segmentPoint2, the segment’s end point
segmentLength (float = 0) -> (float) – (optional) Trims to given length. A segmentLength value of 0 refers to the default length which is double the length of the input segment. Set to 1 for a normalized length.
- Returns:
perpendicularSegmentPoint1x: : x-coordinate of the perpendicularCenterSegment’s start point
perpendicularSegmentPoint1y: : y-coordinate of the perpendicularCenterSegment’s start point
perpendicularSegmentPoint2x: : x-coordinate of the perpendicularCenterSegment’s end point
perpendicularSegmentPoint2y: : y-coordinate of the perpendicularCenterSegment’s end point
Added in version 3.24.
Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.
- static perpendicularOffsetPointAlongSegment(x1: float, y1: float, x2: float, y2: float, proportion: float, offset: float)[source]¶
Calculates a point a certain
proportion
of the way along the segment from (x1
,y1
) to (x2
,y2
), offset from the segment by the specifiedoffset
amount.- Parameters:
x1 (float) – x-coordinate of start of segment
y1 (float) – y-coordinate of start of segment
x2 (float) – x-coordinate of end of segment
y2 (float) – y-coordinate of end of segment
proportion (float) – proportion of the segment’s length at which to place the point (between 0.0 and 1.0)
offset (float) -> (Optional[float]) – perpendicular offset from segment to apply to point. A negative
offset
shifts the point to the left of the segment, while a positiveoffset
will shift it to the right of the segment.
Example¶
# Offset point at center of segment by 2 units to the right x, y = QgsGeometryUtils.perpendicularOffsetPointAlongSegment( 1, 5, 11, 5, 0.5, 2 ) # (6.0, 3.0) # Offset point at center of segment by 2 units to the left x, y = QgsGeometryUtils.perpendicularOffsetPointAlongSegment( 1, 5, 11, 5, 0.5, -2 ) # (6.0, 7.0)
- return:
x: calculated point x-coordinate
y: calculated point y-coordinate
Added in version 3.20.
Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.
- static perpendicularSegment(p: QgsPoint, s1: QgsPoint, s2: QgsPoint) QgsLineString [source]¶
Create a perpendicular line segment from p to segment [s1, s2]
- Parameters:
- Return type:
- Returns:
A line (segment) from p to perpendicular point on segment [s1, s2]
- static pointContinuesArc(a1: QgsPoint, a2: QgsPoint, a3: QgsPoint, b: QgsPoint, distanceTolerance: float, pointSpacingAngleTolerance: float) bool [source]¶
Returns
True
if pointb
is on the arc formed by pointsa1
,a2
, anda3
, but not within that arc portion already described bya1
,a2
anda3
.The
distanceTolerance
specifies the maximum deviation allowed between the original location of point b and where it would fall on the candidate arc.This method only consider a segments as continuing an arc if the points are all regularly spaced on the candidate arc. The
pointSpacingAngleTolerance
parameter specifies the maximum angular deviation (in radians) allowed when testing for regular point spacing.Note
The API is considered EXPERIMENTAL and can be changed without a notice
Added in version 3.14.
- static pointFractionAlongLine(x1: float, y1: float, x2: float, y2: float, px: float, py: float) float [source]¶
Given the line (
x1
,y1
) to (x2
,y2
) and a point (px
,py
) returns the fraction of the line length at which the point lies.Warning
this method requires that the point definitely lies on the line!
Added in version 3.32.
Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.- Parameters:
x1 (float)
y1 (float)
x2 (float)
y2 (float)
px (float)
py (float)
- Return type:
float
- pointOnLineWithDistance(startPoint: QgsPoint, directionPoint: QgsPoint, distance: float) QgsPoint [source]¶
Returns a point a specified
distance
toward a second point.
- static pointsAreCollinear(x1: float, y1: float, x2: float, y2: float, x3: float, y3: float, epsilon: float) bool [source]¶
Given the points (
x1
,y1
), (x2
,y2
) and (x3
,y3
) returnsTrue
if these points can be considered collinear with a specified toleranceepsilon
.Added in version 3.32.
Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.- Parameters:
x1 (float)
y1 (float)
x2 (float)
y2 (float)
x3 (float)
y3 (float)
epsilon (float)
- Return type:
bool
- static projectPointOnSegment(p: QgsPoint, s1: QgsPoint, s2: QgsPoint) QgsPoint [source]¶
Project the point on a segment
- static segmentIntersection(p1: QgsPoint, p2: QgsPoint, q1: QgsPoint, q2: QgsPoint, tolerance: float = 1e-08, acceptImproperIntersection: bool = False)[source]¶
Compute the intersection between two segments
- Parameters:
p1 (QgsPoint) – First segment start point
p2 (QgsPoint) – First segment end point
q1 (QgsPoint) – Second segment start point
q2 (QgsPoint) – Second segment end point
tolerance (float = 1e-08) – The tolerance to use
acceptImproperIntersection (bool = False) -> (bool) – By default, this method returns
True
only if segments have proper intersection. If set true, returns alsoTrue
if segments have improper intersection (end of one segment on other segment ; continuous segments).
- Returns:
Whether the segments intersect
intersectionPoint: Output parameter, the intersection point
isIntersection: Output parameter, return
True
if an intersection is found
Example¶
ret = QgsGeometryUtils.segmentIntersection( QgsPoint( 0, 0 ), QgsPoint( 0, 1 ), QgsPoint( 1, 1 ), QgsPoint( 1, 0 ) ) ret[0], ret[1].asWkt(), ret[2] # Whether the segments intersect, the intersection point, is intersect # (False, 'Point (0 0)', False) ret = QgsGeometryUtils.segmentIntersection( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 0, 5 ), QgsPoint( 1, 5 ) ) ret[0], ret[1].asWkt(), ret[2] # (False, 'Point (0 5)', True) ret = QgsGeometryUtils.segmentIntersection( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 0, 5 ), QgsPoint( 1, 5 ), acceptImproperIntersection=True ) ret[0], ret[1].asWkt(), ret[2] # (True, 'Point (0 5)', True) ret = QgsGeometryUtils.segmentIntersection( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 0, 2 ), QgsPoint( 1, 5 ) ) ret[0], ret[1].asWkt(), ret[2] # (False, 'Point (0 2)', True) ret = QgsGeometryUtils.segmentIntersection( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 0, 2 ), QgsPoint( 1, 5 ), acceptImproperIntersection=True ) ret[0], ret[1].asWkt(), ret[2] # (True, 'Point (0 2)', True) ret = QgsGeometryUtils.segmentIntersection( QgsPoint( 0, -5 ), QgsPoint( 0, 5 ), QgsPoint( 2, 0 ), QgsPoint( -1, 0 ) ) ret[0], ret[1].asWkt(), ret[2] # (True, 'Point (0 0)', True)
- static segmentMidPoint(p1: QgsPoint, p2: QgsPoint, radius: float, mousePos: QgsPoint)[source]¶
Calculates midpoint on circle passing through
p1
andp2
, closest to the given coordinatemousePos
. Z dimension is supported and is retrieved from the first 3D point amongstp1
andp2
.See also
- static segmentMidPointFromCenter(p1: QgsPoint, p2: QgsPoint, center: QgsPoint, useShortestArc: bool = True) QgsPoint [source]¶
Calculates the midpoint on the circle passing through
p1
andp2
, with the specifiedcenter
coordinate.If
useShortestArc
isTrue
, then the midpoint returned will be that corresponding to the shorter arc fromp1
top2
. If it isFalse
, the longer arc fromp1
top2
will be used (i.e. winding the other way around the circle).See also
Added in version 3.2.
- static segmentSide(pt1: QgsPoint, pt3: QgsPoint, pt2: QgsPoint) int [source]¶
For line defined by points pt1 and pt3, find out on which side of the line is point pt2. Returns -1 if pt2 on the left side, 1 if pt2 is on the right side or 0 if pt2 lies on the line.
- static segmentizeArc(p1: QgsPoint, p2: QgsPoint, p3: QgsPoint, tolerance: float = M_PI_2 / 90, toleranceType: QgsAbstractGeometry.SegmentationToleranceType = QgsAbstractGeometry.MaximumAngle, hasZ: bool = False, hasM: bool = False) List[QgsPoint] [source]¶
Convert circular arc defined by p1, p2, p3 (p1/p3 being start resp. end point, p2 lies on the arc) into a sequence of points.
- static setZValueFromPoints(points: Iterable[QgsPoint], point: QgsPoint) bool [source]¶
A Z dimension is added to
point
if one of the point in the listpoints
is in 3D. Moreover, the Z value ofpoint
is updated with the first Z value found in listpoints
even ifpoint
already contains a Z value.- Parameters:
- Return type:
bool
- Returns:
True
if the point is updated,False
otherwise
Warning
This method does not copy the z value of the coordinate from the points whose z value is closest to the original x/y point, but only the first one found.
Deprecated since version 3.20: Use transferFirstZValueToPoint( const
QgsPointSequence
&points,QgsPoint
&point ) instead.
- static skewLinesDistance(P1: QgsVector3D, P12: QgsVector3D, P2: QgsVector3D, P22: QgsVector3D) float [source]¶
An algorithm to calculate the shortest distance between two skew lines.
- Parameters:
P1 (QgsVector3D) – is the first point of the first line,
P12 (QgsVector3D) – is the second point on the first line,
P2 (QgsVector3D) – is the first point on the second line,
P22 (QgsVector3D) – is the second point on the second line.
- Return type:
float
- Returns:
the shortest distance
Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.
- static skewLinesProjection(P1: QgsVector3D, P12: QgsVector3D, P2: QgsVector3D, P22: QgsVector3D, epsilon: float = 0.0001)[source]¶
A method to project one skew line onto another.
- Parameters:
P1 (QgsVector3D) – is a first point that belonds to first skew line,
P12 (QgsVector3D) – is the second point that belongs to first skew line,
P2 (QgsVector3D) – is the first point that belongs to second skew line,
P22 (QgsVector3D) – is the second point that belongs to second skew line,
epsilon (float = 0.0001) -> (bool) – the tolerance to use.
- Returns:
True
if such point exists,False
- otherwise.X1: is the result projection point of line P2P22 onto line P1P12,
Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.
- static sqrDistToLine(ptX: float, ptY: float, x1: float, y1: float, x2: float, y2: float, epsilon: float)[source]¶
Returns the squared distance between a point and a line.
Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.- Parameters:
ptX (float)
ptY (float)
x1 (float)
y1 (float)
x2 (float)
y2 (float)
epsilon (float) -> (float)
- static sqrDistance2D(x1: float, y1: float, x2: float, y2: float) float [source]¶
Returns the squared 2D distance between (
x1
,y1
) and (x2
,y2
).Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.- Parameters:
x1 (float)
y1 (float)
x2 (float)
y2 (float)
- Return type:
float
- static sqrDistance2D(pt1: QgsPoint, pt2: QgsPoint) float [source]
Returns the squared 2D distance between two points.
- static sqrDistance3D(pt1: QgsPoint, pt2: QgsPoint) float [source]¶
Returns the squared 3D distance between two points.
Warning
No check is done if z contains NaN value. This is the caller’s responsibility.
Added in version 3.36.
- static sweepAngle(centerX: float, centerY: float, x1: float, y1: float, x2: float, y2: float, x3: float, y3: float) float [source]¶
Calculates angle of a circular string part defined by pt1, pt2, pt3
Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.- Parameters:
centerX (float)
centerY (float)
x1 (float)
y1 (float)
x2 (float)
y2 (float)
x3 (float)
y3 (float)
- Return type:
float
- static tangentPointAndCircle(center: QgsPointXY, radius: float, p: QgsPointXY)[source]¶
Calculates the tangent points between the circle with the specified
center
andradius
and the pointp
.If found, the tangent points will be stored in
pt1
andpt2
.Added in version 3.2.
- Parameters:
center (QgsPointXY)
radius (float)
p (
QgsPointXY
) -> (bool)
- static transferFirstMValueToPoint(points: Iterable[QgsPoint], point: QgsPoint) bool [source]¶
A M dimension is added to
point
if one of the points in the listpoints
contains an M value. Moreover, the M value ofpoint
is updated with the first M value found in listpoints
even ifpoint
already contains a M value.- Parameters:
- Return type:
bool
- Returns:
True
if the point is updated,False
otherwise
Warning
This method does not copy the m value of the coordinate from the points whose m value is closest to the original x/y point, but only the first one found.
Added in version 3.20.
- static transferFirstZOrMValueToPoint(points: Iterable[QgsPoint], point: QgsPoint) bool [source]¶
A Z or M dimension is added to
point
if one of the points in the listpoints
contains Z or M value.This method is equivalent to successively calling Z and M but avoiding looping twice over the set of points.
- Parameters:
- Return type:
bool
- Returns:
True
if the point is updated,False
otherwise
Warning
This method does not copy the z or m value of the coordinate from the points whose z or m value is closest to the original x/y point, but only the first one found.
Added in version 3.20.
- static transferFirstZOrMValueToPoint(geom: QgsGeometry, point: QgsPoint) bool [source]
A Z or M dimension is added to
point
if one of the points in the listpoints
contains Z or M value.This method is equivalent to successively calling Z and M but avoiding looping twice over the set of points.
- Parameters:
geom (
QgsGeometry
) – geometry in which a M point is searched.point (
QgsPoint
) – The point to update with Z or M dimension and value.
- Return type:
bool
- Returns:
True
if the point is updated,False
otherwise
Warning
This method does not copy the z or m value of the coordinate from the points whose z or m value is closest to the original x/y point, but only the first one found.
Added in version 3.20.
- static transferFirstZValueToPoint(points: Iterable[QgsPoint], point: QgsPoint) bool [source]¶
A Z dimension is added to
point
if one of the point in the listpoints
is in 3D. Moreover, the Z value ofpoint
is updated with the first Z value found in listpoints
even ifpoint
already contains a Z value.- Parameters:
- Return type:
bool
- Returns:
True
if the point is updated,False
otherwise
Warning
This method does not copy the z value of the coordinate from the points whose z value is closest to the original x/y point, but only the first one found.
Added in version 3.20.
- static triangleArea(aX: float, aY: float, bX: float, bY: float, cX: float, cY: float) float [source]¶
Returns the area of the triangle denoted by the points (
aX
,aY
), (bX
,bY
) and (cX
,cY
).Added in version 3.10.
Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.- Parameters:
aX (float)
aY (float)
bX (float)
bY (float)
cX (float)
cY (float)
- Return type:
float
- static verticesAtDistance(geometry: QgsAbstractGeometry, distance: float)[source]¶
Retrieves the vertices which are before and after the interpolated point at a specified distance along a linestring (or polygon boundary).
- Parameters:
geometry (QgsAbstractGeometry) – line or polygon geometry
distance (float) -> (bool) – distance to traverse along geometry
- Returns:
True
if vertices were successfully retrievedpreviousVertex: previous vertex ID
nextVertex: next vertex ID
Note
if the distance coincides exactly with a vertex, then both previousVertex and nextVertex will be set to this vertex
- static weightedPointInTriangle(aX: float, aY: float, bX: float, bY: float, cX: float, cY: float, weightB: float, weightC: float)[source]¶
Returns a weighted point inside the triangle denoted by the points (
aX
,aY
), (bX
,bY
) and (cX
,cY
).- Parameters:
aX (float) – x-coordinate of first vertex in triangle
aY (float) – y-coordinate of first vertex in triangle
bX (float) – x-coordinate of second vertex in triangle
bY (float) – y-coordinate of second vertex in triangle
cX (float) – x-coordinate of third vertex in triangle
cY (float) – y-coordinate of third vertex in triangle
weightB (float) – weighting factor along axis A-B (between 0 and 1)
weightC (float) -> (float) – weighting factor along axis A-C (between 0 and 1)
- Returns:
pointX: x-coordinate of generated point
pointY: y-coordinate of generated point
Added in version 3.10.
Deprecated since version 3.40: Use
QgsGeometryUtilsBase
methods instead.