|
QGIS API Documentation 3.99.0-Master (2fe06baccd8)
|
Convenience functions for geometry utils. More...
#include <qgsgeometryutils_base.h>
Static Public Member Functions | |
| 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, b and b, c. | |
| 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, bY) (dX, dY). | |
| 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, angle2 and angle3. | |
| static double | averageAngle (double a1, double a2) |
| Averages two angles, correctly handling negative angles and ensuring the result is between 0 and 2 pi. | |
| 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, y1) to (x2, y2) and (x2, y2) to (x3, y3). | |
| static double | azimuth (double x1, double y1, double x2, double y2) |
| Calculates Cartesian azimuth between points (x1, y1) and (x2, y2) (clockwise in degree, starting from north). | |
| 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, bY) (cX, cY). | |
| static double | calculateArcLength (double centerX, double centerY, double radius, double x1, double y1, double x2, double y2, double x3, double y3, int fromVertex, int toVertex) |
| Calculates the precise arc length between two vertices on a circular arc. | |
| 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 and dy = 0. | |
| static bool | circleAngleBetween (double angle, double angle1, double angle2, bool clockwise) |
Returns true if, in a circle, angle is between angle1 and angle2. | |
| 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 | circleClockwise (double angle1, double angle2, double angle3) |
Returns true if the circle defined by three angles is ordered clockwise. | |
| 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 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, bottom, left, top to the point at (x, y), where the point may be in the interior of the rectangle or outside it. | |
| static bool | createChamfer (const double segment1StartX, const double segment1StartY, const double segment1EndX, const double segment1EndY, const double segment2StartX, const double segment2StartY, const double segment2EndX, const double segment2EndY, const double distance1, const double distance2, double &chamferStartX, double &chamferStartY, double &chamferEndX, double &chamferEndY, double *trim1StartX=nullptr, double *trim1StartY=nullptr, double *trim1EndX=nullptr, double *trim1EndY=nullptr, double *trim2StartX=nullptr, double *trim2StartY=nullptr, double *trim2EndX=nullptr, double *trim2EndY=nullptr, const double epsilon=1e-8) |
| Creates a chamfer (angled corner) between two line segments. | |
| static bool | createFillet (const double segment1StartX, const double segment1StartY, const double segment1EndX, const double segment1EndY, const double segment2StartX, const double segment2StartY, const double segment2EndX, const double segment2EndY, const double radius, double *filletPointsX, double *filletPointsY, double *trim1StartX=nullptr, double *trim1StartY=nullptr, double *trim1EndX=nullptr, double *trim1EndY=nullptr, double *trim2StartX=nullptr, double *trim2StartY=nullptr, double *trim2EndX=nullptr, double *trim2EndY=nullptr, const double epsilon=1e-8) |
| Creates a fillet (rounded corner) between two line segments. | |
| static double | distance2D (double x1, double y1, double x2, double y2) |
| Returns the 2D distance between (x1, y1) and (x2, y2). | |
| 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). | |
| template<typename T, typename... Args> | |
| static bool | fuzzyDistanceEqual (T epsilon, const Args &... args) noexcept |
| Compare equality between multiple pairs of values with a specified epsilon. | |
| template<typename T, typename... Args> | |
| static bool | fuzzyEqual (T epsilon, const Args &... args) noexcept |
| Performs fuzzy comparison between pairs of values within a specified epsilon. | |
| 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 angles (a1, a2, a3). | |
| 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 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 bool | lineIntersection (double p1x, double p1y, QgsVector v1, double p2x, double p2y, QgsVector v2, double &intersectionX, double &intersectionY) |
| Computes the intersection between two lines. | |
| static double | linePerpendicularAngle (double x1, double y1, double x2, double y2) |
| Calculates the perpendicular angle to a line joining two points. | |
| 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 double | maxFilletRadius (const double segment1StartX, const double segment1StartY, const double segment1EndX, const double segment1EndY, const double segment2StartX, const double segment2StartY, const double segment2EndX, const double segment2EndY, double epsilon=1e-8) |
| Calculates the maximum allowed fillet radius for the given segment configuration. | |
| static double | normalizedAngle (double angle) |
| Ensures that an angle is in the range 0 <= angle < 2 pi. | |
| 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 at centerPoint. | |
| 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, y2), offset from the segment by the specified offset amount. | |
| 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 which the point lies. | |
| 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, y2). | |
| static bool | points3DAreCollinear (double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double epsilon) |
Given the points (x1, y1, z1), (x2, y2, z2) and (x3, y3, z3) returns true if these points can be considered collinear with a specified tolerance epsilon. | |
| 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 collinear with a specified tolerance epsilon. | |
| static void | project (double aX, double aY, double aZ, double distance, double azimuth, double inclination, double &resultX, double &resultY, double &resultZ) |
| Returns coordinates of a point which corresponds to this point projected by a specified distance with specified angles (azimuth and inclination), using Cartesian mathematics. | |
| 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 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 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 | sqrDistance2D (double x1, double y1, double x2, double y2) |
| Returns the squared 2D distance between (x1, y1) and (x2, y2). | |
| 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 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 | 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, cY). | |
| 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, cY). | |
Convenience functions for geometry utils.
Definition at line 31 of file qgsgeometryutils_base.h.
|
static |
Calculates the angle between the lines AB and BC, where AB and BC described by points a, b and b, c.
| x1 | x-coordinate of point a |
| y1 | y-coordinate of point a |
| x2 | x-coordinate of point b |
| y2 | y-coordinate of point b |
| x3 | x-coordinate of point c |
| y3 | y-coordinate of point c |
Definition at line 457 of file qgsgeometryutils_base.cpp.
|
static |
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 by angle)
| aX | x-coordinate of first vertex of the segment ab |
| aY | y-coordinate of first vertex of the segment ab |
| bX | x-coordinate of second vertex of the segment ab |
| bY | y-coordinate of second vertex of the segment ab |
| cX | x-coordinate of first vertex of the segment cd |
| cY | y-coordinate of first vertex of the segment cd |
| dX | x-coordinate of second vertex of the segment cd |
| dY | y-coordinate of second vertex of the segment cd |
| pointX | x-coordinate of generated point |
| pointY | y-coordinate of generated point |
| angle | angle of the bisector from pointX, pointY origin on [ab-cd] |
true if the bisector exists (A B and C D are not collinear)Definition at line 773 of file qgsgeometryutils_base.cpp.
|
static |
Returns true if an angle is between angle1 and angle3 on a circle described by angle1, angle2 and angle3.
Definition at line 168 of file qgsgeometryutils_base.cpp.
|
static |
Averages two angles, correctly handling negative angles and ensuring the result is between 0 and 2 pi.
| a1 | first angle (in radians) |
| a2 | second angle (in radians) |
Definition at line 479 of file qgsgeometryutils_base.cpp.
|
static |
Calculates the average angle (in radians) between the two linear segments from (x1, y1) to (x2, y2) and (x2, y2) to (x3, y3).
Definition at line 471 of file qgsgeometryutils_base.cpp.
|
static |
Calculates Cartesian azimuth between points (x1, y1) and (x2, y2) (clockwise in degree, starting from north).
| x1 | x-coordinate of the start point |
| y1 | y-coordinate of the start point |
| x2 | x-coordinate of the end point |
| y2 | y-coordinate of the end point |
Definition at line 766 of file qgsgeometryutils_base.cpp.
|
static |
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)
| aX | x-coordinate of first vertex in triangle |
| aY | y-coordinate of first vertex in triangle |
| bX | x-coordinate of second vertex in triangle |
| bY | y-coordinate of second vertex in triangle |
| cX | x-coordinate of third vertex in triangle |
| cY | y-coordinate of third vertex in triangle |
| pointX | x-coordinate of generated point |
| pointY | y-coordinate of generated point |
true if the bisector exists (A B and C are not collinear)Definition at line 809 of file qgsgeometryutils_base.cpp.
|
static |
Calculates the precise arc length between two vertices on a circular arc.
This method calculates the exact distance along the arc between any two vertices on a circle defined by three points. The arc follows the geometric path of the circle.
| centerX | X coordinate of the circle center |
| centerY | Y coordinate of the circle center |
| radius | radius of the circle |
| x1 | X coordinate of the first point defining the arc |
| y1 | Y coordinate of the first point defining the arc |
| x2 | X coordinate of the second point defining the arc |
| y2 | Y coordinate of the second point defining the arc |
| x3 | X coordinate of the third point defining the arc |
| y3 | Y coordinate of the third point defining the arc |
| fromVertex | vertex index to start from (0, 1, or 2) |
| toVertex | vertex index to end at (0, 1, or 2) |
Definition at line 226 of file qgsgeometryutils_base.cpp.
|
static |
Returns the counter clockwise angle between a line with components dx, dy and the line with dx > 0 and dy = 0.
Definition at line 116 of file qgsgeometryutils_base.cpp.
|
static |
Returns true if, in a circle, angle is between angle1 and angle2.
Definition at line 142 of file qgsgeometryutils_base.cpp.
|
static |
Returns radius and center of the circle through (x1 y1), (x2 y2), (x3 y3).
Definition at line 174 of file qgsgeometryutils_base.cpp.
|
static |
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.
Definition at line 130 of file qgsgeometryutils_base.cpp.
|
static |
Length of a circular string segment defined by pt1, pt2, pt3.
Definition at line 212 of file qgsgeometryutils_base.cpp.
|
static |
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:
Definition at line 358 of file qgsgeometryutils_base.cpp.
|
static |
Creates a chamfer (angled corner) between two line segments.
This method generates a straight-line chamfer connecting two line segments at their intersection point. The chamfer distances can be specified independently for each segment, allowing for both symmetric and asymmetric chamfers.
| segment1StartX | x-coordinate of first segment start point |
| segment1StartY | y-coordinate of first segment start point |
| segment1EndX | x-coordinate of first segment end point |
| segment1EndY | y-coordinate of first segment end point |
| segment2StartX | x-coordinate of second segment start point |
| segment2StartY | y-coordinate of second segment start point |
| segment2EndX | x-coordinate of second segment end point |
| segment2EndY | y-coordinate of second segment end point |
| distance1 | chamfer distance along first segment |
| distance2 | chamfer distance along second segment (if < 0, uses distance1) |
| chamferStartX | output x-coordinate of chamfer start point |
| chamferStartY | output y-coordinate of chamfer start point |
| chamferEndX | output x-coordinate of chamfer end point |
| chamferEndY | output y-coordinate of chamfer end point |
| trim1StartX | optional output x-coordinate of trimmed first segment start |
| trim1StartY | optional output y-coordinate of trimmed first segment start |
| trim1EndX | optional output x-coordinate of trimmed first segment end |
| trim1EndY | optional output y-coordinate of trimmed first segment end |
| trim2StartX | optional output x-coordinate of trimmed second segment start |
| trim2StartY | optional output y-coordinate of trimmed second segment start |
| trim2EndX | optional output x-coordinate of trimmed second segment end |
| trim2EndY | optional output y-coordinate of trimmed second segment end |
| epsilon | tolerance for numerical comparisons and intersection detection |
true if chamfer was successfully createdDefinition at line 1074 of file qgsgeometryutils_base.cpp.
|
static |
Creates a fillet (rounded corner) between two line segments.
This method generates a circular arc connecting two line segments at their intersection point. The fillet returns exactly 3 points defining a CircularString: start point, middle point, and end point of the arc.
| segment1StartX | x-coordinate of first segment start point |
| segment1StartY | y-coordinate of first segment start point |
| segment1EndX | x-coordinate of first segment end point |
| segment1EndY | y-coordinate of first segment end point |
| segment2StartX | x-coordinate of second segment start point |
| segment2StartY | y-coordinate of second segment start point |
| segment2EndX | x-coordinate of second segment end point |
| segment2EndY | y-coordinate of second segment end point |
| radius | radius of the fillet arc |
| filletPointsX | output array of x-coordinates for 3 fillet points (start, middle, end) |
| filletPointsY | output array of y-coordinates for 3 fillet points (start, middle, end) |
| trim1StartX | optional output x-coordinate of trimmed first segment start |
| trim1StartY | optional output y-coordinate of trimmed first segment start |
| trim1EndX | optional output x-coordinate of trimmed first segment end |
| trim1EndY | optional output y-coordinate of trimmed first segment end |
| trim2StartX | optional output x-coordinate of trimmed second segment start |
| trim2StartY | optional output y-coordinate of trimmed second segment start |
| trim2EndX | optional output x-coordinate of trimmed second segment end |
| trim2EndY | optional output y-coordinate of trimmed second segment end |
| epsilon | tolerance for numerical comparisons and intersection detection |
true if fillet was successfully createdDefinition at line 906 of file qgsgeometryutils_base.cpp.
|
inlinestatic |
Returns the 2D distance between (x1, y1) and (x2, y2).
Definition at line 59 of file qgsgeometryutils_base.h.
|
inlinestatic |
Returns the 3D distance between (x1, y1, z1) and (x2, y2, z2).
Definition at line 49 of file qgsgeometryutils_base.h.
|
inlinestaticnoexcept |
Compare equality between multiple pairs of values with a specified epsilon.
Traditionally, the comparison is done by examining the specific values (such as x and y) that define the location of points. It focuses on the numerical differences or relationships between these values. On the other hand, comparing distances between points considers the actual spatial separation or length between the points, regardless of their coordinate values. This comparison involves measuring the distance between two points using formulas like the distance formula. Here, it's the "distance comparison" (fuzzyDistanceEqual).
| T | Floating-point type (double or float) for the values to be compared. |
| Args | Type of arguments for the values to be compared. |
| epsilon | The range within which the differences are checked. |
| args | Variadic list of values to be compared in pairs. The number of arguments must be greater than or equal to 4. It must follow the pattern: x1, y1, x2, y2, or x1, y1, z1, x2, y2, z2, ... |
Definition at line 576 of file qgsgeometryutils_base.h.
|
inlinestaticnoexcept |
Performs fuzzy comparison between pairs of values within a specified epsilon.
This function compares a variable number of pairs of values to check if their differences fall within a specified epsilon range using qgsNumberNear. It returns true if all the differences are within the given epsilon range; otherwise, it returns false.
| T | Floating-point type (double or float) for the values to be compared. |
| Args | Type of arguments for the values to be compared. |
| epsilon | The range within which the differences are checked. |
| args | Variadic list of values to be compared in pairs. The number of arguments must be greater than 0 and even. It must follow the pattern: x1, y1, x2, y2, or x1, y1, z1, x2, y2, z2, ... |
Definition at line 540 of file qgsgeometryutils_base.h.
|
static |
Interpolate a value at given angle on circular arc given values (zm1, zm2, zm3) at three different angles (a1, a2, a3).
Definition at line 324 of file qgsgeometryutils_base.cpp.
|
static |
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.
Definition at line 61 of file qgsgeometryutils_base.cpp.
|
static |
Calculates the direction of line joining two points in radians, clockwise from the north direction.
| x1 | x-coordinate of line start |
| y1 | y-coordinate of line start |
| x2 | x-coordinate of line end |
| y2 | y-coordinate of line end |
Definition at line 450 of file qgsgeometryutils_base.cpp.
|
static |
Computes the intersection between two lines.
Z dimension is supported and is retrieved from the first 3D point amongst p1 and p2.
| p1x | x-coordinate of point on the first line |
| p1y | y-coordinate of point on the first line |
| v1 | Direction vector of the first line |
| p2x | x-coordinate of second point on the first line |
| p2y | y-coordinate of second point on the first line |
| v2 | Direction vector of the second line |
| intersectionX | x-coordinate of the intersection point |
| intersectionY | y-coordinate of the intersection point |
Definition at line 560 of file qgsgeometryutils_base.cpp.
|
static |
Calculates the perpendicular angle to a line joining two points.
Returned angle is in radians, clockwise from the north direction.
| x1 | x-coordinate of line start |
| y1 | y-coordinate of line start |
| x2 | x-coordinate of line end |
| y2 | y-coordinate of line end |
Definition at line 464 of file qgsgeometryutils_base.cpp.
|
static |
An algorithm to calculate an (approximate) intersection of two lines in 3D.
| La1 | is the first point on the first line, |
| La2 | is the second point on the first line, |
| Lb1 | is the first point on the second line, |
| Lb2 | is the second point on the second line, |
| intersection | is the result intersection, of it can be found. |
true if the intersection can be found, false - otherwise.Definition at line 646 of file qgsgeometryutils_base.cpp.
|
static |
Calculates the maximum allowed fillet radius for the given segment configuration.
| segment1StartX | x-coordinate of first segment start point |
| segment1StartY | y-coordinate of first segment start point |
| segment1EndX | x-coordinate of first segment end point |
| segment1EndY | y-coordinate of first segment end point |
| segment2StartX | x-coordinate of second segment start point |
| segment2StartY | y-coordinate of second segment start point |
| segment2EndX | x-coordinate of second segment end point |
| segment2EndY | y-coordinate of second segment end point |
| epsilon | tolerance for intersection and angle calculations |
Definition at line 823 of file qgsgeometryutils_base.cpp.
|
static |
Ensures that an angle is in the range 0 <= angle < 2 pi.
| angle | angle in radians |
Definition at line 343 of file qgsgeometryutils_base.cpp.
|
static |
Create a perpendicular line segment to a given segment [segmentPoint1,segmentPoint2] with its center at centerPoint.
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].
| centerPointX | x-coordinate of the point where the center of the perpendicular should be located |
| centerPointY | y-coordinate of the point where the center of the perpendicular should be located |
| segmentPoint1x | x-coordinate of segmentPoint1, the segment's start point |
| segmentPoint1y | y-coordinate of segmentPoint1, the segment's start point |
| segmentPoint2x | x-coordinate of segmentPoint2, the segment's end point |
| segmentPoint2y | y-coordinate of segmentPoint2, the segment's end point |
| 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 |
| segmentLength | (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. |
Definition at line 435 of file qgsgeometryutils_base.cpp.
|
static |
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.
| x1 | x-coordinate of start of segment |
| y1 | y-coordinate of start of segment |
| x2 | x-coordinate of end of segment |
| y2 | y-coordinate of end of segment |
| proportion | proportion of the segment's length at which to place the point (between 0.0 and 1.0) |
| offset | perpendicular offset from segment to apply to point. A negative offset shifts the point to the left of the segment, while a positive offset will shift it to the right of the segment. |
| x | calculated point x-coordinate |
| y | calculated point y-coordinate |
Definition at line 99 of file qgsgeometryutils_base.cpp.
|
static |
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.
Definition at line 720 of file qgsgeometryutils_base.cpp.
|
static |
Calculates the point a specified distance from (x1, y1) toward a second point (x2, y2).
Optionally, interpolated z and m values can be obtained by specifying the z1, z2 and z arguments and/or the m1, m2, m arguments.
Definition at line 72 of file qgsgeometryutils_base.cpp.
|
static |
Given the points (x1, y1, z1), (x2, y2, z2) and (x3, y3, z3) returns true if these points can be considered collinear with a specified tolerance epsilon.
Definition at line 755 of file qgsgeometryutils_base.cpp.
|
static |
Given the points (x1, y1), (x2, y2) and (x3, y3) returns true if these points can be considered collinear with a specified tolerance epsilon.
Definition at line 750 of file qgsgeometryutils_base.cpp.
|
static |
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.
| aX | x-coordinate of the point to project |
| aY | y-coordinate of the point to project |
| aZ | z-coordinate of the point to project |
| distance | distance to project |
| azimuth | angle to project in X Y, clockwise in degrees starting from north |
| inclination | angle to project in Z (3D). If the point is 2D, the Z value is assumed to be 0. |
| 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. |
Definition at line 784 of file qgsgeometryutils_base.cpp.
|
static |
Compute the intersection between two segments.
| p1x | x-coordinate of the first segment start point |
| p1y | y-coordinate of the first segment start point |
| p2x | x-coordinate of the first segment end point |
| p2y | y-coordinate of the first segment end point |
| q1x | x-coordinate of the second segment start point |
| q1y | y-coordinate of the second segment start point |
| q2x | x-coordinate of the second segment end point |
| q2y | y-coordinate of the second segment end point |
| 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 |
| tolerance | The tolerance to use |
| acceptImproperIntersection | By default, this method returns true only if segments have proper intersection. If set true, returns also TRUE if segments have improper intersection (end of one segment on other segment ; continuous segments). |
Definition at line 582 of file qgsgeometryutils_base.cpp.
|
static |
An algorithm to calculate the shortest distance between two skew lines.
| P1 | is the first point of the first line, |
| P12 | is the second point on the first line, |
| P2 | is the first point on the second line, |
| P22 | is the second point on the second line. |
Definition at line 506 of file qgsgeometryutils_base.cpp.
|
static |
A method to project one skew line onto another.
| P1 | is a first point that belonds to first skew line, |
| P12 | is the second point that belongs to first skew line, |
| P2 | is the first point that belongs to second skew line, |
| P22 | is the second point that belongs to second skew line, |
| X1 | is the result projection point of line P2P22 onto line P1P12, |
| epsilon | the tolerance to use. |
true if such point exists, false - otherwise. Definition at line 518 of file qgsgeometryutils_base.cpp.
|
inlinestatic |
Returns the squared 2D distance between (x1, y1) and (x2, y2).
Definition at line 54 of file qgsgeometryutils_base.h.
|
inlinestatic |
Returns the squared 3D distance between (x1, y1, z1) and (x2, y2, z2).
Definition at line 41 of file qgsgeometryutils_base.h.
|
static |
Returns the squared distance between a point and a line.
Definition at line 22 of file qgsgeometryutils_base.cpp.
|
static |
Calculates angle of a circular string part defined by pt1, pt2, pt3.
Definition at line 294 of file qgsgeometryutils_base.cpp.
|
static |
Returns the area of the triangle denoted by the points (aX, aY), (bX, bY) and (cX, cY).
Definition at line 715 of file qgsgeometryutils_base.cpp.
|
static |
Returns a weighted point inside the triangle denoted by the points (aX, aY), (bX, bY) and (cX, cY).
| aX | x-coordinate of first vertex in triangle |
| aY | y-coordinate of first vertex in triangle |
| bX | x-coordinate of second vertex in triangle |
| bY | y-coordinate of second vertex in triangle |
| cX | x-coordinate of third vertex in triangle |
| cY | y-coordinate of third vertex in triangle |
| weightB | weighting factor along axis A-B (between 0 and 1) |
| weightC | weighting factor along axis A-C (between 0 and 1) |
| pointX | x-coordinate of generated point |
| pointY | y-coordinate of generated point |
Definition at line 731 of file qgsgeometryutils_base.cpp.