This method attempts to interpolate the point on a linestringM
where a specified m value falls. It does this by interpolating
M values along the line string segments, finding the first
segment at which the target M value falls. If the M value
corresponds to a part of the line with constant m values, then
the center point of this constant m value portion will be
returned.
Add QgsAbstractGeometry::simplifyByDistance, which is a direct
port of GEOS Douglas Peucker algorithm.
This is a trivial algorithm to implement, and we benefit from
avoiding the conversion to/from GEOS geometries.
The comparisons among QGIS were conducted on coordinates using a fixed epsilon:
specifically, 1e-8 for QgsPoint and the default value for qgsDoubleNear: 4 *
DBL_EPSILON.
Initially, I've standardized its use to 1e-8 universally; it's already
significantly adequate for our Cartesian cases (1e-3 should suffice for many),
potentially fitting just right for geographical contexts.
Furthermore, in response to precision concerns, we're using the fuzzyEqual
and fuzzyDistanceEqual methods. These methods enable users/developers to
compare geometries more easily and with a given precision.
The API remains intact as operator==/equals() have been shifted into fuzzyEqual
(with an epsilon of 1e-8).
To consolidate the code between fuzzyEqual and fuzzyDistanceEqual, helper
functions, fuzzyHelpers, have been introduced following the logic of the
respective segments to be executed.
This enum was forcing an include of qgscoordinatetransform.h within the
widely used qgsabstractgeometry.h header, causing an absolute explosion
of includes of a bunch of very heavy header classes all across QGIS. By
removing the forced include we can avoid a ton of unwanted includes
and make wider use of forward declarations...
not QgsPointXY as indicated by the documentation
Also add support for constructing QgsLineString using arrays of
arrays of floats, given that we're having to hand-roll sip conversion
code anyway!
Now the following is supported:
line = QgsLineString([[1,2], [3,4], [5,6]])
which is much nicer and more "pythonic" then the explicit
QgsPoint/QgsPointXY sequences!
Fixes#43200
A port of the equivalent method from GEOS, but with added support
for curved geometries and M values
Reorganizes the geometry into a normalized form (or "canonical" form).
Polygon rings will be rearranged so that their starting vertex is
the lower left and ring orientation follows the right hand rule, collections
are ordered by geometry type, and other normalization techniques are applied.
The resultant geometry will be geometrically equivalent to the original geometry.
Allows for comparison of geometry objects, e.g. to allow for stable
sorting of them.
Ported from the GEOS equivalent method, but with addition of support
for M values and curved geometry types