[cairo] Qahirah: Approximately-Equal Vectors, Matrcies & Rectangles

Lawrence D'Oliveiro ldo at geek-central.gen.nz
Tue Oct 13 23:04:39 PDT 2015


I’ve felt for a while that it would be useful for Qahirah
<https://github.com/ldo/qahirah>, my high-level Python binding for
Cairo, to have “approximately-equal” comparisons for Vector, Matrix and
Rect objects.

One of the new features in Python 3.5 is the math.isclose
<https://docs.python.org/3/library/math.html#math.isclose> function,
which provides exactly such a comparison for real numbers.

So I have built on this to add “iscloseto” methods to those Qahirah
objects, with the same options for specifying both relative and
absolute tolerances for the comparisons.


More information about the cairo mailing list