Allows extraction of matching parts from a collection, returning
the corresponding collection subclass.
mixed_collection = QgsGeometryCollection()
mixed_collection.addGeometry(... mix of geometry types ...)
multi_line_string = mixed_collection.extractPartsByType(Qgis.WkbType.LineString)
In this case multi_line_string will be a QgsMultiLineString object,
containing just the line string parts from mixed_collection
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.
As for the sqrDistance and Distance 2D functions, this adds functions for 3D.
To maintain the lowest level, the specific case where a Z could be NaN
is not handled.
It is left to the responsibility of other methods using these functions.
This method will be used where multiple calls to `qgsDoubleNear(x1, y1, eps) &&
qgsDoubleNear(x2, y2, eps) && ... && qgsDoubleNear(xn, yn, eps)` are possible.