Class: QgsGeometryUtilsBase¶
Convenience functions for geometry utils.
Added in version 3.34.
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). |
|
Calculates Cartesian azimuth between points (x1, y1) and (x2, y2) (clockwise in degree, starting from north) |
|
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 (x1 y1), (x2 y2), (x3 y3) |
|
Returns |
|
Length of a circular string segment defined by pt1, pt2, pt3 |
|
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 2D distance between (x1, y1) and (x2, y2). |
|
Returns the 3D distance between (x1, y1, z1) and (x2, y2, z2). |
|
Interpolate a value at given angle on circular arc given values (zm1, zm2, zm3) at three different angles (a1, a2, a3). |
|
Returns a value < 0 if the point (x, y) is left of the line from (x1, y1) -> (x2, y2). |
|
Calculates the direction of line joining two points in radians, clockwise from the north direction. |
|
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. |
|
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. |
|
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 |
|
Returns coordinates of a point which corresponds to this point projected by a specified distance with specified angles (azimuth and inclination), using Cartesian mathematics. |
|
Compute the intersection between two segments |
|
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 (x1, y1, z1) and (x2, y2, z2). |
|
Calculates angle of a circular string part defined by pt1, pt2, pt3 |
|
Returns the area of the triangle denoted by the points (aX, aY), (bX, bY) and (cX, cY). |
|
Returns a weighted point inside the triangle denoted by the points (aX, aY), (bX, bY) and (cX, cY). |
- class qgis.core.QgsGeometryUtilsBase[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.
- 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.
- 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.- 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
).- 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)
- static azimuth(x1: float, y1: float, x2: float, y2: float) float [source]¶
Calculates Cartesian azimuth between points (
x1
,y1
) and (x2
,y2
) (clockwise in degree, starting from north)- Parameters:
x1 (float) – x-coordinate of the start point
y1 (float) – y-coordinate of the start point
x2 (float) – x-coordinate of the end point
y2 (float) – y-coordinate of the end point
Added in version 3.34.
- Return type:
float
- 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.
- 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
- Parameters:
dy (float)
dx (float)
- Return type:
float
- static circleAngleBetween(angle: float, angle1: float, angle2: float, clockwise: bool) bool [source]¶
Returns
True
if, in a circle, angle is between angle1 and angle2- Parameters:
angle (float)
angle1 (float)
angle2 (float)
clockwise (bool)
- Return type:
bool
- static circleCenterRadius(x1: float, y1: float, x2: float, y2: float, x3: float, y3: float)[source]¶
Returns radius and center of the circle through (
x1
y1
), (x2
y2
), (x3
y3
)- Parameters:
x1 (float)
y1 (float)
x2 (float)
y2 (float)
x3 (float)
y3 (float) -> (float)
- 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.
- 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
- Parameters:
x1 (float)
y1 (float)
x2 (float)
y2 (float)
x3 (float)
y3 (float)
- Return type:
float
- 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.
- Parameters:
right (float)
bottom (float)
left (float)
top (float)
x (float)
y (float)
- Return type:
int
- static distance2D(x1: float, y1: float, x2: float, y2: float) float [source]¶
Returns the 2D distance between (
x1
,y1
) and (x2
,y2
).- Parameters:
x1 (float)
y1 (float)
x2 (float)
y2 (float)
- Return type:
float
- static distance3D(x1: float, y1: float, z1: float, x2: float, y2: float, z2: float) float [source]¶
Returns the 3D distance between (
x1
,y1
,z1
) and (x2
,y2
,z2
).Warning
No check is done if z contains NaN value. This is the caller’s responsibility.
Added in version 3.36.
- Parameters:
x1 (float)
y1 (float)
z1 (float)
x2 (float)
y2 (float)
z2 (float)
- Return type:
float
- 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).
- Parameters:
angle (float)
a1 (float)
a2 (float)
a3 (float)
zm1 (float)
zm2 (float)
zm3 (float)
- Return type:
float
- 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.
- 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.
- static lineIntersection(p1x: float, p1y: float, v1: QgsVector, p2x: float, p2y: float, v2: QgsVector)[source]¶
Computes the intersection between two lines. Z dimension is supported and is retrieved from the first 3D point amongst
p1
andp2
.- Parameters:
p1x (float) – x-coordinate of point on the first line
p1y (float) – y-coordinate of point on the first line
v1 (QgsVector) – Direction vector of the first line
p2x (float) – x-coordinate of second point on the first line
p2y (float) – y-coordinate of second point on the first line
v2 (
QgsVector
) -> (bool) – Direction vector of the second line
- Returns:
Whether the lines intersect
intersectionX: x-coordinate of the intersection point
intersectionY: y-coordinate of the intersection point
- 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.
- 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))
- 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)
- 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.
- 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.
- 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.
- Parameters:
x1 (float)
y1 (float)
x2 (float)
y2 (float)
px (float)
py (float)
- Return type:
float
- 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.
- Parameters:
x1 (float)
y1 (float)
x2 (float)
y2 (float)
x3 (float)
y3 (float)
epsilon (float)
- Return type:
bool
- static project(aX: float, aY: float, aZ: float, distance: float, azimuth: float, inclination: float)[source]¶
Returns coordinates of a point which corresponds to this point projected by a specified distance with specified angles (azimuth and inclination), using Cartesian mathematics. M value is preserved. resultX, resultY, resultZ are coordinates of the point projected. If a 2D point is projected a 3D point will be returned except if inclination is 90. A 3D point is always returned if a 3D point is projected.
- Parameters:
aX (float) – x-coordinate of the point to project
aY (float) – y-coordinate of the point to project
aZ (float) – z-coordinate of the point to project
distance (float) – distance to project
azimuth (float) – angle to project in X Y, clockwise in degrees starting from north
inclination (float) -> (float) – angle to project in Z (3D). If the point is 2D, the Z value is assumed to be 0.
- Returns:
resultX: Output parameter, x-coordinates of the point projected.
resultY: Output parameter, y-coordinates of the point projected.
resultZ: Output parameter, z-coordinates of the point projected.
Added in version 3.34.
- static segmentIntersection(p1x: float, p1y: float, p2x: float, p2y: float, q1x: float, q1y: float, q2x: float, q2y: float, tolerance: float = 1e-08, acceptImproperIntersection: bool = False)[source]¶
Compute the intersection between two segments
- Parameters:
p1x (float) – x-coordinate of the first segment start point
p1y (float) – y-coordinate of the first segment start point
p2x (float) – x-coordinate of the first segment end point
p2y (float) – y-coordinate of the first segment end point
q1x (float) – x-coordinate of the second segment start point
q1y (float) – y-coordinate of the second segment start point
q2x (float) – x-coordinate of the second segment end point
q2y (float) – y-coordinate of the 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
intersectionPointX: Output parameter, x-coordinate of the intersection point
intersectionPointY: Output parameter, y-coordinate of the intersection point
isIntersection: Output parameter, return
True
if an intersection is found
- 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
- 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,
- 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.
- 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
).- Parameters:
x1 (float)
y1 (float)
x2 (float)
y2 (float)
- Return type:
float
- static sqrDistance3D(x1: float, y1: float, z1: float, x2: float, y2: float, z2: float) float [source]¶
Returns the squared 3D distance between (
x1
,y1
,z1
) and (x2
,y2
,z2
).Warning
No check is done if z contains NaN value. This is the caller’s responsibility.
Added in version 3.36.
- Parameters:
x1 (float)
y1 (float)
z1 (float)
x2 (float)
y2 (float)
z2 (float)
- Return type:
float
- 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
- Parameters:
centerX (float)
centerY (float)
x1 (float)
y1 (float)
x2 (float)
y2 (float)
x3 (float)
y3 (float)
- Return type:
float
- 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.
- Parameters:
aX (float)
aY (float)
bX (float)
bY (float)
cX (float)
cY (float)
- Return type:
float
- 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.